Deep architectures
Mixture-of-Experts and Sparse Conditional Computation
Explain expert layers, learned routers, top-k dispatch, load balancing, capacity limits, communication cost, and the evidence required for expert specialization claims.
By the end you can
- Describe sparse expert routing and how it differs from a dense feed-forward layer
- Explain router scores, top-k dispatch, capacity factors, and auxiliary balancing losses
- Diagnose expert collapse, token dropping, communication bottlenecks, and instability
- Evaluate conditional computation through quality, utilization, throughput, and robustness
A sparse expert layer chooses a small parameter path per token
A router scores several expert networks for each token or example. The system dispatches the representation to one or a few selected experts. It then combines their outputs.
Total parameter capacity can grow while active computation stays closer to the selected subset. That separation is older than the Transformer backbone. In 2017 a sparsely-gated mixture-of-experts layer went between stacked LSTM layers. Shazeer and six colleagues reported “greater than 1000x improvements in model capacity with only minor losses in computational efficiency on modern GPU clusters”, from architectures “in which a MoE with up to 137 billion parameters is applied convolutionally between stacked LSTM layers”. Capacity and active computation were already being priced separately in 2017. The advantage still depends on efficient dispatch and balanced use across devices.
Sparse capacity is useful only when routing overhead and utilization remain controlled.
Visual
One top-k expert-routing step
Routing decisions create both a learning problem and a distributed-systems problem. The steps below are one design, not the design. Step two and step three are a contested pair: tokens choose experts, then a fixed buffer decides which of those tokens are actually served.
In 2022 Expert Choice routing inverted that order. Instead of tokens picking experts, experts pick tokens. The abstract states the whole idea in one sentence: “Instead of letting tokens select the top-k experts, we have experts selecting the top-k tokens.” Every expert then receives a fixed bucket size by construction. The capacity step is removed rather than tuned.
On Google's research blog, Zhou is blunt about the ordering being replaced: “The independent token choice approach often leads to an imbalanced load of experts and under-utilization.” The post is equally blunt about what the inversion bought: “EC routing speeds up training convergence by over 2x in an 8B/64E model, compared to the top-1 and top-2 gating counterparts.” The paper measures more than 2x faster training convergence than Switch Transformer top-1 and GShard top-2 gating at equal compute. It blames load imbalance under token-choice top-k for under-trained and mis-specialized experts. It reports higher fine-tuned quality on 11 GLUE and SuperGLUE tasks. The step order was never neutral.
- 1
Compute router logits
A small network scores experts for each token.
- 2
Select top-k experts
Only the highest-scoring routes remain active.
- 3
Respect capacity
Expert buffers limit how many tokens can be processed.
- 4
Run expert networks
Selected feed-forward transformations act independently.
- 5
Combine and return
Weighted expert outputs rejoin the main residual stream.
Case
Routing every token to a single expert bought up to sevenfold pre-training speed
The Switch Transformer routes each token to a single expert. That is the whole simplification of the dispatch step, and in 2022 its three authors measured what it bought. Models based on T5-Base and T5-Large obtained “up to 7x increases in pre-training speed with the same computational resources”. The multilingual version gained over mT5-Base “across all 101 languages”. The same design pre-trained “up to trillion parameter models” on the Colossal Clean Crawled Corpus. Same compute. More parameters. A different bottleneck.
Comparison
Dense and sparse capacity fail in different ways
Parameter count, active FLOPs, communication, and memory must be reported separately — and for shipped models they are.
Top-2 routing is not a diagram. It is what Mixtral 8x7B runs: 8 feed-forward experts per layer, and a router that selects two of them for each token. Mistral put the arithmetic in the abstract: “As a result, each token has access to 47B parameters, but only uses 13B active parameters during inference.” The release note of 11 December 2023 gives the same split more precisely, as 46.7B total and 12.9B active. That note also put the model under Apache 2.0.
The shared-plus-routed row has an instance too. DeepSeek-V3's technical report, from December 2024, opens its abstract this way: “We present DeepSeek-V3, a strong Mixture-of-Experts (MoE) language model with 671B total parameters with 37B activated for each token.” Each MoE layer there holds 1 shared expert and 256 routed experts, of which 8 routed experts fire per token. Load balancing uses the auxiliary-loss-free bias strategy rather than a balancing loss. Full training took 2.788M H800 GPU-hours.
The sparse rows were demonstrated long before either model. The 2017 sparsely-gated layer already separated capacity from active computation. Mixtral and DeepSeek-V3 are what that separation looks like once it has to be served.
Dense feed-forward
Every token uses the same full parameter block.
- Simple batching
- Predictable utilization
- Active cost grows with width
- No routing instability
Top-1 routing
Each token uses one selected expert.
- Low active expert compute
- Simple combination
- Hard routing errors
- High sensitivity to imbalance
Top-2 routing
Two experts receive each token.
- More robust mixtures
- Richer gradients
- Higher dispatch cost
- Capacity pressure increases
Shared plus routed experts
A common expert handles universal features while specialists receive selected tokens.
- Stable common path
- Supports specialization
- More architecture choices
- Shared expert may dominate
Analogy
A hospital triage desk routing patients to specialists
A triage desk sends each patient to one or two specialists, while a general clinician handles common needs. Capacity limits matter here: a perfect referral is useless if one clinic is overloaded.
The analogy breaks in one place. A hospital's specialties are defined before the first patient arrives. Experts learn jointly, and their roles are not predefined medical specialties. Routing quality and resource balance stay coupled.
Conditional computation succeeds only when the router learns useful assignments that the system can execute efficiently.
Key idea
Expert labels are hypotheses, not discovered ground truth
A cluster of tokens routed to one expert may correlate with language, topic, syntax, frequency, or position. Naming that expert “the math expert” without controlled interventions overstates the evidence.
The lab that shipped Mixtral 8x7B went looking for topic experts inside its own model and did not find them. The routing analysis in the Mixtral paper measures expert assignment on The Pile validation set and reports: “Surprisingly, we do not observe obvious patterns in the assignment of experts based on the topic.” The expert-assignment distributions for ArXiv papers, PubMed Abstracts and PhilPapers were near-identical, with only DM Mathematics marginally different. What the analysis did find was positional rather than semantic. Consecutive tokens were often routed to the same expert.
An independent, peer-reviewed audit reached the same conclusion. Wang and five colleagues ran COMMITTEEAUDIT across three MoE models on MMLU. They found a domain-invariant 'Standing Committee' of experts absorbing most of the routing mass. Their ACL 2026 abstract does not hedge: “These findings reveal a strong structural bias toward centralized computation, suggesting that specialization in Mixture of Experts models is far less pervasive than commonly believed.”
So inspect counterfactual routing, expert ablations, activation patterns, and task slices. Specialization can be distributed across experts and layers rather than localized cleanly. In these two studies it was largely not there to localize.
A router heatmap is not a semantic job description.
Example
When sparse capacity turns into sparse usefulness
Router statistics reveal failures hidden by aggregate loss. Two of the five below have a name in the literature, a published fix, and a command-line flag in a production training framework.
- Expert collapse: most tokens choose a few experts, leaving others undertrained and wasting parameters. “For Mixture-of-Experts (MoE) models, an unbalanced expert load will lead to routing collapse or increased computational overhead.” — the opening line of DeepSeek's loss-free balancing paper, August 2024. The usual cure is itself a cost: the auxiliary loss injects interference gradients that hurt model quality. Loss-Free Balancing instead adds a per-expert bias to the routing scores before the top-K decision, and updates that bias from recent load. It was validated on MoE models up to 3B parameters trained on up to 200B tokens. It ships in NVIDIA's Megatron-Core as the 'aux loss free' strategy, with --moe-router-enable-expert-bias and a default bias update rate of 1e-3.
- Capacity overflow: expert capacity is (tokens per batch / number of experts) × capacity factor, and overflow is not a queue. “If too many tokens are routed to an expert (referred to later as dropped tokens), computation is skipped and the token representation is passed directly to the next layer through the residual connection.” — the Switch Transformer paper. That same paper reports drop rates typically under 1% when the auxiliary load-balancing loss is weighted highly enough. Reproduce that number before assuming your own drops are harmless.
- Routing jitter: small representation changes switch experts and create unstable outputs near boundaries. Two nearly identical inputs can take different parameter paths.
- Communication domination: all-to-all dispatch costs exceed the saved expert computation on the target hardware. The saving disappears into the network rather than into throughput.
- Spurious specialization: experts separate by batch artifacts, language frequency, or sequence position instead of useful function. The positional clustering of consecutive tokens found in Mixtral's own routing analysis is exactly this shape.
Steps
Audit an MoE layer across model and infrastructure
Measure quality and systems behavior on the same workloads. Step 2 in particular is a configuration exercise rather than a research one. NVIDIA's Megatron-Core exposes the overflow mechanism as --moe-expert-capacity-factor, --moe-pad-expert-input-to-capacity and --moe-token-drop-policy, whose policies are probs and position. An engineer can set the capacity factor, decide which tokens lose their expert, and count what the setting cost.
1. Track routing distributions
Record expert load by layer, batch, domain, and token type.
2. Measure overflow behavior
Count dropped, rerouted, padded, and delayed tokens.
3. Profile communication
Separate expert compute from dispatch, synchronization, and memory movement.
4. Stress distribution shift
Test rare languages, long sequences, and altered batch composition.
5. Run expert interventions
Disable, swap, or constrain experts to test contribution and redundancy.
More parameters do not mean free knowledge capacity
Inactive expert weights still consume storage, optimizer state during training, and checkpoint bandwidth. Expert parallelism adds placement and communication constraints.
Report total parameters, active parameters, FLOPs, peak memory, network traffic, throughput, and quality. GLaM is a published model where those numbers appear together. Its 2022 abstract: “The largest GLaM has 1.2 trillion parameters, which is approximately 7x larger than GPT-3. It consumes only 1/3 of the energy used to train GPT-3 and requires half of the computation flops for inference, while still achieving better overall zero, one and few-shot performance across 29 NLP tasks.” Behind those figures sits a specific architecture: 64 experts per MoE layer, an MoE layer replacing the feed-forward block of every other layer of a 64-layer decoder — 32 MoE layers — and top-2 gating. Each token therefore activates a 96.6B-parameter subnetwork, 8% of the 1.2T; Google's blog rounds this to 97B. On average GLaM outperforms GPT-3 in 6 of 7 task categories.
Serving is the other half of the move, and it did not arrive free with the sparsity. Microsoft built a compression plus inference system to obtain it. DeepSpeed-MoE cuts MoE model size by up to 3.7x. It reports 7.3x better latency and cost than existing MoE inference solutions, and on that basis “DeepSpeed-MoE offers an unprecedented scale and efficiency to serve massive MoE models with up to 4.5x faster and 9x cheaper inference compared to quality-equivalent dense models.” Note what that last comparison is against. Quality-equivalent dense models, not models at matched active compute. Sparse models should be compared with dense baselines at matched serving budgets.
Conditional sparsity moves cost; it does not make the full model operationally free.
Key takeaways
- Mixture-of-experts layers activate only selected expert parameters per token: Mixtral 8x7B reaches 47B parameters while using 13B during inference, DeepSeek-V3 671B while activating 37B.
- Router scores, top-k choice, capacity factors, and balancing losses jointly shape sparse computation. Their ordering is contested: in Expert Choice routing the experts select the tokens, and it converges over 2x faster in an 8B/64E model.
- Expert capacity is (tokens per batch / number of experts) × capacity factor. Overflowed tokens skip the layer through the residual connection — under 1% of tokens in the Switch Transformer when the balancing loss is weighted highly enough.
- Dispatch communication may dominate active expert computation. DeepSpeed-MoE needed up to 3.7x compression plus a dedicated inference system to reach 4.5x faster and 9x cheaper inference than quality-equivalent dense models.
- Expert specialization claims require interventions: Mistral's routing analysis of Mixtral 8x7B found no topical patterns on The Pile, and COMMITTEEAUDIT (ACL 2026) found a domain-invariant 'Standing Committee' across three MoE models on MMLU.
- MoE comparisons should report total and active parameters, energy, communication, memory, throughput and quality together. GLaM did: 1.2T total, 96.6B active, half the inference FLOPs and one third of the energy used to train GPT-3.