Catastrophic Forgetting › A Worked Example: Tracing Forgetting Step by Step

Michael BrenndoerferNovember 26, 20253 min read
Language AI HandbookAll chapters
Part 34 of 67Fine-tuning Fundamentals
Chapter 251Catastrophic Forgetting › A Worked Example: Tracing Forgetting Step by Step
Reading section 6 of 13 · A Worked Example: Tracing Forgetting Step by Step · 3 minSection 6 of 13 · 3 min

Book contents

Section 6 of 13 · 3 min read

Catastrophic Forgetting › A Worked Example: Tracing Forgetting Step by StepOne section · Sections in this chapter6 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

To make the mechanics concrete, let us trace through a small numerical example of how catastrophic forgetting unfolds. Imagine a toy neural network with just three parameters, θ1\theta_1, θ2\theta_2, and θ3\theta_3, trained to perform two tasks sequentially. This example is deliberately simple so every step is transparent, but the same dynamics operate in networks with billions of parameters.

Setup. Suppose our network has the following pre-trained weights after Task A training:

θ∗=[θ1∗,θ2∗,θ3∗]=[1.0,0.5,−0.3]\boldsymbol{\theta}^* = [\theta_1^*, \theta_2^*, \theta_3^*] = [1.0, 0.5, -0.3]

Task A performance depends heavily on θ1\theta_1 and θ2\theta_2 (high importance), while θ3\theta_3 has low importance for Task A. After pre-training, the model achieves 88% accuracy on Task A.

Fine-tuning on Task B. Now we fine-tune on Task B. The gradient computed from the first batch of Task B data is:

∇θLB=[0.4,−0.3,0.6]\nabla_{\boldsymbol{\theta}} \mathcal{L}_B = [0.4, -0.3, 0.6]

This gradient says: to reduce Task B loss, increase θ1\theta_1 by 0.4, decrease θ2\theta_2 by 0.3, and increase θ3\theta_3 by 0.6. With a learning rate of α=0.1\alpha = 0.1, the update rule θ←θ−α∇LB\theta \leftarrow \theta - \alpha \nabla \mathcal{L}_B produces:

θ(1)=[1.0−0.04, 0.5+0.03, −0.3−0.06]=[0.96, 0.53, −0.36]\boldsymbol{\theta}^{(1)} = [1.0 - 0.04, \ 0.5 + 0.03, \ -0.3 - 0.06] = [0.96, \ 0.53, \ -0.36]

After one step: θ1\theta_1 drifted from 1.0 to 0.96, θ2\theta_2 from 0.5 to 0.53. These changes are small, but notice that θ1\theta_1, which is highly important for Task A, moved in the direction needed for Task B, not in the direction needed for Task A. The gradient for Task B is not aware of what Task A needs.

Accumulation over many steps. After 100 gradient steps with similar Task B gradients, θ1\theta_1 might have drifted to 0.6 and θ2\theta_2 to 0.8. Task A's performance, which depended on θ1≈1.0\theta_1 \approx 1.0 and θ2≈0.5\theta_2 \approx 0.5, drops dramatically: perhaps from 88% to 60%, a loss of nearly 30 percentage points in absolute terms.

If we applied EWC regularization, the Fisher information values for these parameters would be approximately F1=0.9F_1 = 0.9, F2=0.7F_2 = 0.7, F3=0.1F_3 = 0.1 (high importance for θ1\theta_1 and θ2\theta_2, low for θ3\theta_3). The regularized gradient for θ1\theta_1 would be:

∇θ1LEWC=0.4+λ⋅F1⋅(θ1−θ1∗)=0.4+0.5⋅0.9⋅(1.0−1.0)=0.4\nabla_{\theta_1} \mathcal{L}_{\text{EWC}} = 0.4 + \lambda \cdot F_1 \cdot (\theta_1 - \theta_1^*) = 0.4 + 0.5 \cdot 0.9 \cdot (1.0 - 1.0) = 0.4

In the first step the EWC gradient is the same, because θ1\theta_1 has not yet drifted. But after drift begins, the EWC regularization term grows to resist further movement:

∇θ1LEWC=0.4+0.5⋅0.9⋅(0.96−1.0)=0.4−0.018=0.382\nabla_{\theta_1} \mathcal{L}_{\text{EWC}} = 0.4 + 0.5 \cdot 0.9 \cdot (0.96 - 1.0) = 0.4 - 0.018 = 0.382

The regularization pushes θ1\theta_1 back toward 1.0 while the task gradient pushes it down. The larger the drift, the larger the push-back. After 100 steps, θ1\theta_1 might stabilize near 0.85 rather than drifting to 0.6, preserving more of Task A's performance. This is how regularization-based mitigation works: it reshapes the loss surface so that the optimizer encounters resistance when it tries to move important parameters too far from their pre-trained values.