Manuscript Offprint

arXiv:2611.03496

Online Label-Free Gradient Matching for Continual Language Model Training

Sajjad Pakdamansavoji, Mohammad Reza Rezaei, Ilija Subasic, Pedro Garzon, Radu Paradovschi, Zhao Chen

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

ABSTRACT

Language models in customer-facing products must be continually updated, since the data they serve shifts over time. As retraining on the full accumulated data is impractical, each update should instead run on a small set of examples carrying the training signal of all data seen so far. The strongest current methods build this set by gradient matching, which synthesizes examples whose training gradients match those of the full data. However, they require ground-truth labels, run once on a fixed snapshot rather than on a growing stream, and are slow on large data. We introduce OLGA, which lifts these limitations. It distills unlabeled data by drawing the gradient matching targets from the model's own next-token predictions. Across five text classification benchmarks with phi-1.5, it improves accuracy by 10 percentage points over the strongest selection baseline using as few as five examples. OLGA also distills online data streams by keeping a running rehearsal memory of synthetic examples, which is re-distilled together with each new batch as it arrives. In the online setting, it outperforms the strongest selection-based continual baseline by 6.6 stream-AUC percentage points. Finally, our method scales to large data by pairing distillation with selection in a hybrid pipeline, letting selection handle the mild stage of compression and distillation the extreme one. It cuts runtime by 30% versus distillation alone at similar accuracy, and beats the best selection-only pipeline by up to 12.6 percentage points.

1 INTRODUCTION

Language models are increasingly deployed in customer-facing products, where the traffic they serve keeps changing. User preferences move, new topics appear, and safety requirements shift, so a model that was accurate at release gradually falls out of step with the data it now sees (Lazaridou et al., 2021). Keeping it current means updating it repeatedly rather than once, and the data available at each update grows with every cycle. Retraining on every example accumulated so far is the obvious remedy and also the least affordable one, because a full pass costs more as the data grows while the oldest examples contribute least. What a practical update loop needs instead is a small set of examples, rebuilt at each cycle, that still carries the training signal of everything seen so far.

Most existing methods build that set by selecting a well-chosen subset of the real examples. This works well when the budget is generous, but once only a few examples can be kept, it becomes hard to preserve a strong training signal. Dataset distillation with gradient matching addresses this by synthesizing examples whose training gradient matches the gradient of the real data (Zhao et al., 2021). Because a synthetic example does not have to be a real sentence, it can capture what many real examples teach the model, so the set can be kept to a few examples.

Three obstacles stand in the way of using gradient matching to keep a language model current. First, it needs ground-truth labels, which rules out the unlabeled data that makes up most of what a deployed system collects. For images, recent work replaces the labels with targets from a frozen model trained without them (Lee et al., 2024; Joshi et al., 2025), but text distillation methods still rely on labels (Ogawa et al., 2025). Second, it runs once over a fixed snapshot, so it never has to fold an arriving batch into an existing set. Methods that do this exist for images (Gu et al., 2024), but they need labels and nudge pixel values in small steps, which does not work for the discrete tokens of text. Finally, the cost of matching gradients grows with the amount of data it compresses, making it least affordable exactly when data is plentiful. For images, discarding part of the real data before distilling cuts this cost (Xu et al., 2024; Moser et al., 2025), but these methods rank examples by their loss against a label and have only been studied on a fixed snapshot. As a result, no existing method compresses an unlabeled text stream into a small training set at a cost that stays affordable as the stream grows.

We remove all three obstacles at once. To drop the labels, we keep them out of the objective and take the matching target from the model's own predictions instead. To move from a snapshot to a stream, we keep a running rehearsal memory of synthetic examples and merge each arriving batch into it with the same gradient matching objective. To control the cost, we introduce a hybrid pipeline in which cheap unsupervised selection runs ahead of expensive distillation, since the two are strong at different amounts of compression.

We make the following contributions.

  • We introduce a label-free gradient matching objective whose compact distilled set trains a model 10 points more accurate than the best real subset of the same size.
  • We extend text distillation to streaming data, updating a rehearsal memory as each batch arrives, and beat the best real memory of the same size by 6.6 stream-AUC points.
  • We design a hybrid pipeline in which cheap selection shrinks each batch before distillation, cutting distillation runtime by 30% compared with distilling the full batch.

References (46)