Manuscript Offprint

arXiv:2610.11132

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

Kenan Tang, Andong Hua, Chengxuan Qian, Saket Tiwari, Yao Qin

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

ABSTRACT

Supervised fine-tuning (SFT) equips large language models (LLMs) with specialized capabilities, but often comes at the cost of forgetting the general capabilities of their parent models (i.e., the pretrained models before fine-tuning). This trade-off is especially limiting for queries that require both specialized and general capabilities. We introduce SFT-as-context, a training-free method in which the parent model uses the SFT model's response as context to answer the query. This allows the parent model to acquire fine-tuned capabilities from the SFT response through in-context learning while preserving its own general capabilities. Across 19 parent-SFT model pairs and 11 benchmarks, SFT-as-context remains close to the SFT models on fine-tuned capabilities, with gaps of only 2.2 and 2.1 percentage points on AIME 2024 and LiveCodeBench and 2.0 macro MAE on NutriBench-English, while staying within 2.2 percentage points of the parent models on general capabilities on average. Remarkably, it can solve queries requiring both fine-tuned and general capabilities, even when neither the parent nor SFT model succeeds alone. This approach also extends beyond parent-SFT pairs: responses from a small open-source SFT model can improve a strong closed-source LLM, outperforming either model alone. Furthermore, we use a Bayesian framework to derive theoretical guarantees that bound the error of SFT-as-context relative to the SFT model on fine-tuned capabilities and to the parent model on general capabilities. In addition, we visualize the attention weights and find that the parent model attends more to useful SFT responses and less to irrelevant ones, suggesting that selective attention helps the parent model use the SFT response through in-context learning.

1 INTRODUCTION

Supervised fine-tuning (SFT) is widely used to adapt general-purpose large language models (LLMs) to specialized tasks and domains for practical deployment (Chung et al., 2024; Zeng et al., 2024; Guo et al., 2025). However, SFT models suffer from forgetting, where fine-tuned models lose general capabilities that their parent models (i.e., the pretrained models before fine-tuning) already possess (Kirkpatrick et al., 2017; Liu et al., 2024b; Vu et al., 2022). For example, Figure 1(a) shows that a model fine-tuned for nutrition estimation on English meal-description queries achieves higher accuracy than the parent model, but it follows the fine-tuning output format and thus incorrectly assigns a carbohydrate value even when the input is a non-food query such as “Hello, world!”, as shown in Figure 1(b). In contrast, the parent model correctly recognizes that the input is unrelated to food or nutrition. This strongly indicates that the SFT model forgets a general language-understanding capability, which is how to respond appropriately to non-food queries.

This forgetting problem suffered by SFT models becomes particularly severe when a single query requires both the fine-tuned capabilities gained through fine-tuning and the general capabilities. For example, as shown in Figure 1(c), when the meal-description query is in a language different from the fine-tuned language, the model must accurately estimate nutrition using its fine-tuned capability while responding in the same language as the input using its general multilingual capability, so that the user can understand the response. The SFT model significantly improves accuracy over its

∗^{*}Equal contribution

(a) English Query (Requiring Fine-Tuned Capability)

Ground Truth: 20.65 g

User I'm snacking on a medium whole wheat tortilla.

Parent

A typical medium whole wheat tortilla contains about 45g of carbohydrates.

SFT

Tortilla, whole wheat contributes about 18.92 g carbohydrate.

High Error

Low Error

SFT-as-Context

This component contributes approximately 18.92 g of carbohydrate.

Low Error

(b) Non-Food Query (Requiring General Capability)

User Hello, world!

Parent

The input is unrelated to food or nutrition.

SFT

Hello, world! contributes about 5.00 g carbohydrate.

SFT-as-Context

The input is a greeting and is not a food.

Acknowledge Irrelevance

Hallucinate

Acknowledge Irrelevance

(c) Non-English Query (Requiring Both Fine-Tuned Capability and General Capability)

Language: Spanish; Ground Truth: 15.30 g

User Leche en polvo, 30 gramos.

[English Translation: Powdered milk, 30 grams.]

Parent

Este componente aporta aproximadamente 11 g de carbohidratos.

SFT

Leche en polvo contributes about 16.56 g carbohydrate.

SFT-as-Context

La leche en polvo contribuye con 16.56 g de carbohidratos.

High Error with Consistent Language

Low Error with Inconsistent Language

Low Error with Consistent Language

(d) Share of Attention over 100 Random Queries

Figure

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.

parent but, unlike the parent model, fails to respond in the user's language. This practical setting demonstrates that neither the SFT model nor the parent model alone satisfies both requirements.

Most existing approaches seek to mitigate forgetting through changes to training, including regularization (Li & Hoiem, 2017; Chen et al., 2020), replay (Sun et al., 2020; He et al., 2024), constraints on parameter updates (Lopez-Paz & Ranzato, 2017; Lin et al., 2026), and the choice of training method (Chen et al., 2026; Biderman et al., 2024). However, these approaches require modifying the fine-tuning process and thus cannot be directly applied, without further training, to existing ready-to-use checkpoints on platforms such as Hugging Face. 1^{1}

Instead, we propose a training-free method, SFT-as-context, which leverages the in-context learning capability of language models by providing a fine-tuned model's response as context to its parent model and prompting the parent model to generate the final answer. Despite its simplicity, SFT-as-context preserves fine-tuning gains while mitigating forgetting across all 19 evaluated parent-fine-tuned model pairs and 11 benchmarks, spanning mathematical reasoning, coding, nutrition estimation, and general capabilities. To quantify performance recovery, we define the recovery rate for each capability as the fraction of the performance gap between the parent and SFT models that SFT-as-context recovers (Equation 2). A recovery rate of 100% means SFT-as-context matches

1^{1}https://huggingface.co/ the better model. Using SFT checkpoints collected from Hugging Face, SFT-as-context achieves 95.0% and 94.1% recovery rates of the fine-tuning gains on AIME 2024 and LiveCodeBench (Jain et al., 2025), respectively. At the same time, it achieves an average recovery rate of 94.2% for general capabilities across instruction-following, multilingual tasks, question answering, and planning. Additionally, SFT-as-context combines fine-tuned and general capabilities within the same response, going beyond what either model can achieve alone. For example, on NutriBench-Non-English (Dhaliwal et al., 2025), as shown in Figure 1(c), SFT-as-context achieves recovery rates of 84.6% for nutrition estimation and 95.2% for language consistency.

More importantly, SFT-as-context requires only standard text input-output interfaces, making it applicable to closed-source models without access to their parameters. This flexibility allows responses from a small open-source SFT model to serve as context for a stronger closed-source model, even when the latter is not the parent of the SFT model. Notably, this holds for a strong proprietary model: providing responses from a fine-tuned Qwen3-4B as context to Gemini 3.5 Flash reduces macro MAE from 17.44 to 14.08 on NutriBench-English, outperforming either model alone.

Going deeper, we study how SFT-as-context works from two perspectives. First, we use a Bayesian framework for in-context learning (Xie et al., 2022; Hu et al., 2024) to provide theoretical guarantees that bound the differences in error between parent models, SFT models, and SFT-as-context. Second, we visualize the attention weights that the parent model assigns to the SFT output in the prompt. We find that the parent model selectively attends to the SFT output based on its effectiveness. For example, as shown in Figure 1(d), the parent model allocates substantially more attention to the SFT response for nutrition queries than for unrelated queries (37.44% versus 15.11%). Taken together, these analyses suggest a single underlying principle of SFT-as-context: the parent model leverages in-context learning to selectively acquire fine-tuned capabilities from the SFT responses while preserving its own general capabilities.

References (58)