Sparse Upcycling: Training Mixture-of-Experts from Dense Checkpoints

Aran Komatsuzaki, Joan Puigcerver, James Lee-Thorp, Carlos Riquelme Ruiz, Basil Mustafa, Joshua Ainslie, Yi Tay, Mostafa Dehghani, Neil Houlsby

Introduction

The computational cost of training state-of-the-art neural networks from scratch has reached astronomical levels, often requiring thousands of accelerator-days. This "scaling arms race" has led many researchers to rely on a small set of publicly available dense checkpoints. While sparsely activated models like Mixture-of-Experts (MoE) offer a path toward increased capacity without proportional increases in FLOPs, they are traditionally difficult and data-intensive to train from scratch. This paper introduces Sparse Upcycling, a technique to convert existing dense checkpoints into high-capacity MoE models, leveraging the "sunk cost" of initial pre-training.

Methodology: Model Surgery

Sparse Upcycling transforms a pre-trained dense Transformer into an MoE through a specific "model surgery" recipe.

The Sparse Upcycling process: converting a dense block into an MoE block by copying MLP weights and adding a router.

The process involves:

  1. Expert Initialization: Replacing a subset of the dense model's Multi-Layer Perceptron (MLP) layers with MoE layers. Each of the $E$ experts in the new layer is initialized as an exact copy of the original dense MLP.
  2. Router Addition: A small, randomly initialized "router" network is added to each MoE layer.
  3. Expert Choice Routing: Unlike traditional Top-K routing, the authors use Expert Choice routing, where experts select the top $T$ tokens. This naturally prevents "expert collapse" and ensures a balanced computational load.
  4. Continued Training: The upcycled model undergoes further training using the same hyperparameters as the original dense model.

Experimental Results

The effectiveness of Sparse Upcycling was evaluated across vision (Vision Transformer on JFT-300M) and language (T5 on C4) domains.

Validation performance for vision (JFT) and language (C4) tasks, comparing dense training to upcycling across different model scales.

Performance and Efficiency

Upcycled models consistently outperform their dense counterparts for the same additional training budget. In language tasks, upcycled T5-Base and T5-Large models achieved a 1.5 to 2.0 point improvement on SuperGLUE with only 50% of the original pre-training budget. In vision, achieving a 1% gain on ImageNet required 58% more time for dense training but only 13% for upcycling.

Comparison to Training from Scratch

A key finding is that upcycling is more efficient than training MoE models from scratch. For language tasks, a scratch-trained MoE required approximately 120% of the original dense model's budget just to match the performance of the upcycled version. The benefits of upcycling held true across all tested scales, from Base models to XL models with billions of parameters.

Key Insights and Limitations

The study highlights that initializing experts with pre-trained weights is far superior to random initialization; while experts start identical, they quickly diverge and specialize during continued training. Optimal results were found by replacing roughly half of the MLP layers. Additionally, weight normalization of the router outputs helped vision models recover from the initial "structural shock," though it was less effective for language models.

However, the technique faces challenges:

  • Structural Shock: There is an initial performance dip immediately after surgery as routers learn to distribute tokens.
  • Inference Overhead: While FLOP-efficient, MoEs have larger memory footprints and increased deployment complexity compared to dense models.
  • Hyperparameter Sensitivity: While reusing dense hyperparameters worked well, further optimization specifically for the upcycling phase could yield additional gains.

Conclusion

Sparse Upcycling provides a practical and efficient pathway for the community to transition from dense models to sparse architectures, significantly reducing the environmental and financial costs of training high-capacity models.

Summary updated

BibTeX
@inproceedings{komatsuzaki2023sparse,
  author = {Aran Komatsuzaki and Joan Puigcerver and James Lee-Thorp and Carlos Riquelme Ruiz and Basil Mustafa and Joshua Ainslie and Yi Tay and Mostafa Dehghani and Neil Houlsby},
  title = {{Sparse Upcycling: Training Mixture-of-Experts from Dense Checkpoints}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=T5nUQDrM4u},
}
Figure