arXiv:2609.40089cs.LGSep 2026

Manuscript Offprint

arXiv:2609.40089

Replay on Demand: An Emergent Curriculum for Balancing Adaptation and Forgetting in Continued Pretraining

Lukas Thede, Shengzhuang Chen, Stefan Winzeck, Matthias Bethge, Zeynep Akata, Jonathan Richard Schwarz

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Continued pretraining enables language models to adapt to new domains and knowledge, but often at the cost of forgetting previously acquired capabilities. Replay can mitigate this trade-off, but fixed replay mixtures allocate training independently of the model's actual retention needs. This is particularly limiting because forgetting varies across capabilities and data sources and evolves throughout training. We introduce Replay on Demand (RoD), which instead derives the replay allocation from the model's learning dynamics. RoD jointly prioritizes adaptation samples by their remaining learning potential and replay samples by their observed forgetting. Their competition for a shared training budget yields an online curriculum that determines what to train on at each step. Across models, scales, and adaptation domains, RoD reaches or improves upon the adaptation–forgetting frontier of tuned fixed-replay baselines and model merging without prescribing a replay allocation in advance. Replay concentrates on sources that are more vulnerable to forgetting and dynamically increases and redistributes as forgetting emerges during training. Together, our results show that replay can be allocated online from the model's evolving state, targeting what is needed, when it is needed.

1 Introduction

Continued pretraining (CPT) has become a practical route for adapting general-purpose language models to specialized domains, languages, and applications (Gururangan et al., 2020; Parmar et al., 2024). However, this specialization comes at a cost: learning a new distribution can degrade capabilities acquired during pretraining. CPT therefore faces an inherent trade-off between adaptation and retention: a successful method should adapt to the new distribution while minimizing forgetting of the original pretraining distribution.

A common strategy for controlling this trade-off is replay, which mixes samples from the original pretraining distribution into the adaptation data (Abbes et al., 2026; Roth et al., 2024). Yet replay turns this trade-off into a resource-allocation problem. Under a fixed training budget, replay displaces adaptation data, while maintaining both requires additional compute. Replay should therefore be allocated where it provides the greatest retention benefit. This is challenging because forgetting

Preprint.

Figure

Figure 1: RoD dynamically balances adaptation and replay through joint data selection. Adaptation candidates are scored by their remaining learning potential and replay candidates by their forgetting. Joint top-k selection lets both compete for a shared training budget, dynamically determining the replay share and composition. As adaptation learning potential decreases and forgetting emerges, replay becomes increasingly competitive and receives a larger share of the training budget.

is heterogeneous. Different capabilities and parts of the pretraining distribution degrade to different degrees during adaptation (Thede et al., 2026; Çağatay Yıldız et al., 2025). Fixed replay mixtures ignore this heterogeneity, potentially spending compute on well-retained knowledge while leaving more vulnerable knowledge insufficiently protected. Moreover, retention needs evolve throughout training. An effective replay curriculum should therefore allocate replay where forgetting occurs and adapt this allocation as retention needs change.

We propose Replay on Demand (RoD), which allocates training compute based on the model's current learning and forgetting states. RoD builds on reducible-loss data selection (Mindermann et al., 2022) and lets adaptation and replay examples compete for a shared training budget. Adaptation examples are prioritized by how much remains to be learned, while replay examples are prioritized by how much has been forgotten relative to the pretrained model. This competition gives rise to an online data curriculum. When pretrained knowledge is well retained, adaptation dominates training. As forgetting emerges, affected replay examples become more competitive and enter the training batch. RoD thereby concentrates replay on the parts of the pretraining distribution that degrade, dynamically adjusting its amount and composition throughout training. The resulting curriculum adapts to the model and adaptation corpus without requiring a predefined replay share or allocation.

We evaluate RoD across legal and German continued pretraining using the Nemotron and Qwen model families at scales ranging from 4B to 35B parameters. Across these settings, RoD reaches or improves upon the adaptation–forgetting frontier of tuned fixed-replay CPT and model merging, without prescribing a replay allocation in advance. Our analysis shows that these gains reflect the intended demand-driven allocation: RoD directs replay toward sources that exhibit greater forgetting, avoids unnecessary replay of well-retained ones, and dynamically increases and redistributes replay as retention needs emerge during training. Together, these results show that adapting replay to the model's evolving retention needs provides a principled way to balance adaptation and retention by replaying what is needed, when it is needed.

References (82)