Forgetting in Language Models: Capacity, Optimization, and Self-Generated Replay

Martin Marek, Dongkyu Cho, Shikai Qiu, Rumi Chunara, Pavel Izmailov, Andrew Gordon WilsonarXiv 2026

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.

  1. 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.
  2. 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}}$$
  3. Objective Comparison: They compare two types of replay objectives:
  4. Next-Token Prediction (NTP): Standard cross-entropy on the replay data.
  5. 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.

Figure 2: Regularizing on past (replay) data prevents forgetting. An MLP is first pretrained on data on the left and then finetuned on data on the right. Without any regularization, training on new data changes the model’s predictions on the old data, substantially degrading performance. Adding a KL divergence penalty on the prior data keeps the old predictions fixed while allowing the model to fit the new data. The shaded area represents a 50% interquartile range across sampled models.

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.
Figure 1: Forgetting can be mitigated by regularizing on self-generated samples, but model capacity still lower-bounds forgetting. Left: We pretrain a small transformer language model on a mix of English and Spanish text until convergence. The color of each line indicates the fraction of Spanish data. Because the model is small and trained to convergence, it does not have the capacity to achieve low loss on both languages simultaneously. Right: We finetune two pretrained models (marked by crosses) on Spanish. The upper model is pretrained using 20 tokens per parameter (Chinchilla scaling), the lower on 17,000 (overtrained). To prevent forgetting during finetuning, we penalize the model’s KL divergence on self-generated text. Because the Chinchilla-scaled model has plenty of spare capacity, it can improve its Spanish performance without degrading on English. In contrast, the overtrained model is near capacity, so it has to directly trade off learning and forgetting, which we control using the regularization coefficient.
  • 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.
Self-generated replay completely eliminates forgetting under shifting tasks.
  • 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

BibTeX
@misc{marek2026forgetting,
  author = {Martin Marek and Dongkyu Cho and Shikai Qiu and Rumi Chunara and Pavel Izmailov and Andrew Gordon Wilson},
  title = {{Forgetting in Language Models: Capacity, Optimization, and Self-Generated Replay}},
  year = {2026},
  eprint = {2605.26097},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.26097},
}
Figure