CMSC 838B · Course Project Proposal · Fall 2026
Predicting forgetting from gradients
How task similarity shapes catastrophic forgetting under full fine-tuning and LoRA, and whether gradient alignment and parameter sensitivity can predict it before it happens.
Semih Akkoç · ECE Ph.D., University of Maryland · Instructor: Prof. Ming C. Lin
P present · ← → move · F full screen · T restart timer · Esc exit
Fine-tuning learns the new task and erodes the old one
Pretrained models are adapted again and again: to a domain, then an instruction set, then a safety fix. Each round can overwrite what earlier rounds taught. This is catastrophic forgetting, and today we mostly measure it after the damage is done.
How does the similarity between the old and the new task change how much is forgotten?
Does a low-rank update forget differently from updating every weight, and why?
Can gradient alignment and parameter sensitivity, computed before fine-tuning, predict how much is forgotten, and where?
In more detail
Background
Sequential fine-tuning is how large models are kept up to date, and parameter-efficient methods such as LoRA Hu et al. 2022 have made it cheap enough to do routinely. Every update still moves weights that earlier skills depend on. Continual learning has studied forgetting for years, mostly on task sequences learned from scratch. In fine-tuning, the "old task" is whatever the model already knows, and the question is how one more update interacts with it.
Why this is a differentiable-programming question
Forgetting is a function of the fine-tuning trajectory, and the quantities that might predict it are all derivatives: inner products between task gradients (first order), Hessian–vector products and Fisher information (second order), and hypergradients through an unrolled training run. Automatic differentiation makes each of them computable at the scale of real models. In this project the training loop itself is the differentiable program under study.
What we know, and what is still open
What we know
- Similarity matters, non-monotonically. Forgetting peaks at intermediate task similarity, both in teacher–student networks and in image classifiers. Lee et al. 2021 Ramasesh et al. 2021
- Sensitive directions can be protected. EWC penalizes movement along high-Fisher directions; GEM and OGD remove gradient components that conflict with old tasks. Kirkpatrick et al. 2017 Lopez-Paz & Ranzato 2017 Farajtabar et al. 2020
- LoRA learns less and forgets less than full fine-tuning of LLMs. Biderman et al. 2024
- 2026: mechanisms. Forgetting is traced to negative gradient similarity at the level of individual parameters, and modeled as a low-rank perturbation of mean-field attention dynamics. Yang et al. 2026 Koubbi et al. 2026
Open challenges
- Which similarity? Input overlap, representation similarity, gradient alignment and Fisher overlap can disagree, and no agreed measure predicts forgetting.
- Fair comparisons. Full fine-tuning and LoRA are usually compared at a fixed training budget, so “forgets less” is confounded with “learns less”.
- Prediction, not post-mortem. Most analyses explain forgetting after training. A cheap test that says, before fine-tuning, how much will be forgotten and where is still missing.
In more detail
Closest work
Steele 2026 proposes that forgetting under LoRA follows the smallest principal angle between task gradient subspaces, with adapter rank mattering mainly when those subspaces are close. Orthogonal-subspace methods such as O-LoRA Wang et al. 2023 enforce that separation across tasks by construction. Yang et al. 2026 split parameters into those whose gradients conflict across tasks and those that collaborate, and update only the latter. This project asks a complementary question: whether one quantity, derived from first principles, explains forgetting for both full fine-tuning and LoRA across a controlled range of task similarity, and whether it can be computed before training.
Forgetting is a differentiable quantity
Fine-tune \(\theta^\star\) (trained on task 1) on task 2 by gradient flow. By the chain rule:
Forgetting is the negative alignment of the two tasks’ gradients, accumulated along the fine-tuning path.
Every direction of the task-2 gradient can interfere.
Interference passes only through a rank-\(r\) subspace.
\(\nabla\mathcal{L}_1(\theta^\star) \approx 0\), so movement along task 1’s sensitive directions decides, as in EWC.
\(G_i = \partial\mathcal{L}_i / \partial W\) for an adapted weight matrix \(W\); \(H_1\) is the Hessian of the task-1 loss at \(\theta^\star\).
In more detail
From the identity to something we can compute
With SGD at step size \(\eta\), one step changes the old loss by \(-\eta\,\langle \nabla\mathcal{L}_1, \nabla\mathcal{L}_2 \rangle + \tfrac{\eta^2}{2}\, \nabla\mathcal{L}_2^{\top} H_1 \nabla\mathcal{L}_2 + O(\eta^3)\), so the identity holds up to a curvature correction. With Adam, the inner product is taken in the optimizer’s preconditioned metric, which will be measured as well. The LoRA expression follows from \(\partial\mathcal{L}/\partial B = G A^{\top}\) and \(\partial\mathcal{L}/\partial A = B^{\top} G\); the usual \(\alpha/r\) scaling only rescales time. At LoRA’s standard initialization \(B = 0\), so early in fine-tuning only the \(G_2 A^{\top} A\) term is active: alignment is measured inside the row space of a random \(A\).
Every term above is an inner product of gradients or a Hessian–vector product. Reverse- and forward-mode automatic differentiation compute these without ever forming the Hessian, which is what makes the predictors practical for transformer-sized models.
How I will test it
- Synthetic: teacher–student networks with tunable feature and readout overlap; exact Hessians, many seeds.
- Real: a small pretrained LM; task 2 ranges from the same task in a new domain to unrelated tasks.
- gradient cosine between tasks
- sensitivity \(\tfrac12 \Delta\theta^{\top} H_1 \Delta\theta\) via diagonal Fisher or Hutchinson
- LoRA projected alignment
- baseline: representation similarity (CKA)
- learning–forgetting frontier over learning rate, steps and rank
- rank correlation of predicted vs. measured forgetting
- per layer: sensitivity vs. accuracy recovered by resetting that layer
In more detail
Synthetic setting
Following Lee et al. 2021, two teacher networks define tasks 1 and 2, and their first-layer weights are mixed so that feature similarity and readout similarity can be set independently. A student network learns task 1, then task 2, either fully or through a low-rank adapter on its hidden layer. The model is small enough to compute exact Hessians, check the integral identity numerically, and run many seeds per similarity level.
Language-model setting (draft, to be fixed in the first two weeks)
Task 1 is a multi-class text classification task (for example AG News topics) on a small pretrained model such as Pythia-160M or GPT-2 small. A natural ladder for task 2 moves from topic data from another source, to a different label space on similar text (sentiment), to an unrelated format (NLI). A controlled ladder keeps task-1 inputs and permutes a fraction \(p\) of the labels (readout shift), or keeps the labels and shifts the input domain (feature shift). LoRA is applied to attention and MLP projections with \(r \in \{4, 16, 64\}\).
Predictors and evaluation
Predictors are computed at \(\theta^\star\), or from a short probe run of a few percent of the fine-tuning steps, using torch.func for per-example gradients, Hessian–vector products and Hutchinson trace estimates. They are scored against two existing notions of task similarity: representation similarity (CKA, Kornblith et al. 2019) and Fisher task embeddings (Task2Vec, Achille et al. 2019). Because LoRA tends to learn less as well as forget less Biderman et al. 2024, methods are compared on the learning–forgetting frontier rather than at one setting. Per-layer predictions are checked by resetting one layer at a time to \(\theta^\star\) and measuring how much task-1 accuracy returns, as in Ramasesh et al. 2021. Tooling: PyTorch, Hugging Face Transformers and PEFT.
What I expect, and what else I will try
Hypotheses
- H1
Forgetting tracks gradient alignment and sensitivity, not input similarity, so it can peak at intermediate similarity.
- H2
LoRA forgets less because it only sees projected alignment; the gap closes when task-2 gradients fall inside task 1’s sensitive subspace.
- H3
Sensitivity-weighted predictors rank forgetting across task pairs better than gradient cosine or representation similarity alone.
Ideas & alternatives
- Causal test. Freeze or project out the most sensitive parameters and check that forgetting drops at matched learning.
- Differentiable tuning. Learn per-layer learning rates or LoRA placement by differentiating forgetting through a short unrolled run.
- Other similarity measures. CKA, Fisher task embeddings (Task2Vec), gradient-subspace angles.
- Theory. Closed-form forgetting curves for full FT vs. LoRA in the teacher–student model.
- Fallback. If LM runs are too slow, do the real-data study with ViT/ResNet on split CIFAR.
In more detail
Why a mitigation experiment
Correlation between a predictor and measured forgetting is not yet an explanation. If sensitivity really identifies where forgetting happens, then protecting those parameters, by freezing them, shrinking their step size, or projecting task-2 gradients away from them as in OGD Farajtabar et al. 2020, should reduce forgetting more than protecting the same number of randomly chosen parameters, at the same task-2 accuracy. This also gives a direct comparison with the conflicting/collaborative split of Yang et al. 2026.
Differentiating through fine-tuning
A short fine-tuning run is itself a differentiable program. Unrolling a few hundred steps and differentiating task-1 loss at the end with respect to per-layer learning rates (or a soft mask over where LoRA is applied) gives a hypergradient that directly trades learning against forgetting. This is the most course-specific extension and is planned as a stretch goal.
What will be done, and when
Pipeline and synthetic results
- Fine-tuning harness: full FT and a LoRA rank sweep, logging forgetting and learning
- Teacher–student sweep over feature and readout similarity, both methods, ≥ 3 seeds
- Autodiff predictors; integral identity verified numerically
- First real task ladder on a small pretrained LM
Real-model study and predictor scorecard
- ≥ 4 similarity levels × {full FT, LoRA \(r = 4, 16, 64\)} × 3 seeds, as learning–forgetting frontiers
- Predictor scorecard: rank correlation and per-layer attribution
- One predictor-driven mitigation as a causal test
- Final report, code, and this page updated
Forgetting-aware fine-tuning
- Theory of forgetting under low-rank updates in solvable models
- Pick layers, rank and step sizes by differentiating predicted forgetting
- Forgetting estimates before updating a deployed model; long task sequences and instruction-tuned LLMs
Thank you. Questions?
semihakkoc.github.io/cmsc838bReading list
- S. Lee, S. Goldt, A. Saxe. Continual Learning in the Teacher-Student Setup: Impact of Task Similarity. ICML 2021. Core reading
- J. Kirkpatrick et al. Overcoming Catastrophic Forgetting in Neural Networks. PNAS 2017. Core reading
- E. J. Hu et al. LoRA: Low-Rank Adaptation of Large Language Models. ICLR 2022 (arXiv 2021). Core reading
- H. Koubbi, L. Hernandez, M. Boussard. Understanding Catastrophic Forgetting in LoRA via Mean-Field Attention Dynamics. ICML 2026. Core reading
- M. Yang et al. Learning the Mechanism of Catastrophic Forgetting: A Perspective from Gradient Similarity. arXiv:2601.21577, 2026. Core reading
- V. Ramasesh, E. Dyer, M. Raghu. Anatomy of Catastrophic Forgetting: Hidden Representations and Task Semantics. ICLR 2021.
- D. Biderman et al. LoRA Learns Less and Forgets Less. TMLR 2024.
- D. Lopez-Paz, M. Ranzato. Gradient Episodic Memory for Continual Learning. NeurIPS 2017.
- M. Farajtabar, N. Azizan, A. Mott, A. Li. Orthogonal Gradient Descent for Continual Learning. AISTATS 2020.
- X. Wang et al. Orthogonal Subspace Learning for Language Model Continual Learning. Findings of EMNLP 2023.
- B. Steele. Subspace Geometry Governs Catastrophic Forgetting in Low-Rank Adaptation. arXiv:2603.02224, 2026.
- A. Achille et al. Task2Vec: Task Embedding for Meta-Learning. ICCV 2019.
- S. Kornblith, M. Norouzi, H. Lee, G. Hinton. Similarity of Neural Network Representations Revisited. ICML 2019.