The router — each token picks its own specialists
In a dense model, every token flows through the same giant network. In a Mixture-of-Experts layer, a tiny router looks at each token and sends it to just 2 of 8 experts. Different kinds of tokens learn to prefer different experts — code goes one way, French goes another. Click token types and watch the router light up the path.
Conceptual router: real MoE routers are learned linear layers producing a score per expert, then a top-2 softmax. The specialization (code→one expert, French→another) genuinely emerges during training.
Huge on paper, cheap in practice — the params calculator
This is the number that makes headlines. Set the expert count, the params per expert, and how many the router activates per token. The total is what you must store; the active is what you pay to compute for each token. Drag the sliders and watch the two numbers diverge.
Shared attention/embedding params are ignored here to keep the mental model clean — the expert FFN blocks are where the total-vs-active gap lives, and that's the point.
Capacity almost for free — MoE vs a dense twin
Here's the good case, head to head. A dense model that wanted the same knowledge capacity would have to run all of it on every token. An MoE gets roughly the same capacity while computing only its active slice. Feed both the same token stream and compare quality-per-token against compute-per-token.
Capacity ≈ how much specialized knowledge the model can hold. The MoE here has 8× the experts of the dense twin's single block, at ~1.1× the per-token FLOPs (router overhead). Numbers are computed live from the run below.
The hot expert — break it with load imbalance
The router is free to send tokens wherever it likes — and left alone, it plays favorites. One "hot" expert gets swamped while others sit idle. Overloaded experts hit a capacity limit and start dropping tokens (those tokens skip the layer entirely). Skew the traffic and watch the drops climb, then turn on load balancing to fix it.
Conceptual: real systems add an auxiliary load-balancing loss during training plus a capacity factor at inference. Dropped-token counts and the imbalance ratio below are computed live from the routing you set.
Routing flips — why near-identical inputs can diverge
Top-2 routing is a hard, discrete choice: an expert is either in or out. When two experts score almost the same, a microscopic change to the input — one extra word, a rounding difference — can flip which expert wins, sending the token down a different path and changing the output. Nudge the input near a decision boundary and catch the flip.
Conceptual: two experts' router scores are drawn as lines that cross. Away from the crossing, tiny nudges do nothing (good case). Right at it, a 0.01 nudge flips the chosen expert (bad case) — a real, documented source of MoE non-determinism, made worse by batch effects.