TL;DR
This paper introduces "expert choice" routing for Mixture-of-Experts (MoE) models, flipping the traditional approach. Instead of tokens picking experts, experts pick tokens, leading to significantly faster training (over 2x speedup) and improved performance on downstream tasks compared to existing MoE methods.
What Problem Does This Paper Address?
Large neural networks, especially Transformer models, have seen incredible performance gains by scaling up model size, dataset size, and training time. Mixture-of-Experts (MoE) models offer a way to dramatically increase model capacity (number of parameters) without proportionally increasing computational cost per token. This is achieved by having a large number of specialized "expert" sub-networks, but only activating a few for each input token.
However, a key challenge in MoE models is the "routing strategy" – how tokens are assigned to experts. Traditional methods often lead to "load imbalance," where some experts get overloaded with tokens while others are underutilized. This can result in inefficient training and experts that are not optimally specialized. The paper argues that existing methods, which typically have tokens select a fixed number of top experts, suffer from these issues and don't account for the varying importance of tokens.
Methods
The core innovation is the "expert choice" routing mechanism. Unlike conventional MoE where tokens select experts, in this new approach, experts select tokens. Specifically, each expert identifies and selects the top-k tokens that are most relevant to it, up to a fixed expert capacity. This ensures that each expert has a defined workload, inherently balancing the load across all experts.
Key aspects of their method include:
- Heterogeneous Allocation: This approach allows for a variable number of experts to be assigned to each token, unlike the fixed top-k assignment in prior work.
- Perfect Load Balancing: By having experts choose tokens, the method guarantees that experts are utilized more evenly, mitigating the load imbalance problem.
- Learned Importance: The routing is based on learned token-to-expert affinities, allowing for a more fluid allocation of model parameters.
- No Auxiliary Loss: Crucially, their method achieves load balancing without needing additional auxiliary losses, which can sometimes interfere with the primary training objective.
They also explore an "expert choice with additional constraint" method, which uses an entropy-regularized linear programming approach to limit the maximum number of experts a token can be assigned to. This helps analyze the impact of variable expert allocation.
Datasets
The paper uses the GLaM dataset, described as a high-quality dataset of 1.6 trillion tokens representative of a wide range of natural language use cases. This dataset was curated from various sources including text, webpages, books, Wikipedia, conversations, forums, and news.
For evaluation, they focus on fine-tuning performance on 11 selected tasks from the GLUE and SuperGLUE benchmarks.
Key Insights and Ideas
- Flipping the Routing Paradigm is Powerful: The most significant insight is that reversing the token-expert selection process from "tokens choose experts" to "experts choose tokens" fundamentally solves the load imbalance problem in MoE models.
- Load Balancing Without Auxiliary Losses: Achieving good load balancing without relying on complex auxiliary loss functions simplifies training and avoids potential conflicts with the main task.
- Variable Expert Allocation is Beneficial: The study suggests that allowing tokens to be routed to a variable number of experts (rather than a fixed k) is beneficial for performance, as more important tokens can leverage more expertise.
- Pre-training Perplexity Doesn't Always Map to Downstream Performance: The paper notes that while good training perplexity is desirable, it doesn't always guarantee better performance on downstream tasks, highlighting the importance of fine-tuning evaluations.
Key Results
- Training Efficiency: The proposed "expert choice" method achieves over 2x faster training convergence compared to GShard top-2 gating on a 8B/64E model, while maintaining the same computational cost.
- Downstream Performance: For the same computational cost, their method demonstrates higher performance in fine-tuning on 11 GLUE and SuperGLUE tasks.
- Comparison to Dense Models: Their 8B/64E MoE model outperforms a T5 11B dense model in 7 out of 11 tasks.
- Scaling: The method shows strong scaling with an increasing number of experts (from 16 to 128), consistently improving training perplexity.
- Load Balancing Effectiveness: Empirically, they observe that token-choice routing can lead to an "over-capacity ratio" of 20-40% for some experts, which their method avoids.
Limitations and Future Work
- Auto-regressive Text Generation: The current "expert choice" implementation might not directly apply to auto-regressive text generation because it considers both past and future tokens for routing. The authors suggest potential solutions like batching sequences or dispatching tokens into groups.
- Small Batch Sizes/Inference: For very small batch sizes during serving or inference, the method might need adjustments, such as selecting a global top-k or capping expert/token selections.
- Memory Footprint: A general MoE limitation is the large memory footprint due to the total number of parameters, even if computation is sparse. This requires significant hardware resources. Future work could explore power-saving techniques for idle hardware.
Summary updated