XYZNOT

Papers · arXiv 1701.06538

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

Published cs.LGcs.CLcs.NEstat.ML arXivPDF

Read with translation and AI

Summary in three lines

  1. 🎯 Dense neural networks suffer quadratic cost blow-ups when expanding model capacity to absorb massive datasets.
  2. 🔧 Introduces a Sparsely-Gated Mixture-of-Experts (MoE) layer using Noisy Top-K gating and auxiliary load-balancing losses across distributed GPU shards.
  3. 📈 Scales language and translation models up to 137 billion parameters, beating best published LM perplexity by 24% to 39% at lower computational cost.

Abstract

The capacity of a neural network to absorb information is limited by its number of parameters. Conditional computation, where parts of the network are active on a per-example basis, has been proposed in theory as a way of dramatically increasing model capacity without a proportional increase in computation. In practice, however, there are significant algorithmic and performance challenges. In this work, we address these challenges and finally realize the promise of conditional computation, achieving greater than 1000x improvements in model capacity with only minor losses in computational efficiency on modern GPU clusters. We introduce a Sparsely-Gated Mixture-of-Experts layer (MoE), consisting of up to thousands of feed-forward sub-networks. A trainable gating network determines a sparse combination of these experts to use for each example. We apply the MoE to the tasks of language modeling and machine translation, where model capacity is critical for absorbing the vast quantities of knowledge available in the training corpora. We present model architectures in which a MoE with up to 137 billion parameters is applied convolutionally between stacked LSTM layers. On large language modeling and machine translation benchmarks, these models achieve significantly better results than state-of-the-art at lower computational cost.

Reading guide

Problem and motivation

Deep learning models heavily benefit from parameter capacity when trained on large datasets. However, standard architectures activate the full network for every input token or example. This leads to an impractical increase in computational cost as both network size and dataset volume scale.

While conditional computation (activating only subsets of a model per example) was proposed theoretically, earlier implementations struggled on modern accelerators due to:

  • GPUs favoring uniform arithmetic over branching.
  • The "shrinking batch problem," where routing subsets of examples leaves individual sub-networks with tiny, inefficient batch sizes.
  • Inter-device network bandwidth bottlenecks.
  • Imbalanced routing, where a few sub-networks dominate while others starve.

Key ideas

  • Sparsely-Gated MoE Layer: Feed-forward sub-networks ("experts") are placed between recurrent layers (such as stacked LSTMs). Only a sparse top- selection of experts is evaluated per position.
  • Noisy Top-K Gating: Tunable Gaussian noise is added to gating logits before the top- selection and softmax to provide continuous, backpropagatable gradients and encourage balanced exploration across experts.
  • Combined Data and Model Parallelism: Standard layers and gating run data-parallel across devices, whereas experts are partitioned model-parallel across GPUs. Batches across all devices are combined so experts receive sufficiently large aggregated mini-batches.
  • Balancing Constraints: Explicit auxiliary losses on expert importance and expert load prevent the gating network from collapsing to degenerate solutions that overutilize a handful of experts.

Method (with the key equations)

An MoE layer consists of feed-forward expert networks and a gating network . The layer output is: Computation is avoided whenever .

Noisy Top-K Gating

To combine sparsity with differentiable gating, noise is injected into linear projections:

Load-Balancing Losses

To enforce equal total gating weights, an importance loss is defined over a batch using the coefficient of variation (): To ensure equal numbers of examples per expert, the smooth load estimator uses the normal CDF :

Results (with the most important numbers)

  • 1 Billion Word Benchmark: A computationally matched MoE-4096-h model achieved a test perplexity of 34.1 (a 24% reduction compared to computationally matched baseline LSTMs). A high-budget MoE model reached 28.0 test perplexity in 47 hours on 32 K40 GPUs, outperforming the prior state-of-the-art result of 34.7 (which took 59 hours on 32 K40 GPUs).
  • 100 Billion Word Corpus: Scaling up to 65,536 experts (68 billion parameters) dropped test perplexity by 39% compared to the dense baseline (28.9 vs. 47.0), maintaining 0.72 TFLOPS/GPU.
  • Machine Translation: MoE-augmented GNMT achieved 40.56 BLEU on WMT'14 EnFr (+1.34 BLEU over GNMT without RL) and 26.03 BLEU on WMT'14 EnDe (+1.12 BLEU) while requiring less than half the ops per timestep.
  • Multilingual Translation: A single multilingual MoE model outperformed a multilingual GNMT baseline on 11 of 12 language pairs (up to +5.84 BLEU on KoreanEnglish) and reduced dev perplexity by 19%.

Limitations and open questions

  • Extreme sparsity can lead to diminishing returns or performance regressions; perplexity degraded when scaling from 65,536 to 131,072 experts on the 100B-word dataset.
  • Distributed communication overhead remains dependent on the hidden-to-input/output ratio, making small expert capacities less bandwidth-efficient.
  • Applying MoE recurrently inside RNN recurrence steps breaks the batch-unrolling optimization across sequence positions, requiring activation recomputation schemes.

Key terms

Sparsely-Gated Mixture-of-Experts Layer (MoE)
A neural network layer containing multiple parallel expert sub-networks where a trainable gating network selects only a sparse subset of experts for each input example.
Conditional Computation
An architectural paradigm where parts of the neural network are dynamically activated or inactivated on a per-example basis to increase parameter capacity without a proportional compute increase.
Noisy Top-K Gating
A gating mechanism that adds tunable Gaussian noise to logits before keeping only the top k values and applying a softmax, enabling backpropagation and preventing routing collapse.
Shrinking Batch Problem
The reduction in effective batch size received by individual sub-networks when inputs are sparsely partitioned across many experts, reducing hardware arithmetic efficiency.
Importance Loss
An auxiliary loss penalizing the squared coefficient of variation of the sum of gate values per expert across a batch to encourage equal expert allocation.
Load Loss
An auxiliary objective minimizing variance in the estimated probability-weighted assignment count of tokens across experts to balance hardware load.
Hierarchical Mixture of Experts
A two-level MoE structure where a primary gating network routes inputs to secondary MoE clusters to reduce branching factor and distributed communication overhead.

Questions

How does the gating network allow backpropagation through discrete top-k routing?

Because top-k selection is applied before the softmax, the non-zero gate values for the chosen experts retain continuous derivatives with respect to the input weights, allowing gradients to flow back through the gating network.

How is the shrinking batch problem resolved across distributed devices?

The model mixes data and model parallelism: standard layers process independent mini-batches across devices, but tokens from all devices are aggregated together before routing to stationary experts hosted across different GPUs.

Why is noise necessary in the gating network?

The injected Gaussian noise promotes exploration across experts early in training and provides a smooth estimator for the load-balancing loss, preventing self-reinforcing expert collapse.

What happens when the model is scaled up to 131,072 experts?

Perplexity slightly degraded from 28.9 (at 65,536 experts) to 29.2 (at 131,072 experts), and computational efficiency dropped to 0.30 TFLOPS/GPU, likely due to extreme sparsity and fixed non-scaled batch sizes.

The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.

Read with translation and AI