Continual Pre-training of MoEs: How robust is your router?

Benjamin Thérien, Charles-Étienne Joseph, Zain Sarwar, Ashwinee Panda, Anirban Das, Shi-Xiong Zhang, Stephen Rawls, Sambit Sahu, Eugene Belilovsky, Irina Rish

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:

  1. Will the router exacerbate "catastrophic forgetting" of the original data?
  2. Will the distribution shift cause a "load imbalance," where one expert gets overwhelmed while others sit idle, leading to massive hardware inefficiencies?
  3. 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:

  1. Initial Pre-training (Task 1): 400B tokens of FineWeb (high-quality English web data).
  2. 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.
CPT MoEs match full re-training performance across various metrics while using significantly less 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.
MRI spikes briefly during distribution shift but recovers to balanced levels quickly, especially for PBTk models.
  • 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

Abstract

Sparsely-activated Mixture of Experts (MoE) transformers are promising architectures for foundation models. Compared to dense transformers that require the same amount of floating-point operations (FLOPs) per forward pass, MoEs benefit from improved sample efficiency at training time and achieve much stronger performance. Many closed-source and open-source frontier language models have thus adopted an MoE architecture. Naturally, practitioners will want to extend the capabilities of these models with large amounts of newly collected data without completely re-training them. Prior work has shown that a simple combination of replay, learning rate re-warming, and re-decaying can enable the continual pre-training (CPT) of dense decoder-only transformers with minimal performance degradation compared to full re-training. In the case of decoder-only MoE transformers, however, it is unclear how the routing algorithm will impact continual pre-training performance: 1) do the MoE transformer's routers exacerbate forgetting relative to a dense model?; 2) do the routers maintain a balanced load on previous distributions after CPT?; 3) are the same strategies applied to dense models sufficient to continually pre-train MoE LLMs? In what follows, we conduct a large-scale study training a 500M parameter dense transformer and four 500M-active/2B-total parameter MoE transformers. Each model is trained for 600B tokens. Our results establish a surprising robustness to distribution shifts for MoEs using both Sinkhorn-Balanced and Z-and-Aux-loss-balanced routing algorithms, even in MoEs continually pre-trained without replay. Moreover, we show that MoE LLMs maintain their sample efficiency (relative to a FLOP-matched dense model) during CPT and that they can match the performance of a fully re-trained MoE at a fraction of the cost.
BibTeX
@inproceedings{therien2025continual,
  author = {Benjamin Thérien and Charles-Étienne Joseph and Zain Sarwar and Ashwinee Panda and Anirban Das and Shi-Xiong Zhang and Stephen Rawls and Sambit Sahu and Eugene Belilovsky and Irina Rish},
  title = {{Continual Pre-training of MoEs: How robust is your router?}},
  booktitle = {CCFM @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=TKJAZh4SXA},
}
Figure