TL;DR
LEGO (Expert Expansion for Continual Learning) is a framework that allows Mixture-of-Experts (MoE) models to learn new domains without forgetting their original skills. By adding new experts and using a "routing pressure" loss to steer new data toward them, LEGO successfully isolates new knowledge, preventing the catastrophic forgetting that usually occurs during model adaptation.
What Problem Does This Paper Address?
Large Language Models (LLMs) are rarely "finished" after their initial pretraining. Researchers often want to perform "mid-training"—adapting a model to specialized domains like medicine, law, or mathematics. However, doing this with Mixture-of-Experts (MoE) models is notoriously difficult.
In an MoE model, a "router" acts like a traffic cop, sending each token to a specific subset of "experts" (small sub-networks). During continual learning, new gradients often overwrite the router’s logic or repurpose existing experts. This leads to catastrophic forgetting, where the model gains a new skill (like solving math problems) but loses its ability to follow instructions or maintain the general knowledge it learned during pretraining. The authors argue that the challenge isn't just how to update the model, but where the new knowledge should be stored.
Methods
The authors propose LEGO, which stands for a three-pronged approach to capacity isolation:
- Expert Expansion: Instead of forcing new knowledge into a fixed set of experts, LEGO identifies the most frequently activated experts and duplicates them. This gives the new domain a "warm start" with functional parameters rather than random noise.
- Target-side Routing Pressure: To ensure the model actually uses these new experts, the authors introduce a margin-based adaptation loss ($L_{adapt}$). This loss essentially "pushes" tokens from the new domain toward the expanded capacity, leaving the original experts undisturbed for general tasks.
- Anchor-side Stabilization: To keep the rest of the model stable, LEGO uses "anchor data" (general-domain data from pretraining). It employs feature matching (ensuring internal representations don't drift too far from the original model) and router distillation (ensuring the traffic cop still sends general tokens to the original experts).
This combination allows the model to co-adapt its shared "dense trunk" while keeping its specialized "expert branches" distinct.
Datasets
The researchers used the TxT360-Midas dataset for training:
- Target Corpus ($T_r$): The
math_osssplit, containing 26.27B tokens of mathematical data. - Anchor Corpus ($A_{<r}$): The
stage2/generalsplit, containing 12.06B tokens of general-domain data.
For evaluation, they focused on the GSM8K (Grade School Math) benchmark, using two metrics: GSM8K-Flex (permissive answer extraction) and GSM8K-Strict (exact match following specific formatting).
Key Insights and Ideas
- The "Strict" Collapse: One of the most interesting findings is that vanilla continual learning can make a model look like it's improving if you only look at "Flex" scores. However, the "Strict" scores often collapse (from ~44% to ~15%). This suggests the model is gaining raw knowledge but losing the "behavioral" ability to format answers correctly—a clear sign of forgetting.
- Expansion is the MVP: In ablation studies, removing expert expansion was the most damaging. Without new "room" to store information, the model inevitably overwrites its previous logic.
- The Shared Trunk Matters: Even though the experts are isolated, the authors found that updating the "dense trunk" (the shared parts of the Transformer) is still necessary. Freezing the trunk too aggressively prevents the model from fully integrating new concepts.
- Localization is Key: The "aha moment" here is that for MoE models, continual learning should be treated as a spatial problem—allocating specific physical parameters to specific domains.
Key Results
The authors compared LEGO against several baselines using the OLMoE-1B-7B model:
- Vanilla Continual Learning: While math knowledge improved (Flex: 63.61), the model's ability to provide structured answers plummeted (Strict: 15.54).
- Data Mixing (Replay): Mixing old and new data helped, but the model still performed worse than the original on strict metrics (Strict: 40.03).
- LEGO: Achieved the best of both worlds. It reached a 63.23 Flex score (comparable to vanilla) while actually improving the Strict score to 52.01 (up from the base model's 44.05).
Essentially, LEGO was the only method that allowed the model to get smarter at math without breaking its existing capabilities.
Limitations and Future Work
- Single Domain Shift: The primary experiments focused on a single shift (General $\rightarrow$ Math). While the framework is designed for sequential rounds, the long-term stability over 5 or 10 different domains remains to be seen.
- Compute Overhead: Adding experts increases the total parameter count (though not the per-token compute). In a production environment, managing a model that grows with every new domain could eventually lead to memory constraints.
- Future Directions: The authors suggest extending LEGO to Reinforcement Learning from Human Feedback (RLHF). They propose that new experts could be added specifically to absorb "safety" or "style" behaviors, which are often at odds with raw knowledge acquisition.
Summary updated