SFT-as-Context Mitigates Forgetting in Supervised Fine-Tuning

Kenan Tang, Andong Hua, Chengxuan Qian, Saket Tiwari, Yao QinarXiv 2026

TL;DR

SFT-as-context is a simple, training-free method to stop specialized LLMs from "forgetting" their general-purpose skills. By using a fine-tuned model's response as context for its original parent model, the system combines specialized expertise with general reasoning, effectively recovering ~95% of fine-tuning gains while preserving nearly all original capabilities.

What Problem Does This Paper Address?

Supervised Fine-Tuning (SFT) is the standard way to turn a general LLM into a specialist (e.g., a coding assistant or a math solver). However, this specialization often comes at a steep price: catastrophic forgetting. A model fine-tuned for math might suddenly lose its ability to follow basic formatting instructions or respond in different languages.

This trade-off is particularly painful for "joint-capability" queries. For example, if you ask a nutrition-specialized model to estimate calories for a meal description written in Spanish, the model might provide accurate numbers but fail to respond in Spanish because it "forgot" its multilingual training during SFT. Existing solutions usually involve complex re-training or regularization, which are expensive and impossible to apply to closed-source models.

Methods

The authors propose a two-pass inference method called SFT-as-context. It requires no additional training and works entirely through the model's text interface:

  1. Pass 1: The specialized SFT model ($f_{SFT}$) generates an initial response ($y_{SFT}$) to the user's query ($x$).
  2. Pass 2: The original "parent" model ($f_{parent}$) is given the original query, the SFT model's response, and a specific set of instructions ($I$). These instructions tell the parent model to treat the SFT response as a "helpful answer" but to correct any errors or formatting violations.

The final output is $y_{SAC} = f_{parent}(x, y_{SFT}, I)$.

The intuition is that the parent model retains the general reasoning needed to filter out the SFT model's "hallucinations" or formatting errors while leveraging the SFT model's specialized knowledge provided in the context.

Figure 1: SFT-as-context recovers both fine-tuned and general capabilities. The task is to predict the nutritional values (carbohydrates, fat, protein, and energy) from a meal description, in the same language as the given query. Only the carbohydrate value is shown here as an example. Subfigure (a) shows that an SFT model trained on English data excels in fine-tuned capability. However, subfigures (b) and (c) show that it fails at acknowledging non-food queries and responding in the same language as the query. When a query requires both fine-tuned nutrition estimation capability and general multilingual capability, only SFT-as-context satisfies both requirements. Subfigure (d) shows that the parent model attends more to useful English SFT responses than to hallucinated SFT responses to non-food queries, suggesting that selective attention helps the parent model use the SFT response through in-context learning. We discuss details of the attention analysis in Section 4.2.

Datasets

The researchers evaluated the method across 19 parent-SFT model pairs (including the Qwen2.5 and Gemma families) and 11 benchmarks:

  • Mathematics: AIME 2024 and MathIF (a new benchmark requiring math + complex formatting).
  • Coding: LiveCodeBench and LiveCodeBenchIF (coding + formatting constraints).
  • Nutrition: NutriBench (English, Non-English, and Non-Food subsets).
  • General Capabilities: IFEval (instruction following), MGSM (multilingual math), SQuAD2.0 (QA), and others.

Key Insights and Ideas

  • Selective Attention is the Secret Sauce: By visualizing attention weights, the authors found that the parent model "knows" when to listen to the specialist. As shown in Figure 1(d) and Figure 3, the parent model allocates significantly more attention to useful SFT responses than to irrelevant or hallucinated ones.
  • Cross-Model Synergy: The method isn't limited to parent-child pairs. A small, open-source specialist (like a 4B Qwen model) can act as a "consultant" for a massive closed-source model (like Gemini 3.5 Flash), improving the latter's performance on specialized tasks.
  • Theoretical Guarantees: Using a Bayesian framework, the authors proved that the error of SFT-as-context is bounded. It stays close to the SFT model on specialized tasks and close to the parent model on general tasks.
  • Emergent Joint Capabilities: SFT-as-context can solve problems that neither model can solve alone. The SFT model has the facts but lacks the format; the parent has the format but lacks the facts. Together, they succeed.

Key Results

The results across math, coding, and nutrition are remarkably consistent:

  • High Recovery: SFT-as-context recovered 95.0% of fine-tuning gains on AIME 2024 and 94.1% on LiveCodeBench.
  • Mitigated Forgetting: It stayed within 2.2 percentage points of the parent models' general capability scores on average, whereas the SFT models dropped by an average of 33.2 points.
  • Nutrition Accuracy: On NutriBench-English, providing a Qwen3-4B response as context to Gemini 3.5 Flash reduced the error (Macro MAE) from 17.44 to 14.08, outperforming both models.
Heatmaps showing how SFT-as-context (right) maintains the blue "gains" of SFT while eliminating the red "forgetting" seen in standard SFT (left).

Limitations and Future Work

  • Inference Overhead: The method requires two inference passes. While the authors show the second pass is often short (adding only ~5-13% more tokens for math/coding), it still increases latency and cost.
  • Safety Conflicts: The method struggles when fine-tuned and general capabilities directly conflict. In a case study on "jailbroken" models, the parent model often followed the harmful specialized response rather than its own safety guardrails, likely because the SFT-as-context instructions didn't explicitly prioritize safety.
  • Prompt Engineering: The success of the method relies on well-crafted instructions for the second pass.
  • Future Directions: The authors suggest exploring this approach for models trained via Reinforcement Learning (RLHF/RLFT) and optimizing instructions to better prioritize specific general capabilities like safety.

Summary updated

BibTeX
@misc{tang2026sft,
  author = {Kenan Tang and Andong Hua and Chengxuan Qian and Saket Tiwari and Yao Qin},
  title = {{SFT-as-Context Mitigates Forgetting in Supervised Fine-Tuning}},
  year = {2026},
  eprint = {2610.11132},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.11132},
}
Figure