LLM & Transformer Fundamentals·Question 50 of 109AdvancedAI-75

Explain Mixture-of-Experts: the router, top-k experts, total vs active parameters. Why does it win?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

MoE replaces each transformer block's dense MLP with E parallel expert MLPs plus a lightweight learned router (typically a single linear layer producing scores over experts, per token, per layer). For each token, the router selects the top-k experts (k = 1 or 2 classically; DeepSeek-style designs use finer-grained experts with larger k, often plus an always-on shared expert); the token is processed by only those experts, and their outputs are combined weighted by the router's (softmaxed) gate values. Attention layers usually stay dense; routing decisions are made independently per token and per layer.

Full worked answer with diagram

MoE replaces each transformer block's dense MLP with E parallel expert MLPs plus a lightweight learned router (typically a single linear layer producing scores over experts, per token, per layer). For each token, the router selects the top-k experts (k = 1 or 2 classically; DeepSeek-style designs use finer-grained experts with larger k, often plus an always-on shared expert); the token is processed by only those experts, and their outputs are combined weighted by the router's (softmaxed) gate values. Attention layers usually stay dense; routing decisions are made independently per token and per layer.

This decouples two things dense models entangle: capacity (total parameters - all experts) and per-token compute (active parameters - only k experts' worth). Mixtral 8x7B: 8 experts, top-2, ~47B total but ~13B active per token. DeepSeek-V3: ~671B total, ~37B active. In a dense model those numbers are equal by definition.

Why it wins: scaling laws reward parameters, but dense parameter growth raises per-token FLOPs proportionally. MoE buys parameter count - more stored knowledge, more specialised computation - at a fraction of the FLOP cost. Empirically, an MoE reaches a given loss with substantially less training compute than a dense model of equal quality, and serves with the latency profile of its active size. The implicit bet, which holds in practice, is that not every token needs every parameter: experts specialise (observed specialisation is often syntactic/token-level - code, punctuation, numbers - rather than the tidy topical "math expert" story), and conditional computation exploits that. It's the same economic logic as overtraining: optimise quality per inference FLOP, not per parameter.

The costs (previewing the follow-up question): routing is a discrete, load-balancing-sensitive operation that complicates training; and at inference all experts must be resident in memory - you pay memory for total params while only computing with active ones, which shapes where MoE makes deployment sense (large batched serving, expert-parallel clusters) and where it doesn't (single consumer GPU).

Worth sketching. Draw the idle experts too: that is where the memory-versus-FLOPs distinction lives.

flowchart LR
    T["one token, one layer"] --> R["router: linear layer scores E experts"]
    R --> TK["take top-k, softmax the gates"]
    TK --> E1["expert 3 MLP"]
    TK --> E2["expert 7 MLP"]
    E1 --> S["sum, weighted by gate value"]
    E2 --> S
    S --> RES["back into the residual stream"]
    R -.-> IDLE["other experts skipped this token<br/>but still resident in memory"]

What a good answer covers

  • MoE replaces each transformer block's dense MLP with E parallel expert MLPs plus a lightweight learned…
  • For each token, the router selects the top-k experts (k = 1 or 2 classically; DeepSeek-style designs use…
  • Attention layers usually stay dense; routing decisions are made independently per token and per layer
  • This decouples two things dense models entangle
  • Mixtral 8x7B: 8 experts, top-2, ~47B total but ~13B active per token

Key terms: E parallel expert MLPs · router · top-k · capacity · per-token compute

Interviewer follow-ups to expect

  1. Why route per-token rather than per-sequence?

  2. What do experts actually specialise in, empirically?

  3. Is a 47B-total/13B-active MoE comparable to a 13B dense model or a 47B dense model - on what axis?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep