TL;DR
Fine-tuning open-weight language models often causes catastrophic forgetting of their pre-existing skills, especially when original training data is unavailable (the "data-oblivious" setting). This paper demonstrates that generating "context-free" synthetic data—prompting the original model with only an empty context (its beginning-of-sequence token) and applying an all-token pre-training loss during fine-tuning—acts as an unbiased estimator of KL-divergence, successfully mitigating forgetting and even outperforming real pre-training data replay.
What Problem Does This Paper Address?
In the modern ecosystem of open-weight models, practitioners frequently adapt foundation models to new domains or tasks via supervised fine-tuning (SFT). However, fine-tuning shifts the model weights away from their initial state, degrading zero-shot performance and core capabilities (e.g., commonsense or general reasoning)—a well-known issue called catastrophic forgetting.
Addressing forgetting is particularly difficult in the data-oblivious setting, where developers have access to model weights but not the proprietary, massive corpora or exact recipes used to train them. Existing workarounds rely on parameter constraints ($\ell_2$ regularization, LoRA) or post-hoc model averaging (e.g., Wise-FT), but these often hinder the model's ability to adapt to new tasks.
Methods
The authors formulate the prevention of forgetting as minimizing the KL-divergence between the original model $p_{\theta^*}$ and the fine-tuned model $p_\theta$:
$$\min_\theta \mathbb{E}_{(x,y)\sim \mathcal{F}} [-\log p_\theta(y|x)] + \lambda \, \text{KL}(p_{\theta^*} \parallel p_\theta)$$
Because $\text{KL}(p_{\theta^*} \parallel p_\theta) = \mathbb{E}_{x \sim p_{\theta^*}} [\log p_{\theta^*}(x)] + \mathbb{E}_{x \sim p_{\theta^*}} [-\log p_\theta(x)]$, and the first term is constant with respect to $\theta$, penalizing the KL divergence simplifies to minimizing an all-token pre-training loss over unconditional samples drawn from the base model $p_{\theta^*}$.
To generate these "unconditional" samples in practice, the authors introduce Context-Free Synthetic (CFS) data generation:
- Context-Free Generation: The base model is prompted with a vacuous input containing only its beginning-of-sequence token (e.g.,
<|endoftext|>for OLMo,<|begin_of_sentence|>for Llama/R1). The model freely generates coherent, open-ended text matching its learned distribution. - Joint Training: The model is updated using a multi-task loss combining conditional next-token prediction on the downstream fine-tuning dataset with an all-token pre-training style loss on the CFS data.
Datasets
- Downstream Fine-Tuning Tasks:
- MetaMathQA (400K samples): Used to fine-tune pre-trained models on mathematical question answering.
- MedReason (32K samples): A medical reasoning dataset grounded in knowledge graphs with chain-of-thought traces inside
<think>...</think>blocks. - Pre-existing Capability Evaluations:
- For Pre-trained Models: Eight commonsense benchmarks (ARC-Easy/Challenge, BoolQ, HellaSwag, OpenBookQA, PIQA, SIQA, Winogrande), MMLU, AGIEval, BigBench Hard (BB Hard), and GSM8K.
- For Reasoning Models: AIME24, MATH500, LiveCodeBench (LCB), and GPQA-Diamond.
- Medical Evaluations: MedQA, MedBulletsOp4 (MBOp4), and MedBulletsOp5 (MBOp5).
- Data Replay Baseline: Subsampled 400K rows from the open-source Dolma pre-training dataset.
Key Insights and Ideas
- Context-Free vs. Contextual Synthetic Data: A common baseline (CS) prompts the original model with downstream inputs to generate synthetic pairs. This performs poorly because it provides conflicting targets for identical prompts. In contrast, context-free generations avoid prompt conflict and broadly preserve the prior distribution.
- Outperforming Real Data Replay: Surprisingly, CFS outperformed replay of actual pre-training data (Dolma on OLMo-1B). The authors hypothesize that real pre-training corpora contain high variance and noise, whereas context-free generations represent high-likelihood, coherent samples from the model's core distribution.
- Preserving Reasoning Traces ("Wait" Tokens): When fine-tuning reasoning models like R1-Distill-Llama-8B, standard SFT sharply drops test-time self-correction patterns (quantified by occurrences of the word
"Wait"), degrading reasoning. CFS preserves these self-reflection behaviors, which counter-intuitively improves medical performance over standard SFT.
Key Results
- OLMo-1B on MetaMathQA:
- Standard fine-tuning (FT) raises GSM8K accuracy from 1.59% to 29.49%, but collapses pre-existing task accuracy from 29.50% down to 23.55%.
- CFS (at 50% data ratio) retains a 28.24% average on pre-existing tasks while matching downstream math performance at 29.34% GSM8K.
- CFS outperformed real data replay (
P: 24.73% avg, 15.09% GSM8K), LoRA (28.18% avg, 20.17% GSM8K), and $\ell_2$ regularization (27.28% avg, 28.43% GSM8K). - CFS was robust across generation temperatures ($T \in [0.6, 1.2]$) and remained effective with synthetic data volumes as low as 10% of the fine-tuning dataset.
- R1-Distill-Llama-8B on MedReason:
- Standard FT improves medical task average from 41.60% to 48.13%, but drops AIME24 performance from 45.00% to 35.83%.
- CFS achieves the highest medical performance (52.48% average) while maintaining or improving reasoning capabilities: 51.67% on AIME24 and 84.60% on MATH500 (Base: 84.00%).
- Analysis showed CFS retained an average of 4.22 self-correction
"Wait"occurrences per output (Base: 4.89), compared to only 2.37 under standard FT.
Limitations and Future Work
- Model Scope: Empirical evaluations are limited to two checkpoints: a small pre-trained model (OLMo-1B) and one distilled reasoning model (R1-Distill-Llama-8B).
- Continual Learning Horizon: Experiments only evaluate single-task fine-tuning rather than sequential multi-task continual learning.
- Computational Cost: Generating tens of thousands of long synthetic sequences sequentially prior to training introduces substantial inference overhead, though the authors note 10% data volume remains largely effective.
- Regularization Baselines at Scale: The authors could not evaluate $\ell_2$ weight regularization on the 8B model due to memory constraints preventing simultaneous storage of two models in GPU VRAM under DeepSpeed ZeRO-3.
Summary updated