Abstract: Recent advancements in large language models (LLMs) have revolutionized natural language processing through their remarkable capabilities in understanding and executing diverse tasks. While supervised fine-tuning, particularly in Retrieval-Augmented Generation (RAG) scenarios, effectively enhances task-specific performance, it often leads to catastrophic forgetting, where models lose their previously acquired knowledge and general capabilities. Existing solutions either require access to general instruction data or face limitations in preserving the model's original distribution. To overcome these limitations, we propose SelfAug, a self-distribution alignment method that aligns input sequence logits to preserve the model's semantic distribution, thereby mitigating catastrophic forgetting and improving downstream performance. Extensive experiments demonstrate that SelfAug achieves a superior balance between downstream learning and general capability retention. Our findings not only advance the understanding of catastrophic forgetting in RAG contexts but also provide a practical solution applicable across diverse fine-tuning scenarios.
Introduction
Fine-tuning is the standard approach for adapting general-purpose Large Language Models (LLMs) to specialized domains. However, this process frequently triggers Catastrophic Forgetting (CF), where the model "overwrites" complex linguistic patterns and instruction-following logic acquired during pre-training. Retrieval-Augmented Generation (RAG) scenarios are particularly susceptible to CF due to the massive distribution shift introduced by long, noisy retrieved documents, which differ significantly from standard instruction-tuning data.
Existing solutions generally fall into two categories: data replay (e.g., MAGPIE), which requires high-quality general datasets that may not be available, and parameter constraints (e.g., Orthogonal Loss), which can overly restrict the model's ability to learn the new task effectively.
Methodology: Distribution Self-Alignment
The core innovation of SelfAug is Distribution Self-Alignment. Instead of focusing on model weights or replaying old data, SelfAug focuses on the model's internal semantic state during the forward pass.
As illustrated in Figure 1, SelfAug introduces a dual-objective loss function. During fine-tuning, the input sequence is passed through both the training model and the original frozen pre-trained model. The model is trained to minimize the standard Negative Log-Likelihood (NLL) for the target task while being penalized via Kullback-Leibler (KL) Divergence if its logits for the input sequence drift too far from the original model's logits. By stabilizing these input logits, which encapsulate the model’s semantic understanding and decision boundaries, SelfAug preserves the model's "personality" and general skills even as it adapts to new response types.
Experimental Setup
We evaluated SelfAug using Qwen2.5-7B-Instruct and Llama-3-8B-Instruct across a wide array of benchmarks:
- RAG Performance: CRAG (Comprehensive RAG benchmark) and RAG-Instruct.
- Domain-Specific RAG: BioASQ (biomedical) and OmniEval (finance).
- Foundational Abilities: MATH (reasoning), HumanEval (coding), and IFEval (instruction following).
- General Knowledge: MMLU, ARC-C, and HellaSwag.
Results and Discussion
SelfAug consistently outperformed standard fine-tuning (SFT), LoRA, and other state-of-the-art CF mitigation strategies across nearly all metrics.
As shown in Figure 6, SelfAug achieved an average score of 70.73% on the CRAG dataset, compared to 63.73% for standard SFT and 67.22% for LoRA. A critical finding is the fragility of instruction-following capabilities; while standard LoRA fine-tuning caused IFEval scores to plummet from 71.90 to 48.80, SelfAug maintained a much healthier 62.11. Interestingly, raw knowledge (MMLU) remained relatively stable across methods, suggesting that CF in RAG primarily affects the "behavioral" layer responsible for following formatting and logic constraints.
Conclusion
SelfAug provides a practical and effective framework for mitigating catastrophic forgetting in RAG by aligning input distributions. While it introduces some computational overhead due to the additional forward pass through the reference model, it offers a superior balance between specialized task performance and the retention of general intelligence. Future work will explore importance sampling to reduce the computational cost for ultra-long contexts and further test the method under full-parameter tuning scenarios.
Summary updated