Skip to main content
issue 2026-08-08AI Research35 minNeurIPS 2022interactive

Mixture-of-Experts with Expert Choice Routing

This research paper explains why letting experts choose tokens — instead of tokens choosing experts — removes the auxiliary balancing loss and speeds MoE training while keeping activation cost fixed.

Experts choose tokens so every expert runs at fixed capacityOn the left, token-choice routing lets tokens pile onto a popular expert while others idle. On the right, each expert selects its top-k tokens into an even bucket, so load balance is perfect and important tokens can still be claimed by many experts.TOKEN CHOICEENTER · PICK EXPERT · IMBALANCEt1t2t3E★OVERFLOWIDLEEXPERT CHOICEENTER · EXPERT PICKS · FILL kE0TOP-kE1TOP-kE2TOP-kkFULLkFULLkFULLFlip TopK: experts pick tokens → every bucket size is kExperts choose tokens so every expert runs at fixed capacityThree experts each fill a fixed top-k token bucket. Unlike token choice, no expert overflows or idles.EXPERT CHOICEEACH EXPERT FILLS k TOKENSE0kFULLE1kFULLE2kFULLPerfect load balance by construction

Sparse mixture-of-experts (MoE) layers promise a sweet deal: grow the parameter count while keeping the activated compute per token roughly fixed. In practice that deal often breaks at the router. When every token independently picks its top-kk experts, some experts overflow their capacity, others starve, and training papers reach for an auxiliary load-balancing loss.

This paper’s move is almost embarrassingly simple. Instead of tokens choosing experts, experts choose tokens. Each expert independently takes its top-kk highest-affinity tokens. Capacity is uniform by construction. Tokens that matter can still be claimed by many experts; easy tokens can be claimed by few. The affinity matrix is the same object Switch and GShard already compute — only the TopK axis flips.

What this paper explains

Standard MoE FFN layers replace a dense feed-forward block with ee expert FFNs plus a gating network. For token representations XRn×dX \in \mathbb{R}^{n \times d}, the gate produces affinities between tokens and experts. Prior work (Switch top-1, GShard top-2) does token choice: each of the nn tokens selects kk experts.

Zhou et al. study expert choice: each of the ee experts selects kk tokens, with

k=neck = \frac{n}{e} \cdot c

where cc is a capacity factor. Setting c=2c = 2 matches the activation budget of GShard top-2 gating so comparisons stay fair. The method returns three matrices used to gather tokens, weight them, and scatter expert outputs back — same systems skeleton as token-choice MoE, different index selection.

Prior limits

  • Load imbalance. Independent token decisions pile traffic onto popular experts. Overloaded experts drop tokens or stretch step latency; under-used experts waste capacity.
  • Auxiliary losses. Switch and GShard encourage balance with an extra loss term. That term is a second objective fighting the primary likelihood.
  • Uniform compute per token. Token choice gives every token exactly kk experts. The paper argues important tokens should be allowed more compute and simple tokens less — at the same global FLOP budget.
  • Under-specialization. Chronically under-filled experts never see enough diverse traffic to specialize.

The mechanism

Affinity, then transpose the TopK. Compute a token–expert score matrix ARn×eA \in \mathbb{R}^{n \times e} (same softmax-style gate as prior MoE work). Token choice runs TopK along the expert axis for each token. Expert choice runs TopK along the token axis for each expert:

  1. For expert ii, keep the kk tokens with largest A,iA_{\cdot, i}.
  2. Build index / gate / one-hot gather tensors (I,G,P)(I, G, P) so each expert receives exactly kk tokens.
  3. Run expert FFNs in parallel at fixed batch size kk.
  4. Scatter and combine weighted expert outputs back into the token stream.
Token choice versus expert choice on the affinity matrixLeft panel: each token row picks top experts along the expert axis. Right panel: each expert column picks top tokens along the token axis.TOKEN CHOICETopK over experts (→)hot expert column fills upEXPERT CHOICETopK over tokens (↓)each expert column keeps exactly k cells
Same affinity scores, different TopK axis. Token choice can overload one expert column; expert choice fills every column to capacity k.

Because each expert’s bucket size is exactly kk, load balance is perfect without an auxiliary loss. Because buckets are chosen independently, the number of experts covering a given token is variable — often zero for some tokens at a layer (the paper mitigates this by interleaving dense Transformer layers) and larger than cc for others.

Interactive

How large is each expert's bucket?

Demo batch: n = 16 tokens, e = 4 experts. Bucket size k = (n/e)·c. Slide the capacity factor to see even fill and the average experts-per-token.

c = 2 is the paper’s default: same activation footprint as GShard top-2, but every expert is full.

Capacity factor. cc is the average number of experts per token if assignments were uniform. c=2c = 2 is the paper’s default (GShard-matched). c=1c = 1 matches Switch top-1 activation cost and still beats top-1 gating in their pre-training curves; even c=0.5c = 0.5 remains competitive with top-1 in the reported plots.

Algorithm walkthrough

  1. Choose expert count ee and capacity factor cc; set k=(n/e)ck = (n/e)\,c.
  2. Compute affinities AA with the learned gate on XX.
  3. For each expert, TopK over tokens → indices II and gates GG.
  4. Gather tokens with PP, apply expert ii’s FFN to its kk tokens, weight by GG.
  5. Scatter/combine into the layer output; continue the Transformer stack.
  6. Optional capped variant: after expert choice, limit how many experts a single token may keep (their EC-CAP2), trading a little quality for a hard per-token fan-in.
Capacity factor sets each expert bucket sizeThree experts each hold a bucket of k tokens. Average experts per token equals the capacity factor c when n tokens and e experts are fixed.E0k tokensE1k tokensE2k tokensk = (n / e) · c ··· c = 2 matches GShard top-2 activation cost
Raising the capacity factor c grows every expert's bucket together, so total activated compute stays tied to a single knob while load stays even.

The opening scene contrasts a token-choice pile-up (one hot expert overflowing) with expert-choice buckets that stay full and even. The slider above lets you change cc and watch bucket size kk and the implied average experts-per-token move together.

What to notice when reading

  • Figure 1 in the paper is the whole thesis: arrows reverse from “token → experts” to “expert → tokens.”
  • They drop the balancing auxiliary loss — balance is structural, not regularized.
  • Interleaving MoE and dense layers matters; some tokens can be skipped by a given MoE layer.
  • Autoregressive generation is called out as a limitation of the training expert-choice implementation (selection uses a full sequence view). Do not silently assume decode-time routing is identical.

Results and evidence

Numbers below are from the paper’s reported experiments (NeurIPS 2022 version / Parallel extract of the PDF). Treat them as the authors’ measurements under their setup, not universal constants.

ClaimReported result
Training speed vs GShard top-2EC-CF2 reaches the same eval perplexity in less than half the steps; each GShard top-2 step ~20% slower (imbalance)
Large MoE vs Switch / GShardOn an 8B/64E model, EC-CF2 improves average accuracy by more than 2% vs ST top-1 and GS top-2 on their 11-task suite
Vs dense8B/64E EC beats a T5 11B dense model on 7 of 11 selected GLUE/SuperGLUE tasks
Capped expert choiceLimiting each token to 2 experts (EC-CAP2) costs about 0.8 average accuracy points vs uncapped EC
Smaller capacityc=1c = 1 and even c=0.5c = 0.5 still outperform Switch top-1 in their perplexity plots

Limitations

Stated or clearly implied by the authors:

  • The expert-choice selection they study looks at a batch/sequence of tokens at once; auto-regressive decoding needs a different online assignment story.
  • Skipping tokens at MoE layers can hurt unless dense layers are interleaved.
  • Results are on their T5-style pre-train / fine-tune stack; exact GLUE numbers will not transfer unchanged to every modern decoder-only MoE.
  • Perfect expert load balance is not the same as perfect token coverage — some tokens may receive fewer experts than others by design.

How to read the paper

  1. Abstract + §1 — token-choice failure modes.
  2. §3.1–3.2 — pitfalls, then expert-choice equations and Figure 1.
  3. §3.3–3.4 — optional bipartite constraints / capping; architecture table.
  4. §4 training curves (Fig. 2–4) and Tables 2–4 for downstream numbers.
  5. Final limitations paragraph on autoregressive generation.

Knowledge check

What does expert-choice routing change relative to Switch / GShard token choice?

For n tokens, e experts, and capacity factor c, how many tokens does each expert take?

Why can expert choice drop the auxiliary load-balancing loss?

Keep reading

  1. Original paper (arXiv:2202.09368) — Figure 1, §3, Tables 2–4.
  2. Switch Transformers (token-choice top-1) — Fanout Daily 2026-07-30-switch-transformers and arXiv:2101.03961.
  3. GShard (top-2 token choice) — arXiv:2006.16668.

Sources

Practice this paper

All challenges