Mixture of Experts — Technologies & Tricks

Updated July 2026 with 2025–2026 SOTA additions — new entries marked ★. Algorithm names link to their papers (arXiv / project page).

July 2026 · Updated Edition


Contents

  1. What Is Mixture of Experts?
  2. The MoE Block
  3. Routing Strategies
  4. Load Balancing
  5. Expert Parallelism
  6. Major MoE Architectures (Open Frontier)
  7. MoE in Vision and Multimodal
  8. Training MoE Models
  9. Inference for MoE
  10. Frameworks and Software
  11. Specialized MoE Variants
  12. Expert Specialization and Analysis
  13. MoE Scaling Laws
  14. Production Patterns and Trade-offs
  15. Common Failure Modes and Mitigations
  16. Recent Frontier (2025–2026)
  17. Production Stack 2026

Appendix A: Twenty-Five Things to Know

Appendix B: Decision Tree — "MoE or Dense?"

Appendix C: Year-by-Year MoE Milestones

1. What Is Mixture of Experts?

1.1 The core idea

A neural network in which most of the parameters are not used for any single input. Each input token activates only a small subset of expert sub-networks via a learned router. Total parameter count grows; per-token compute does not.

1.2 Conditional computation

Standard dense networks: every parameter touches every input. MoE: each input touches a tiny fraction of parameters. Frees the model to grow capacity (knowledge, specialization) without paying linearly for compute.

1.3 Active vs total parameters

Two numbers that must be cited side-by-side:

Examples (2025–2026 open frontier):

Model Total Active Ratio
Mixtral 8×7B 47B 13B 3.6×
Mixtral 8×22B 141B 39B 3.6×
DeepSeek-V2 236B 21B 11×
DeepSeek-V3 671B 37B 18×
Qwen2-MoE 57B 14B
DBRX 132B 36B 3.7×
Grok-1 314B 86B 3.7×
Snowflake Arctic 480B 17B 28×
MiniMax-01 456B 46B 10×

1.4 Why use MoE?

1.5 Why not MoE?

Key

The 2026 consensus: MoE is the dominant scaling pattern at the open frontier (DeepSeek-V3, Llama 4, Qwen 3, Mixtral 8×22B). For models above \(\sim 30\mathrm{B}\) total, MoE almost always wins on compute-quality Pareto.

2. The MoE Block

2.1 Where MoE goes in a Transformer

Standard placement: replace the FFN / MLP in some or all Transformer blocks with a sparse MoE block.

Attention remains dense.

2.2 The sparse FFN block

Input \(x \in \mathbb{R}^d\), N experts \(\{E_1, \dots, E_N\}\) each a dense MLP \(E_i : \mathbb{R}^d \to \mathbb{R}^d\). Router (gating) \(g : \mathbb{R}^d \to \mathbb{R}^N\) produces routing logits.

\[\mathrm{logits} = W_g x \in \mathbb{R}^N, \quad p = \mathrm{softmax}(\mathrm{logits}).\]

Top-k experts selected:

\[\mathcal{T} = \mathrm{TopK}(p), \quad y = \sum_{i \in \mathcal{T}} \frac{p_i}{\sum_{j \in \mathcal{T}} p_j}\, E_i(x).\]

2.3 Where the router lives

2.4 How often to insert MoE

2.5 Expert size

2.6 Combining outputs

After top-k selection, normalize the gates of selected experts and weighted-sum:

\[y = \sum_{i \in \mathcal{T}} \tilde{p}_i \cdot E_i(x), \quad \tilde{p}_i = p_i / \sum_{j \in \mathcal{T}} p_j.\]

Some recipes skip normalization (use raw \(p_i\)); the difference is empirically small.

3. Routing Strategies

3.1 Top-k routing (standard)

Select the top-k experts by router score. k = 2 standard (GShard, Mixtral); k = 1 also common (Switch). Higher k: more compute per token, possibly better quality.

3.2 Switch routing (top-1)

Switch Transformer (Fedus et al. 2021): k = 1. Each token routed to exactly one expert. Simplest; fastest; surprisingly strong.

3.3 Top-2 routing (Mixtral, GShard)

Standard for many open MoEs. Typically gives a quality bump over top-1 at \(\sim 2\times\) compute.

3.4 Top-k with token dropping

If an expert exceeds capacity, drop the token (it bypasses MoE via residual). Required when capacity is bounded.

Can hurt quality at small capacity; padding adds wasted compute.

3.5 Soft MoE (Puigcerver et al. 2023)

Each expert receives a learned weighted average of all tokens (no hard routing). S slots per expert; S·N slot tokens computed by N experts. Avoids load imbalance and dropped tokens. Used in vision settings.

3.6 Expert Choice routing (Zhou et al.)

Each expert picks the top-k tokens it wants (not vice versa). Automatic load balancing (every expert gets exactly its capacity). Good for training, awkward for autoregressive inference (hard to batch).

3.7 Hash-based routing

Deterministic routing based on token id (hash of input embedding). Eliminates router learning; surprisingly competitive baseline.

3.8 Random routing baseline

Uniformly random expert assignment. Surprisingly hard to beat; ablation reveals routing learns relatively little vs random for some tasks.

3.9 Learned router architecture

3.10 Routing temperature

Pre-softmax temperature \(\tau\) sharpens / softens routing distribution:

\[p = \mathrm{softmax}(\mathrm{logits}/\tau).\]

Lower \(\tau\): more decisive (closer to argmax). Higher \(\tau\): more exploration. Often annealed: warmer early in training, sharpen later.

3.11 Router noise

Add Gaussian noise to logits during training:

\[\widetilde{\mathrm{logits}} = \mathrm{logits} + \mathcal{N}(0, \sigma^2).\]

Encourages router exploration; reduces routing collapse early in training.

4. Load Balancing

4.1 The collapse problem

Without explicit balancing, routers tend to concentrate on a few popular experts. Underused experts get no gradient \(\to\) they atrophy \(\to\) even less used. Catastrophic mode collapse to a dense-equivalent network.

4.2 Auxiliary load-balancing loss (Switch)

Let \(f_i\) = fraction of tokens routed to expert \(i\), \(p_i\) = mean router probability for expert \(i\) across the batch. Auxiliary loss:

Key

Switch's load-balancing loss:

\[\mathcal{L}_{\mathrm{LB}} = \alpha \cdot N \cdot \sum_{i=1}^{N} f_i \cdot p_i, \quad \alpha \sim 10^{-2}.\]

Minimizing pushes \(f_i\), \(p_i\) toward \(1/N\) uniform.

The product \(f_i p_i\) is differentiable through \(p_i\) (router output) but not through \(f_i\) (hard top-k). Effective signal is on \(p_i\).

4.3 Z-loss (router z-loss)

Penalize the magnitude of the log-sum-exp of router logits:

\[\mathcal{L}_{\mathrm{Z}} = \alpha_z \cdot \mathbb{E}\!\left[\left(\log \sum_i e^{\mathrm{logits}_i}\right)^2\right].\]

Keeps logits at moderate scale; prevents one expert's logit blowing up. Critical for FP16/BF16 stability.

4.4 Capacity factor

Each expert has capacity \(C = \mathrm{CF} \cdot T/N\) where \(T\) = batch tokens, \(\mathrm{CF} \sim 1.0\text{–}2.0\). When CF is small: token dropping. When CF is large: padding, wasted compute. Trade-off.

4.5 Padding behavior

For batched expert computation, all experts process equal-size buckets. Underused experts pad with zeros (wasted compute). Overused experts drop overflow tokens (quality loss).

4.6 DeepSeek's auxiliary-loss-free balancing

DeepSeek-V3 introduces a per-expert bias term \(b_i\) that's adjusted dynamically (no gradient):

\[\mathrm{score}_i = g_i(x) + b_i.\]

After each step, increase \(b_i\) for under-utilized experts, decrease for over-utilized. Achieves load balance without an auxiliary loss term that biases the gradient. Avoids the quality-vs-balance trade-off.

4.7 Sequence balance loss

Switch / DeepSeek also add a sequence-level balance loss to prevent routing all tokens of a sequence to the same expert:

\[\mathcal{L}_{\mathrm{seq}} = \alpha_s \cdot N \cdot \sum_i f_i^{\mathrm{seq}} \cdot p_i^{\mathrm{seq}},\]

computed per sequence rather than per batch.

4.8 Stability tricks summary

5. Expert Parallelism

5.1 The problem

MoE total parameters easily exceed single-device memory. Solution: distribute experts across devices. But each token may need an expert on a different device.

5.2 Expert Parallelism (EP)

Each of E devices holds N/E experts. The all-to-all primitive routes tokens to where their experts live, then back:

  1. Compute router on every device.
  2. All-to-all: send each token to the device hosting its expert.
  3. Each device computes its experts on received tokens.
  4. All-to-all: send results back to original devices.

5.3 Communication cost

Two all-to-all operations per MoE layer: dispatch and combine. Volume: \(O(B \cdot d/E)\) per device, with \(B\) = global batch tokens.

5.4 Composing EP with TP/PP/DP

Total devices \(N_{\mathrm{dev}} = \mathrm{DP} \times \mathrm{TP} \times \mathrm{PP} \times \mathrm{EP}\). Common pattern:

5.5 Communication-computation overlap

Modern stacks (Megatron-MoE, DeepSpeed-MoE) overlap:

Hides much of the all-to-all latency.

5.6 Expert pinning / sharding choices

5.7 Token dispatch optimizations

6. Major MoE Architectures (Open Frontier)

6.1 Switch Transformer (Google 2021)

First production-scale sparse Transformer at trillion params. Top-1 routing, simple load balance, encoder-decoder T5 backbone. Demonstrated MoE matches dense at 1/7 FLOPs.

6.2 GShard (Google 2020)

Top-2 routing across 2048 experts on TPU. Established expert parallelism + auxiliary loss patterns.

6.3 GLaM (Google 2022)

1.2T total / 96.6B active. Decoder-only MoE matched GPT-3 quality at \(\sim 1/3\) training compute.

6.4 ST-MoE

Stable training recipe with z-loss; emphasized stability tricks for MoE at scale.

6.5 Mixtral 8×7B (Mistral 2023)

6.6 Mixtral 8×22B (2024)

141B total / 39B active. Same recipe, scaled. Strong open frontier MoE through 2024.

6.7 DeepSeekMoE / V2 / V3

DeepSeekMoE (2024): introduced two key design choices that became standard:

DeepSeek-V2 (2024): 236B total / 21B active. + MLA (Multi-Latent Attention).

DeepSeek-V3 (2024): 671B total / 37B active.

DeepSeek-V3.2 / R1 (2025): same architecture; R1 with RL post-training for reasoning.

6.8 Qwen MoE family

Qwen-1.5-MoE-A2.7B, Qwen2-MoE, Qwen2.5-MoE, Qwen3-MoE: Alibaba's open MoE line. Qwen2-57B-A14B and larger; Qwen 3 is 2025 frontier.

6.9 DBRX (Databricks 2024)

132B total / 36B active. Fine-grained 16 experts, top-4 routing (smaller experts than Mixtral). Open-weights enterprise model.

6.10 Grok-1 (xAI 2024)

314B total / 86B active. 8 experts, top-2. Open-weights release.

6.11 Snowflake Arctic (2024)

480B total / 17B active (\(28\times\) ratio — highest among open). Hybrid: dense MLP + 128 small experts in parallel; top-2.

6.12 Skywork-MoE, JetMoE, OLMoE, Phi-MoE, MiniMax-01

Various open MoE releases. OLMoE: fully open including data + training code. MiniMax-01: 456B / 46B active with linear attention + softmax attention hybrid + MoE.

6.13 Llama 4 (2025)

Meta's first open MoE (variant). Scout + Maverick variants; mixture of expert + dense layers.

7. MoE in Vision and Multimodal

7.1 V-MoE (Riquelme et al. 2021)

First large-scale sparse vision Transformer. Per-patch routing in ViT. Showed MoE benefits transfer to vision.

7.2 LIMoE (Mustafa et al. 2022)

Multimodal MoE: shared experts across image and text, with modality-aware load balancing. Per-modality balance loss.

7.3 Soft MoE (Puigcerver et al.)

Soft routing for vision: each expert receives a learnable weighted combination of all tokens. No load imbalance or dropping. Strong on ImageNet at fixed FLOPs.

7.4 MoE-LLaVA

First open MoE VLM. Sparse upcycling from a dense LLaVA: replace some MLPs with N experts initialized from the dense MLP.

7.5 CuMo (CodepathPress 2024)

Vision MoE for multimodal: sparse experts in both vision encoder and MLP projector. Strong VLM performance at lower active compute.

7.6 Aria (Rhymes AI 2024)

24.9B total / 3.9B active. Native multimodal MoE; long-context (64K tokens).

7.7 DeepSeek-VL2 (2024)

27B total / 4.5B active VLM. MoE applied to multimodal; matches much larger dense VLMs.

7.8 Mistral Pixtral, Pixtral-Large

Mistral's multimodal models, some with MoE.

7.9 LLaVA-MoLE, MoVA, Uni-MoE

Various MoE-VLM open lines exploring different routing / expert designs in multimodal context.

7.10 Modality-aware routing

8. Training MoE Models

8.1 Standard recipe

8.2 Initialization

8.3 Numerical stability

8.4 Auxiliary-loss-free training (DeepSeek-V3 trick)

After each training step:

\[b_i \leftarrow b_i - \gamma \cdot \mathrm{sgn}(f_i - 1/N),\]

where \(f_i\) is the recent fraction routed to expert \(i\), \(\gamma\) small. The bias \(b_i\) added to router scores at selection time but doesn't affect gating weights for combining outputs. Achieves balance with no gradient bias.

8.5 Multi-Token Prediction (MTP, DeepSeek-V3)

Auxiliary head predicts the next 2–4 tokens jointly. Improves data efficiency and can be used for speculative decoding at inference.

8.6 FP8 training for MoE

DeepSeek-V3: FP8 (E4M3) for matmuls in routed experts; BF16 for shared paths and accumulator. Per-block scaling factors. Halves memory; doubles throughput vs BF16.

8.7 Sparse upcycling (dense → MoE)

Convert a pretrained dense LLM into an MoE:

  1. Take dense MLPs of layers to convert.
  2. Replicate N times (with small noise added).
  3. Add a fresh router; train.
  4. Retrain on \(\sim 5\text{–}10\%\) of original data; recovers MoE quality.

Cheap path to MoE without pretraining from scratch. Used in MoE-LLaVA, CuMo, Phi-MoE.

8.8 Branch-Train-MiX (BTM, Sukhbaatar et al.)

Train multiple specialist dense experts independently on different domains; assemble into MoE. Avoids the routing-collapse problem entirely.

9. Inference for MoE

9.1 The serving challenge

9.2 Continuous batching with MoE

Continuous batching (vLLM, SGLang, TensorRT-LLM) handles per-token MoE by:

9.3 Expert offloading

For machines with insufficient memory:

9.4 ktransformers / llama.cpp MoE patterns

Make giant MoE models runnable on consumer hardware:

Enables 671B DeepSeek-V3 on a single workstation with 96GB VRAM.

9.5 Expert quantization

9.6 Speculative decoding for MoE

9.7 Caching expert activations

9.8 KV cache for MoE

Same as dense (attention is dense). MLA (Multi-Latent Attention) in DeepSeek-V2/V3 dramatically reduces KV memory, freeing budget for experts.

10. Frameworks and Software

10.1 Training frameworks

Framework Maintainer Notes
Megatron-Core MoE NVIDIA Production MoE; TP/PP/EP/SP/DP
DeepSpeed-MoE Microsoft ZeRO-MoE; MoE-aware partitioning
Tutel Microsoft Optimized all-to-all + dispatch
MegaBlocks MosaicML Block-sparse kernels for MoE
FastMoE TsingHua Open MoE training framework
DeepSeek-Megatron DeepSeek DeepSeek-V3 training stack
GShard Google (TF) Original; less used today
Mosaic Composer Databricks Used for DBRX

10.2 Inference frameworks

Framework Notes
vLLM Mainstream serving; MoE-aware kernels
SGLang High-throughput; MoE optimized
TensorRT-LLM NVIDIA's; MoE plus speculative decoding
ktransformers Consumer-hardware MoE serving
llama.cpp MoE on CPU + offload
MLX
TGI

10.3 MegaBlocks block-sparse kernels

Treats MoE as a block-sparse matmul: each token's expert assignment is a 1-hot in block-sparse B. Custom CUDA kernels run the MoE FFN as a block-sparse GEMM. \(\sim 2\text{–}4\times\) faster than naive token-shuffle implementations.

10.4 Tutel improvements

11. Specialized MoE Variants

11.1 Mixture-of-Depths (MoD, Raposo et al. 2024)

Sparse compute along the depth axis, not width. Each token can skip layers based on a router decision:

\[y_\ell = \begin{cases} f_\ell(x_\ell) & \text{if router selects this token} \\ x_\ell & \text{else} \end{cases}\]

Different tokens use different effective depths. Saves compute on easy tokens.

11.2 Mixture-of-Recursions (MoR)

Layers can be applied multiple times to hard tokens (recursion); skipped for easy tokens. Combines MoD with iterative refinement.

11.3 MoE in attention

11.4 Conditional computation more broadly

Skip-attention, early-exit (different exit layer per token), pondernet (variable computation per token). MoE is the dominant practical instantiation.

11.5 Hash MoE / Random MoE

Routing is fixed (hash) or random; no learning. Surprisingly competitive. Used as research baseline; rarely production.

11.6 Pyramid Residual MoE (PR-MoE)

Router complexity scales with layer depth; deeper layers have more experts. Cheaper / faster training without quality loss.

12. Expert Specialization and Analysis

12.1 Do experts specialize?

Empirically: for fine-grained MoE (DeepSeekMoE-style), yes — experts develop clear specialization (math, code, document type, language). For coarse Mixtral-style, less clear; experts often look interchangeable.

12.2 Common specializations observed

12.3 Shared experts (DeepSeek-style)

1–2 always-on experts shared by all tokens. Capture redundant "common knowledge." Routed experts can specialize because they don't need to relearn the basics. Standard since DeepSeekMoE.

12.4 Expert merging / pruning

12.5 Routing analysis tools

13. MoE Scaling Laws

13.1 Compute-quality scaling

At fixed training FLOPs:

13.2 Optimal expert count

13.3 Optimal k

13.4 Compute-optimal MoE (Chinchilla-style)

For fixed compute C:

13.5 Inference scaling

Per-token inference cost scales with active params, not total. So MoE inference is much cheaper than dense at equivalent quality. Memory cost scales with total params (or use offloading).

14. Production Patterns and Trade-offs

14.1 When MoE wins

14.2 When dense wins

14.3 Memory math for MoE serving

For DeepSeek-V3 (671B / 37B active) in BF16:

\[\mathrm{Memory} \approx 2 \cdot 671\mathrm{B} = 1342\ \mathrm{GB}\]

just for weights. With FP8 / Q4 quantization: \(\sim 670\) / \(\sim 335\) GB. Fits on 8×H200 (1128 GB) easily; or 1× workstation with quant + offload.

14.4 Cost models

14.5 Comparison: MoE vs Dense (same active params)

At fixed active params, MoE matches a much larger dense model in quality. Mixtral 8×7B (13B active) \(\approx\) Llama-2-70B quality at \(\sim 1/5\) inference cost.

14.6 Multi-tenant serving

15. Common Failure Modes and Mitigations

15.1 Routing collapse

All tokens routed to a few experts. Fix: load-balance loss, router noise early in training, capacity factor, DeepSeek bias trick.

15.2 Token dropping

Tokens overflow expert capacity and bypass MoE. Fix: increase capacity factor, balance routing better, or accept (residual carries information).

15.3 Numerical instability

Router logits explode or NaN. Fix: router z-loss, stable softmax, FP32 router, gradient clipping.

15.4 Communication bottleneck

EP all-to-all dominates step time. Fix: hierarchical all-to-all (NVLink + IB), local-first routing, communication-computation overlap.

15.5 Expert atrophy

Some experts get few gradients, never learn. Fix: balance loss, periodic re-init of cold experts, capacity factor.

15.6 Quality regression vs dense

MoE training underperforms expected. Fix: check load balance (entropy), tune \(\alpha\) on aux loss, try sparse upcycling instead of from-scratch.

15.7 Inference batching loss of throughput

Batching breaks because tokens want different experts. Fix: continuous batching at token level, MegaBlocks block-sparse kernels, sufficient parallelism.

16. Recent Frontier (2025–2026)

16.1 DeepSeek-V3 / R1 architecture choices

16.2 Llama 4 (Meta 2025)

First Llama with MoE; Scout (109B / 17B active) and Maverick (400B / 17B active) variants.

16.3 Qwen 3 MoE

Frontier-open MoE (235B / 22B active and similar). Extended R1-style reasoning post-training.

16.4 MiniMax-01 with hybrid attention

Linear + softmax hybrid attention + MoE; long-context efficient.

16.6 Open research questions

17. Production Stack 2026

Use case Default model / framework Notes
Frontier open LLM DeepSeek-V3 / Llama 4 / Qwen 3 MoE Auxiliary-loss-free MoE
Mid-tier open LLM Mixtral 8×22B / DBRX Coarse MoE, k = 2
Open VLM (MoE) DeepSeek-VL2 / Aria / CuMo Multimodal MoE
Reasoning open DeepSeek-R1 (MoE base) + GRPO R1-style
Training framework Megatron-Core MoE / DeepSpeed-MoE Production scale
Inference (cloud) vLLM / SGLang / TensorRT-LLM Continuous batching + EP
Inference (consumer) ktransformers / llama.cpp + Q4 + offload 671B on workstation
Inference (Apple Silicon) MLX Quantized MoE
Long-context MoE MiniMax-01 / DeepSeek-V3 + MLA Hybrid attention + MLA
Sparse upcycling MosaicML / FastMoE recipe dense LLM → MoE

★ 2026 SOTA update — Frontier Open MoE LLMs 2025

★ 2026 SOTA update — Trillion-Scale And New Entrants

★ 2026 SOTA update — MoE Routing Advances 2025

★ 2026 SOTA update — Ultra-Sparse Fine-Grained Designs

★ 2026 SOTA update — MoE For Reasoning (RL Post-Training)

★ 2026 SOTA update — MoE Efficiency And Kernels

★ 2026 SOTA update — Upcycling And MoE Conversion

Appendix A: Twenty-Five Things to Know

  1. Total vs active params: always cite both.
  2. Top-k routing: k = 1 Switch, k = 2 standard, k = 8 DeepSeek fine-grained.
  3. Switch's load-balance loss: \(\alpha N \sum f_i p_i\).
  4. Router z-loss for stability.
  5. Capacity factor \(\sim 1.25\) training, \(\sim 2\) inference.
  6. DeepSeek's auxiliary-loss-free trick: per-expert bias \(b_i\).
  7. Fine-grained experts + shared experts (DeepSeekMoE).
  8. Sparse upcycling: dense \(\to\) MoE cheaply.
  9. Branch-Train-MiX: independent training \(\to\) assemble.
  10. Soft MoE for vision: no hard routing, no token drop.
  11. Expert Choice routing: experts pick tokens.
  12. Hash MoE: fixed routing baseline.
  13. EP all-to-all: dispatch + combine per layer.
  14. Composing EP × TP × PP × DP.
  15. MegaBlocks block-sparse GEMM kernels.
  16. Tutel adaptive parallelism.
  17. Continuous batching with per-token expert dispatch.
  18. ktransformers for consumer-hardware MoE.
  19. DeepSeek-V3: 671B / 37B / FP8 / MTP / MLA.
  20. Mixtral 8×7B as the open MoE that broke through.
  21. Llama 4 brought MoE into the Llama line.
  22. MoE wins at fixed active params; dense wins at fixed memory.
  23. Routing collapse fix: aux loss + z-loss + capacity.
  24. Mixture-of-Depths: sparse over depth, not width.
  25. Shared expert pattern: 1–2 always-on for common knowledge.

Appendix B: Decision Tree — "MoE or Dense?"

  1. Memory-constrained device (mobile, edge)? → Dense. MoE memory overhead too high.
  2. Single-batch latency-critical? → Dense, unless you can batch enough requests.
  3. Cloud serving with high throughput? → MoE. Amortize memory; per-token compute lower.
  4. Pretraining frontier model from scratch? → MoE. Compute-quality Pareto wins above \(\sim 30\mathrm{B}\).
  5. Have a strong dense LLM, want bigger? → Sparse upcycle dense to MoE.
  6. Want easy quantization + serving? → Dense. MoE quantization is harder.
  7. Need experts specialized for domains? → Branch-Train-MiX or fine-grained MoE.
  8. Vision / multimodal model? → Both viable; DeepSeek-VL2-style or CuMo / Aria if going MoE.

Appendix C: Year-by-Year MoE Milestones