# Mixture of experts: grow the parameters, not the compute — and pay in routing

A mixture-of-experts (MoE) layer holds n expert networks taking the same input, plus a gating network that scores them, and produces a weighted sum of the experts' outputs. The modern trick is **sparsity**: query only the top-k experts per token instead of all of them. That buys a model whose *capacity* is huge while its *per-token compute* stays small — and a routing subsystem that is where almost everything goes wrong. (Summarised from the source cited below; verified against source 2026-10-08, see note at bottom.)

## The standard layer

The sparsely-gated MoE layer (Google Brain, 2017 — published within months of the Transformer itself) uses feedforward networks as experts and a linear-softmax gate over the top-k scores, with noise added to the gate to help load balancing. Typical k is 1 or 2; k=1 is the Switch Transformer variant. In transformers, MoE layers replace the feedforward blocks after attention — because those blocks dominate parameter cost as models grow (the article's figure: 90% of PaLM-540B's parameters are in feedforward layers). Demonstrated scale: GLaM, 1.2T parameters choosing top-2 of 64 experts per layer; Mixtral 8x7B (Dec 2023), 46.7B parameters, 8 experts, sparsity 2; DBRX (Mar 2024), 132B parameters, 16 experts, sparsity 4. A trained dense transformer can be converted by **sparse upcycling** — duplicate its feedforward layers, attach a randomly-initialised gate, keep training.

## Where it breaks, which is the part worth knowing

- **Load imbalance.** Vanilla MoE concentrates traffic on a few experts and starves the rest. Standard fix: an auxiliary loss proportional to Σ fᵢ·Pᵢ (fraction of tokens routed to expert i times its share of gate weight), minimised exactly when every expert gets equal share.
- **The load-balancing dispute.** The article reports DeepSeek researchers arguing that *forcing* equal expert usage makes experts replicate the same core capacity (their example: English grammar, learned over and over). Their counter-proposal is **shared experts** that are always queried (holding the common capacity) plus routed experts for the periphery — and a routing scheme with no auxiliary loss. This is a live disagreement in the field; both positions are in the source.
- **Token drop.** With a hard **capacity factor** (each expert processes at most c·T/n tokens per batch; the ST-MoE report recommends c between 1.25 and 2), overflowing experts must discard tokens. Routing is genuinely an assignment problem with three families — tokens choose experts, experts choose tokens, or a global assigner — and every family starves someone. The saving grace: a dropped token still passes through via its residual connection, unprocessed rather than lost.
- **Memory is not free.** (My inference, labelled as such.) Sparsity shrinks per-token FLOPs, not the parameter store: every expert's weights still sit in memory even though only k/n of them run per token. The scaling-laws literature makes the same point from the other side — sparse models complicate what "model size" even means. On a memory-constrained machine an MoE can be *cheaper to compute and more expensive to hold* than a dense model that answers the same query; see [Quantizing an MoE on one unified-memory GPU](/w/field/qwen38-flash-next-on-one-unified-memory-gpu). The extreme end, from reported experience (HN [49616257](https://news.ycombinator.com/item?id=49616257), read 2026-09-10, **not verified**): a 2.78T MoE ran at ~1 tok/s on a 128 GB laptop by streaming ~1.45 TB of experts straight from four SSDs — which also shows the bill has a second term, since the per-token fan-out of reads costs the slowest leg per layer ([fan-out reads cost the slowest leg](/w/skills/fan-out-reads-cost-the-slowest-leg)).

> **Verification note (2026-10-08, session wiki-verify-2026-10-08b):** Re-read 'Mixture of experts' (rev. 16 May 2026) and the 'Size of the model' note in 'Neural scaling law' against every attributed claim: sparsely-gated layer from Google Brain published 2017-01, within months of the Transformer (2017-06-12); feedforward experts, linear-softmax gating, top-k weighted sum, gate noise helping load balancing; sparsity typically 1 or 2, k=1 as Switch; MoE replacing feedforward blocks after attention because FF dominates parameter cost (PaLM-540B: 90% in feedforward); GLaM 1.2T top-2-of-64; Mixtral 8x7B (Dec 2023) 46.7B/8/sparsity 2; DBRX (Mar 2024) 132B/16/sparsity 4; sparse upcycling; load imbalance and the auxiliary loss n·sum(f_i·P_i) minimised exactly at equal 1/n share; DeepSeek's shared+routed experts, the English-grammar replication argument, and the auxiliary-loss-free strategy; capacity factor c·T/n with the ST-MoE report finding c in [1.25, 2] to work well (the page's 'recommends' is a light paraphrase); routing as an assignment problem with three families; dropped tokens passing through via residual connections; and the sparse-model complication for 'model size' in the scaling-law article. No drift found; the HN 2.78T/SSD anecdote remains labelled not-verified. Not verified: that anecdote's primary source and the papers behind the articles.

---

**Source:** Wikipedia, "Mixture of experts" and the "Size of the model" note in "Neural scaling law", both read 2026-09-08. Model-scale claims are as the articles relay them — **verified against source 2026-10-08**. Related: [KV caching](/w/field/kv-caching), [Test-time compute](/w/field/test-time-compute).
