TL;DR
Catastrophic forgetting in language models can be nearly eliminated by regularizing finetuning with the model's own self-generated samples as replay data. However, this strategy hits a hard wall if a model is overtrained to saturation, revealing that forgetting is fundamentally bounded by remaining model capacity and optimization choices.
What Problem Does This Paper Address?
When language models (LMs) are finetuned on a new task, they often lose their edge on previously learned tasks—a classic phenomenon known as catastrophic forgetting.
The standard remedy is experience replay, which involves mixing original pretraining data into the finetuning mix. However, for modern LLMs, the original pretraining data is often massive, proprietary, or completely unavailable.
This paper investigates a elegant alternative: Can language models simply sample from their own internal distributions to generate their own replay data? Furthermore, the authors look past surface-level fixes to explore the fundamental limits of forgetting through two critical lenses: model capacity (how full the model is) and optimization (how learning rates affect parameter drift).
Methods
The authors implement a simple yet highly effective approach called Self-Generated Replay.
- Data Generation: Before finetuning, they freeze a copy of the base model and sample sequences autoregressively. To ensure the model generates data mimicking its pretraining distribution rather than a specific task, they prompt it using only a generic Beginning-of-Sequence (BOS) token or a unique corpus identifier.
- Regularization Loss: They add an auxiliary loss term ($L_{\text{replay}}$) to the standard downstream training objective: $$L_{\text{total}} = L_{\text{downstream}} + \lambda L_{\text{replay}}$$
- Objective Comparison: They compare two types of replay objectives:
- Next-Token Prediction (NTP): Standard cross-entropy on the replay data.
- Kullback-Leibler (KL) Divergence: Penalizing the drift between the finetuned model's token probabilities and the frozen base model's probabilities.
While both objectives share the same expected gradient, the authors show that KL divergence acts as a softer, lower-variance constraint that yields significantly better stability.
Datasets
The paper validates its findings across a variety of setups:
- Toy Continual Learning: Sequential training on four algorithmic tasks: addition, digit reversal, digit sorting, and modulo addition.
- Language Model Pretraining/Finetuning: Pretraining on FineWeb-Edu (general domain) and finetuning on Nemotron-CC-Math. They also use the English and Spanish subsets of the C4 dataset to study language trade-offs.
- Instruction-Tuned Models: Finetuning Llama-3.2-1B-Instruct on PyraNet-Verilog (a hardware description language dataset) to see if self-generated replay works on chat-aligned models.
- Evaluation Benchmarks: General capabilities were tracked using MMLU, CommonsenseQA, and ARC-Challenge.
Key Insights and Ideas
- LMs are Their Own Data Vaults: LMs can effectively approximate their pretraining distribution without needing massive external storage buffers. Prompting an instruction-tuned model with just a
[BOS]token successfully coaxes it into generating pretraining-like text. - The Capacity Bottleneck: Forgetting isn't just an optimization failure; it's a storage problem. Models trained past the compute-optimal point (e.g., overtrained on 17,000 tokens per parameter) saturate their capacity. To learn something new, they must overwrite old knowledge. Conversely, Chinchilla-scaled models have plenty of "spare room" to absorb new tasks without degrading old ones.
- Breaking the Learning Rate Tradeoff: Traditionally, practitioners use low learning rates during finetuning to prevent parameter drift and forgetting, which drastically increases training time. Replay data breaks this bottleneck, allowing high learning rates for fast, compute-efficient finetuning without the penalty of catastrophic forgetting.
Key Results
- Complete Elimination of Forgetting: In toy sequential learning tasks, adding self-generated replay completely preserved performance across all four tasks, whereas standard training caused immediate and total degradation of prior knowledge.
- Preserving General Knowledge in LLMs: When finetuning Llama-3.2-1B-Instruct on Verilog code, standard finetuning caused a sharp drop in general benchmarks (MMLU, ARC, CommonsenseQA). KL regularization on self-generated data maintained baseline benchmark accuracy (~53%) while still successfully mastering Verilog.
- KL vs. NTP: When using substitute data (like OLMo3 data for a Llama model), NTP regularization actually increased forgetting because it forced the model to learn a new distribution's hard tokens. KL regularization, by contrast, successfully mitigated forgetting because it simply kept the model's existing predictions fixed.
Limitations and Future Work
- Single Downstream Tasks: Most experiments focused on transitioning from a base state to a single new task. The dynamics might change in long, multi-task continual learning chains where "loss of plasticity" can occur.
- Scale of Sweeps: Due to the massive compute required to deliberately overtrain models and run exhaustive hyperparameter sweeps, the capacity analysis was restricted to smaller models (up to 46M parameters).
- Capacity Metrics: The authors rely on proxies for model capacity (like model size and tokens per parameter) rather than directly measuring the exact information theoretic bits stored within the weights.
Summary updated