GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
ICLR 2017

Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer

Google Brain put thousands of small expert networks behind a learned router that picks a few per token, growing capacity over 1000x at little extra compute. Every MoE language model since starts here.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2017
AUTHORS
Shazeer, Mirhoseini, Maziarz, Davis, Le, Hinton, Dean
FROM
Google Brain, Jagiellonian University
PUBLISHED
Jan 2017 · ICLR 2017
CITED BY
6,288Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 20% of this breakdown.

01

The paper in one minute

Neural networks absorb more knowledge as they get more parameters, but in an ordinary network every parameter does work on every input. Doubling the model doubles the cost of every example, and with growing datasets, training cost rises roughly with the square of scale. Conditional computation, running only part of the network per example, was the obvious answer, and earlier attempts had not shown large gains in practice. GPUs are slow at branching, conditional parts see small batches, network bandwidth limits what can be split across machines, and gates tend to favor a few paths.

Shazeer and colleagues built a layer that made it work. A mixture-of-experts (MoE) layer holds n experts, each a small feed-forward network, and a gating network that, for each token, computes a score per expert, adds Gaussian noise scaled by a learned amount, keeps the top k scores and softmaxes them. Only those k experts run, and their outputs are summed with the gate weights. With k = 4 and 4,096 experts, 99.9% of the layer is idle for any given token.

Three engineering pieces made it efficient. The experts live on separate devices while the rest of the model runs data-parallel, so each expert receives tokens from every device's batch at once. The MoE is applied to all time steps of the previous LSTM layer together, enlarging its batch again. And a loss term penalizes uneven expert use, because otherwise the gate settles on a few experts that then train faster and get chosen even more.

The payoff was large. A 4-billion-parameter MoE language model using 6% of the compute of the best LSTM of the day beat it, a 68-billion-parameter one cut perplexity 39%, and an 8.7B-parameter MoE translation model beat Google's production GNMT system.

THE IDEA, VISUALLY
ONE TOKEN THROUGH AN MOE LAYER (SECTION 2) token x from LSTM below gate: x·W_g + noise keep top k, softmax E1 E2 E3 E4 0.62 E5 E6 E7 E8 E9 0.38 E10 E11 E12 only 2 of 12 experts run; 10 are skipped y = 0.62·E4 + 0.38·E9 parameters grow with the number of experts n; compute grows with k, the experts used per token 4,096 experts, k = 4: 99.9% of the layer idle per token Experts are spread over devices; each receives the tokens routed to it from every device's batch, so its batch grows with the number of devices (Section 3.1). 1-BILLION-WORD BENCHMARK (TABLE 1) test perplexity after 10 epochs; ops per timestep best LSTM, 151M ops 34.7 MoE, 8.9M ops 34.1 MoE, 33.8M ops 31.3 MoE, 142.7M ops 28.0 the cheapest MoE uses 5.9% of the LSTM's compute WITHOUT BALANCING, THE GATE COLLAPSES (TABLE 6) busiest expert's load as a multiple of the mean no balancing loss 17.80x importance loss 1.47x load loss 1.15x both, 1.0 each 1.07x test perplexity 39.8 with no loss, 35.6 to 35.7 with either loss SCALE 65,536 experts, 68B params: 39% lower perplexity on 100B words; 131,072 experts got worse arXiv 1701.06538, Google Brain, ICLR 2017
A gating network scores every expert for each token, adds tunable noise, keeps the top k and runs only those. Parameters grow with the number of experts while compute grows only with k. Without a balancing loss, the gate collapses onto a few favorite experts.
Research notes: the problem, approach and results
>1000x

increase in model capacity with only minor losses in computational efficiency (abstract)

137B

parameters in the largest MoE layer, 131,072 experts, applied between stacked LSTMs (Section 5.2)

5.9%

of the per-timestep compute of the best published LSTM for the low-budget MoE model that beat it (Table 1)

THE PROBLEM

Model quality kept improving with parameters, but in a dense network every parameter is used for every example, so training cost grows with both model size and data. Conditional computation, using only part of a network per example, had been proposed for years but never delivered large gains on real hardware.

THE IDEA

Insert a mixture-of-experts layer between LSTM layers: up to thousands of feed-forward experts plus a trainable gate that adds noise to its scores, keeps the top k, and softmaxes over them. Fix the small per-expert batches by combining data-parallel batches at the MoE layer, and add a loss that keeps experts equally used.

THE RESULT

On the 1-Billion-Word benchmark, a 4-billion-parameter MoE model needing 8.9 million ops per timestep beat the best published LSTM (151 million) on perplexity at matched epochs. On 100 billion words, 65,536 experts (68B parameters) cut perplexity 39%. On WMT'14 translation, BLEU rose 1.34 (En-Fr) and 1.12 (En-De) over GNMT.

02

Why it matters to an FDE

Most frontier and many open models today are mixtures of experts. This paper explains the trade they make, and that trade shows up in every deployment conversation.

Compute follows active parameters, memory follows total parameters. An MoE model's cost per token depends on the k experts it runs, but every expert's weights must sit in GPU memory. A model can be cheap per token and still need several GPUs just to hold it. Size hardware by total parameters and estimate throughput by active ones.

Batching works differently. Each expert only sees the tokens routed to it. At low traffic, experts receive tiny batches and GPUs run inefficiently; at high traffic, an unlucky expert can become a hot spot. Serving MoE well needs enough concurrent load and expert placement across devices.

Routing is learned, and it can be lopsided. The paper's own ablation shows an unbalanced gate sending nearly 18 times the average load to one expert. When a customer asks why an MoE model's latency varies with input type, uneven expert load is a likely place to look.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Noisy top-k gating, the shrinking-batch fix, the balancing losses, the results and two misreadings

    Free account
  2. 04How it works

    The gate's equations, how experts are placed on devices, the two balancing losses, and the hierarchy

    Premium
  3. 05The numbers that matter

    Language-modeling tables, the 100B-word scaling run, translation results and the balancing ablation

    Premium
  4. 06Try it yourself

    Recheck the tables, compute per-expert batch sizes, and watch a toy router collapse

    Premium
  5. 07Where it breaks

    LSTM-era results, memory and communication cost, too much sparsity, and fragile routing

    Premium
  6. 08Using it on a deployment

    Sizing hardware for an MoE model, keeping experts busy, and watching for hot experts

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →