Replaying pre-training data improves fine-tuning

Suhas Kotha, Percy LiangarXiv 2026

TL;DR

While practitioners typically mix generic pre-training data into fine-tuning solely to prevent "catastrophic forgetting," this paper reveals a surprising twist: replaying generic data actually directly improves the model's performance on the new target task itself. By strategically replaying generic web text during domain adaptation, researchers achieved up to a 1.87× boost in target data efficiency for standard fine-tuning and up to a 4.5% accuracy improvement on downstream tasks at scale.

What Problem Does This Paper Address?

The standard recipe for building a domain-specific language model (e.g., for math, coding, or legal text) is straightforward: pre-train a model on massive amounts of generic web text, then fine-tune it on a smaller, specialized dataset.

Sometimes, engineers mix a bit of the original pre-training data into the fine-tuning mix. However, the conventional wisdom says this is done purely as a defensive measure to preserve the model's general capabilities and prevent it from forgetting what it previously learned. The authors of this paper challenge this assumption by asking a fundamental question: Can altering the data schedule—specifically by replaying generic data—actually help the model learn the new target domain better?

Methods

The authors systematically explore data scheduling across two main paradigms: standard fine-tuning and mid-training (joint pre-training/fine-tuning).

  1. Standard Fine-Tuning Baseline: The model is trained on generic data (Stage 1), followed by target data (Stage 2) with separate learning rate schedules and an optimizer state reset between stages.
  2. Generic Replay Intervention: During Stage 2, a specific fraction ($\rho$) of generic data is mixed back into the target data. To keep comparisons compute-matched, the total number of training steps is held constant by slightly shortening Stage 1.
Figure 3: Controlled fine-tuning visualization. We systematically explore the benefit of replaying generic data while fine-tuning on the target data. On the right, we show standard fine-tuning for T steps where γ fraction of the steps are on target data. On the left, we show fine-tuning with replay fraction ρ (where we shorten pre-training to keep the total number of steps fixed). We use (independently tuned) cosine learning rate schedules for each stage, with an optimizer state reset between the stages to simulate standard practice for fine-tuning open-weight models.

For the mid-training paradigm, they eliminate the optimizer reset and utilize a single Warmup-Stable-Decay (WSD) learning rate schedule, which keeps the learning rate high and stable before a sharp linear decay at the very end. They also experiment with introducing a fraction ($\alpha$) of the target data early in training (Stage 1).

Datasets

The authors evaluated their methods across a mix of controlled, smaller-scale environments and real-world, large-scale settings:

  • Controlled Environment (150M parameter Llama-style models):
  • Generic Domain: C4 (cleaned web text).
  • Target Domains: FineMath (mathematics), StarCoder (source code), and Flan (instruction following).
  • Scale-Up Environment (8B parameter Llama 3.1 models):
  • Web Agents Task: Fine-tuned on Weblinx human trajectories, using OpenHermes or UltraChat as the generic replay proxy.
  • Low-Resource Language Learning: Continually pre-trained on Latxa (Basque corpus) and evaluated on a professional Basque translation of the COPA (Choice of Plausible Alternatives) benchmark, using SlimPajama as the generic replay proxy.

Key Insights and Ideas

  • Replay as Implicit Regularization: The primary reason standard fine-tuning underperforms is a statistical barrier: models rapidly overfit to small target datasets. Replaying generic data acts as a powerful regularizer, mitigating overfitting and allowing the model to extract more value from limited target tokens.
  • The Rarity Factor: Replay is most effective when the target domain is scarce or entirely absent during the initial pre-training phase. If a model already saw plenty of target data during pre-training, replaying generic data during fine-tuning provides little to no benefit.
  • Domain Proximity Matters: The optimal amount of replay depends on how much the target domain overlaps with the generic data. For instance, because C4 filters out code, the StarCoder domain is highly dissimilar and tolerates less generic replay before performance degrades, whereas instruction-following data (Flan) can tolerate a much higher replay fraction.
Target validation loss across different replay fractions for Flan, FineMath, and StarCoder.

Key Results

  • Data Efficiency Gains: In the controlled 150M parameter setup, adding generic replay increased target data efficiency by up to 1.87× for fine-tuning and 2.06× for mid-training on the FineMath dataset.
  • Downstream Improvements at Scale (8B Models):
  • On the Weblinx web navigation task, replaying generic instruction-following data boosted agent success rates by 4.5% over the standard fine-tuning baseline.
  • On the low-resource Basque COPA benchmark, replaying generic SlimPajama data improved question-answering accuracy by 2%.

Limitations and Future Work

While the results offer a clear, practical recommendation for practitioners, the authors note a few key limitations:

  • Compute Overhead: Because replaying generic data dilutes the target data, achieving the same number of target token exposures requires running more total fine-tuning steps (scaled by $\frac{1}{1-\rho}$), which increases compute costs during the adaptation phase.
  • Simplified Distributions: The controlled experiments assume a clean split between two distinct data distributions (generic vs. target), whereas real-world pre-training involves highly diverse, multi-task mixtures.
  • Metrics: The core optimization insights rely heavily on validation loss rather than downstream accuracy metrics, which can be noisy and non-linear at smaller model scales.

Future work includes exploring more complex, continuous data annealing schedules and sample-level data orderings to further optimize adaptation performance.

Summary updated

BibTeX
@misc{kotha2026replaying,
  author = {Suhas Kotha and Percy Liang},
  title = {{Replaying pre-training data improves fine-tuning}},
  year = {2026},
  eprint = {2603.04964},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.04964},
}
Figure