Taming Sparsely Activated Transformer with Stochastic Experts

Simiao Zuo, Xiaodong Liu, Jian Jiao, Young Jin Kim, Hany Hassan, Ruofei Zhang, Jianfeng Gao, Tuo Zhao

TL;DR

Researchers have found that the complex "gating" mechanisms used to route data in massive Mixture-of-Experts (MoE) models often perform no better than random luck. This paper introduces THOR (Transformer witH StOchastic ExpeRts), which replaces complex routing with random expert selection paired with a consistency regularization loss. The result is a model that is significantly more parameter-efficient, achieving the same performance as state-of-the-art models while being 18 times smaller.

What Problem Does This Paper Address?

In the race to build larger AI models, "Sparsely Activated Models" (SAMs) like the Switch Transformer have become popular. These models contain trillions of parameters but only use a small fraction (a few "experts") for any given input, keeping computational costs manageable.

However, SAMs face a major hurdle: parameter inefficiency. Despite having 35x more parameters than a standard dense model, they often yield only marginal performance gains. The community has focused on perfecting "routing"—the logic that decides which expert handles which input. This paper argues that current routing methods are flawed, often suffering from "load imbalance" (where one expert does all the work) or simply behaving like random assignment anyway.

Standard gating mechanisms often suffer from load imbalance, where one expert dominates the routing.

Furthermore, empirical analysis reveals that sophisticated routing strategies do not significantly outperform random routing. When comparing standard routing methods against simply assigning inputs to experts randomly, the performance differences in loss and BLEU scores are negligible.

Comparison of different routing strategies shows that random routing (Switch(r)) performs competitively with learned routing mechanisms.

Methods

The authors propose THOR, a simplified approach that leans into randomness rather than trying to engineer it away.

  1. Stochastic Activation: Instead of a gating network, THOR randomly selects a pair of experts for each layer during each training iteration. All inputs in a batch are processed by this same randomly chosen pair.
  2. Consistency Regularization (CR): Because experts are chosen randomly, the model needs a way to ensure that different experts don't produce wildly different answers for the same input. During training, the model performs two forward passes using two different sets of experts. It then minimizes a "consistency loss" (using symmetric KL divergence) that forces the two sets of experts to produce similar probability distributions.
  3. Simplified Architecture: By removing the gating mechanism, THOR eliminates the need for complex load-balancing heuristics and introduces zero additional parameters compared to a standard Transformer of the same size.

Datasets

The authors evaluated THOR primarily on Machine Translation (MT) tasks across three settings:

  • Low-resource: IWSLT (En-Vi, En-De, En-Fr) and Europarl (En-Ro, En-Lv, En-Cs).
  • Rich-resource: WMT’16 English-German (4.5M pairs) and WMT’14 English-French (36M pairs).
  • Multilingual: A collection of 10 language pairs from WMT datasets, totaling 20 translation tasks.

Key Insights and Ideas

  • Gating is Overrated: The authors' analysis reveals that standard gating mechanisms often collapse into a state where they prefer one expert almost exclusively, or they fluctuate so much that they are effectively random.
  • Randomness as a Regularizer: THOR treats expert selection similarly to Dropout. By forcing different subsets of the model to handle the same data and stay consistent with each other, the model learns more robust representations and avoids overfitting.
  • Efficiency through Simplicity: Because THOR doesn't need to calculate routing scores or manage expert "capacity," it is easier to implement and scale across GPU clusters than traditional MoE models.

Key Results

  • Massive Parameter Savings: In multilingual translation, a THOR model with 300 million parameters matched the BLEU score of the state-of-the-art Z-code MoE model, which has 5.5 billion parameters (an 18x reduction in size).
  • State-of-the-Art Performance: THOR achieved new SOTA results on the widely-used WMT’16 En-De and WMT’14 En-Fr benchmarks, outperforming both vanilla Transformers and standard MoE models.
  • Superior to Other Regularizers: THOR outperformed other popular regularization techniques like SMART and R3F, proving that the "stochastic expert" approach provides unique benefits for sparse models.
  • Robustness: Unlike standard Transformers, which can see performance drop as they get wider (overfitting), THOR showed consistent improvements in BLEU scores as the number of experts increased from 2 to 64.

Limitations and Future Work

  • Inference Variance: Because experts are selected randomly at inference time, the model can produce slightly different results across different runs (a variance of about 0.5 BLEU). While "ensembling" (averaging multiple experts) fixes this, it increases the computational cost at test time.
  • Domain Specificity: This paper focuses heavily on Natural Language Processing (specifically translation). The authors note that in other fields like Computer Vision, gating mechanisms might still be more effective due to the clearer categorical nature of image data.
  • Future Directions: The authors suggest exploring more sophisticated ways to select experts during inference to reduce variance without the full cost of ensembling.

Summary updated

BibTeX
@inproceedings{zuo2022taming,
  author = {Simiao Zuo and Xiaodong Liu and Jian Jiao and Young Jin Kim and Hany Hassan and Ruofei Zhang and Jianfeng Gao and Tuo Zhao},
  title = {{Taming Sparsely Activated Transformer with Stochastic Experts}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=5OPl2rup0Va},
}
Figure