Catastrophic Forgetting › Visualizing Forgetting Dynamics

Michael BrenndoerferNovember 26, 20253 min read
Language AI HandbookAll chapters
Part 34 of 67Fine-tuning Fundamentals
Chapter 251Catastrophic Forgetting › Visualizing Forgetting Dynamics
Reading section 4 of 13 · Visualizing Forgetting Dynamics · 3 minSection 4 of 13 · 3 min

Book contents

Section 4 of 13 · 3 min read

Catastrophic Forgetting › Visualizing Forgetting DynamicsOne section · Sections in this chapter4 / 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 develop strong intuition about how forgetting evolves during fine-tuning, let's simulate the training dynamics directly. We'll track two quantities simultaneously: performance on the new fine-tuning task (which we want to increase) and performance on the original capability (which we want to preserve). This dual tracking is the core discipline of forgetting-aware fine-tuning.

In[5]:
Code
import numpy as np

np.random.seed(42)

# Simulate fine-tuning dynamics
epochs = 50

# Task A: original task (pre-training proxy)
# Task B: new fine-tuning task

# Before fine-tuning
task_a_baseline = 0.85
task_b_baseline = 0.45

# Simulate learning curves during fine-tuning
task_b_performance = []
task_a_performance = []

for epoch in range(epochs):
    # Task B improves with training
    task_b = task_b_baseline + (0.95 - task_b_baseline) * (
        1 - np.exp(-epoch / 10)
    )
    task_b += np.random.normal(0, 0.01)
    task_b_performance.append(np.clip(task_b, 0, 1))

    # Task A degrades - rapid initial forgetting, then stabilizes
    forgetting_rate = 0.3 * (1 - np.exp(-epoch / 8))
    task_a = task_a_baseline - forgetting_rate + np.random.normal(0, 0.01)
    task_a_performance.append(np.clip(task_a, 0, 1))
Out[6]:
Visualization
Line plot showing Task B performance rising while Task A performance falls during fine-tuning epochs.
Fine-tuning dynamics showing the classic forgetting pattern. Task B performance (red) rises steadily while Task A performance (blue) degrades, with shaded regions showing the magnitude of each effect. Most forgetting concentrates in the first 10-15 epochs when gradient updates are largest and the model is adjusting most aggressively to the new task distribution.

The visualization reveals a characteristic pattern: most forgetting happens early in training when learning rates are highest and the model is adjusting most aggressively. Later epochs show diminishing returns on both learning and forgetting as the model approaches a new equilibrium. This front-loaded forgetting profile has a practical implication: the first few epochs of fine-tuning are the most dangerous for prior capabilities. If you can control the rate of change in those early epochs, through learning rate warmup, layer freezing, or regularization, you can often prevent the most severe forgetting while still achieving strong task performance.