TL;DR
Mixture of Experts (MoE) transformers are surprisingly robust to distribution shifts during continual pre-training, matching the performance of full re-training at only a fraction of the computational cost. By using standard techniques like replay and infinite learning rate schedules, MoEs maintain their sample efficiency advantage over dense models without suffering from catastrophic routing instability or permanent load imbalance.
What Problem Does This Paper Address?
As foundation models become larger and more expensive to train, practitioners increasingly rely on Continual Pre-training (CPT)—updating an existing model with new data (e.g., new languages or code) rather than starting from scratch. While CPT is well-understood for standard "dense" transformers, it poses unique risks for Mixture of Experts (MoE) architectures.
MoEs rely on a "router" to send tokens to specific sub-networks (experts). The core concern is whether a sudden shift in data distribution (like moving from English text to Python code) will break this routing mechanism. Specifically:
- Will the router exacerbate "catastrophic forgetting" of the original data?
- Will the distribution shift cause a "load imbalance," where one expert gets overwhelmed while others sit idle, leading to massive hardware inefficiencies?
- Are the CPT strategies used for dense models (like data replay) sufficient for MoEs?
Methods
The authors conducted a large-scale systematic study comparing a 500M parameter dense transformer against four different 2B-parameter MoE configurations (all having 500M active parameters to ensure a fair, FLOP-matched comparison).
Key variables included:
- Architectures: They tested "Switch MoEs" (1 active expert) and "Granular MoEs" (inspired by DeepSeek, using 3 active experts + 1 shared expert).
- Routing Algorithms: They compared Penalty-Balanced (PBTk) routing (using auxiliary and z-losses to encourage balance) against Sinkhorn-Balanced (SBTk) routing (which treats routing as an optimal transport problem).
- CPT Strategies: They employed replay (mixing 30-40% old data into the new stream) and infinite learning rate schedules to manage the transition between datasets.
- MRI Metric: They introduced Maximum Routing Imbalance (MRI) as a proxy for worst-case latency, measuring the highest proportion of tokens sent to a single expert in any given layer.
Datasets
The models were trained in two phases for a total of 600B tokens:
- Initial Pre-training (Task 1): 400B tokens of FineWeb (high-quality English web data).
- Continual Pre-training (Task 2): 200B tokens of either The Stack (code data) or German Common Crawl data.
Evaluation was performed on standard English benchmarks (HellaSwag, ARC, etc.), German-translated benchmarks, and HumanEval for code generation.
Key Insights and Ideas
- The "Robust Router" Surprise: Contrary to fears that MoE routers might be fragile, they are remarkably resilient. While PBTk routers experience a brief spike in imbalance immediately after a distribution shift, they recover to a stable, balanced state within just 500 training steps.
- Early Layers are the "Forgetters": By analyzing routing saturation and vocabulary specialization, the authors found that routing decisions change most drastically in the first few layers of the network. This suggests that the early stages of the transformer are where the model does the most "re-learning" to adapt to new distributions.
- Sample Efficiency is Preserved: MoEs are known to be more sample-efficient than dense models during initial training. This paper proves that this advantage holds true during CPT as well; MoEs reach lower validation losses much faster than their dense counterparts when exposed to new data.
Key Results
- CPT vs. Full Re-training: As shown in Figure 1, CPT MoEs successfully matched the performance of a "Full Re-training" baseline (training on the union of both datasets from scratch) despite using only about 1/3 of the compute.
- Forgetting Mitigation: MoEs actually exhibited less forgetting than dense models on the original FineWeb validation set, likely due to their higher total parameter count providing more "capacity" to store old knowledge.
- Routing Stability: Figure 3 illustrates that while distribution shifts cause a temporary imbalance, the system quickly self-corrects. Replay further mitigates these spikes, though even no-replay models recovered quickly.
- Granular MoEs Win: The DeepSeek-style granular architecture consistently outperformed the Switch MoE architecture in both final performance and routing stability.
Limitations and Future Work
- Scale: While 2B parameters is significant, it is still small compared to frontier models like GPT-4 or Mixtral. The authors note that these dynamics should be verified at the 10B+ scale.
- Distribution Diversity: The study only looked at two shifts (English to German/Code). More extreme shifts (e.g., text to specialized mathematical notation or non-linguistic data) might behave differently.
- Layer-Specific Tuning: Since early layers undergo the most change, the authors suggest future work could explore "freezing" later layers or applying different learning rates to early layers to further optimize CPT.
Summary updated