TL;DR
Fine-tuning large language models (LLMs) on specialized tasks often degrades their general, pretrained capabilities—a phenomenon known as catastrophic forgetting. This paper introduces Foundation-Preserving LoRA (FoLoRA), an optimization framework that dynamically balances task adaptation and knowledge preservation during training. By scoring update directions using a generalized Rayleigh quotient, FoLoRA selectively dampens updates that cause severe forgetting relative to their downstream utility.
What Problem Does This Paper Address?
When we fine-tune a foundation model on a specific domain (like coding or mathematics), the model's performance on general tasks (like trivia or factual retrieval) typically plummets. While Low-Rank Adaptation (LoRA) reduces this problem by restricting updates to a compact subspace, standard LoRA still suffers from forgetting.
Recent "forgetting-aware" methods try to fix this by initializing adapters in "safer" subspaces or applying hard projection constraints. However, these approaches suffer from two major flaws:
- Static Constraints: They only protect the model at initialization or through rigid boundaries; they don't evaluate whether an update direction during optimization is useful enough to justify its preservation cost.
- Narrow Calibration Data: They rely on a single external dataset (like NQ Open) as a proxy for the pretraining distribution, which biases what knowledge gets preserved.
Methods
FoLoRA tackles these limitations through a novel optimization framework consisting of two main components:
1. Generalized Rayleigh-Quotient Optimization
FoLoRA uses a first-order Taylor expansion to define two activation-induced metrics: a forgetting penalty (how much an update disrupts pretrained behavior) and a task utility (how much it helps the downstream task).
To balance the two, FoLoRA scores candidate update directions using a generalized Rayleigh quotient: $$\rho(v) = \frac{v^\top C_{\text{task}} v}{v^\top H v}$$ where $C_{\text{task}}$ is the downstream task covariance matrix and $H$ is the regularized pretraining covariance matrix. Optimizing this quotient yields a generalized eigenbasis that aligns and decouples both objectives.
2. Spectral-Gated Adam (SAdam)
Instead of standard Adam, FoLoRA introduces SAdam. It transforms gradients into this generalized spectral coordinate system, where the forgetting penalty is normalized ("whitened") and task utility is diagonalized. SAdam applies a dynamic, direction-wise soft gate that attenuates updates along directions with low utility-to-penalty ratios.
3. Model-Generated Calibration
To avoid the bias of using a single external dataset to estimate the pretraining distribution, FoLoRA introduces model-generated calibration. It samples calibration sequences directly from the autoregressive distribution of the pretrained model itself, providing a broader and more robust representation of the foundation knowledge.
Datasets
The authors evaluated FoLoRA across three downstream adaptation tasks using LLaMA-2-7B and Qwen3-1.7B:
- Math: Trained on MetaMathQA; evaluated on GSM8K and MATH.
- Code: Trained on CodeFeedback; evaluated on HumanEval and MBPP.
- Instruction Following: Trained on WizardLM-Evol-Instruct; evaluated on IFEVAL.
To evaluate the preservation of foundation knowledge, they used:
- Factual Retrieval Benchmarks: TriviaQA, NQ Open, and WebQS.
- Broader Capabilities Suite: TruthfulQA (hallucination robustness), SQuAD-v2 (reading comprehension), MMLU (multitask reasoning), GPQA (scientific reasoning), and long-context benchmarks (BABILong, LongBench-v2).
Key Insights and Ideas
- Entangled Geometry: The activation covariances of pretraining and downstream tasks do not share eigenvectors. This means optimizing in either standard Euclidean space or a single-covariance basis cannot cleanly separate task utility from forgetting risk.
- Dynamic Gating > Static Initialization: Softly gating updates throughout the entire training trajectory provides a significantly better preservation-adaptation trade-off than simply initializing the weights in a safe subspace.
- The Model is Its Own Best Proxy: Generating calibration data via ancestral sampling from the base model itself yields activation statistics that cover a wider range of pretrained behaviors than any single external benchmark dataset.
Key Results
FoLoRA consistently achieved the strongest balance between downstream task performance and foundation preservation across all configurations:
- Math Adaptation: FoLoRA achieved the highest preservation score (Avg1 = 26.06, retaining 103.84% of the base model's capability) while simultaneously securing the best downstream task aggregate (Avg2 = 26.34).
- Code Adaptation: FoLoRA maintained 102.12% of its original general knowledge while outperforming all baselines on coding benchmarks (Avg2 = 22.24).
- Instruction Following: FoLoRA achieved the highest combined geometric mean score (GM = 29.26), demonstrating superior instruction-following capabilities without sacrificing factual knowledge.
The main quantitative results across these tasks are detailed in the tables below:
Limitations and Future Work
- VRAM Overhead: While the one-time preprocessing cost (generating calibration data and computing the eigensolver) is lightweight, FoLoRA increases peak VRAM usage during training by approximately 14.8% compared to standard LoRA. The authors note that investigating memory-efficient implementations is an important next step.
- Extension to Full Fine-Tuning: Although the paper mathematically outlines how FoLoRA can be extended to dense, full-parameter fine-tuning, a comprehensive empirical evaluation of this extension is left for future work.
Summary updated