Architecture / Sparsity
verifiedMixture-of-Experts
A dense model pushes every token through every parameter it owns. A mixture-of-experts model keeps many parallel sub-networks and wakes only a couple per token, chosen by a small router. The model can hold far more knowledge than it spends compute on, because you pay for the experts you wake up, not the ones you own.
Replace the feed-forward block with N expert FFNs and a learned router. The router scores every token against all N experts and dispatches it to the top-k, usually k=2. Compute scales with k, not N, so parameter count and FLOPs decouple. The cost moves from compute to memory and to balance: every expert must be resident, and a router that favours a few experts wastes the rest while overflowing its favourites past their capacity factor.
For token x, the router computes g = softmax(W sub r · x) over N experts and selects T = top-k(g). The output is y = Σ sub i∈T (g sub i / Σ sub j∈T g sub j ) · E sub i (x), so the mixture stays a convex combination of the chosen experts. Training adds an auxiliary load-balancing loss, typically α · N · Σ sub i f sub i · P sub i , where f sub i is the fraction of tokens routed to expert i and P sub i the mean router probability for it. The product is minimised when both are uniform.
6 tokens routed across 8 experts. Each token wakes its top 2. Expert 1 stays asleep. 1 assignment was dropped where an expert exceeded its capacity of 2.
6 tokens routed across 8 experts. Each token wakes its top 2. Expert 1 stays asleep. 1 assignment was dropped where an expert exceeded its capacity of 2.
Solid cells are each token's first-choice expert, faint cells its second. Outlined experts stay asleep for this batch. Drag top-k to watch compute rise as more experts wake.
Same primitive, engineer depth: per-expert utilisation across the batch. Experts near capacity sit beside experts that idle — the imbalance the auxiliary loss is paid to fix. Drag top-k to watch load balance and FLOPs move together.
Dashed = dropped, expert at capacity (2)
Bar = share of each expert's capacity used
Reviewed by opendroid · 2026-08-01
- arXiv:1701.06538 — Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer
- arXiv:2101.03961 — Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity