4.3.12 · D1Pretraining & Fine-Tuning LLMs

Foundations — Catastrophic forgetting

2,297 words10 min readBack to topic

This page assumes nothing. Before you can understand why forgetting happens or how EWC fixes it, you need to be able to read every squiggle in the parent note. We build each one from a picture, in an order where each rests on the one before.


0. What even is a "weight"? (the object everything acts on)

Picture a giant control panel covered in sliders. Each slider is one number. Slide them to different positions and the machine behaves differently — recognises cats, writes code, does arithmetic. That whole panel of numbers is what a network knows.

Why we need this: the parent note's central claim is that there is no separate memory slot per task — cats, code and arithmetic all live on the same panel. That is only sayable once you see as one shared list.

  • (no subscript) ::: the entire panel of sliders (a vector).
  • ::: one specific slider, the -th number.

1. The function the sliders control:

The machine takes an input (a question, an image) and produces an output — a prediction.

The picture: enters on the left, flows through the panel, an answer pops out on the right. We compare that answer to the truth .

Why we need it: forgetting is a change in what does — same , but after training the slider positions moved, so the answer got worse. You cannot describe "worse" without naming input, output, and truth.


2. How wrong were we? The loss and

We need one number that says "how bad is this answer." Small = good, big = bad.

We rarely have one example — we have a whole pile of them. That pile is a dataset.

Now average the one-example penalty over the whole bag to get the total badness:

Let us read each piece, left to right:

Why the topic needs it: "training on the new task" means pushing downward. And catastrophic forgetting is precisely: goes down while the un-mentioned silently goes up.


3. Which way is downhill? The gradient

We want to make small. So we ask: if I nudge each slider a tiny bit, does the badness rise or fall? The tool that answers "which way is downhill, and how steep" is the gradient.

The update rule that "does the walking":

Why the topic needs it: the parent's whole "WHY it happens" hangs on one observation — this update contains only . Nothing here even mentions , so the walk cheerfully strolls out of the old-task region. And "lower LR reduces drift" is literally "make smaller so each step leaves less." See Learning Rate & Optimization.


4. Two valleys on one map: the loss landscape

Since turns any slider setting into one badness number, imagine plotting badness as height above the slider-settings. You get a landscape of hills and valleys.

The key picture (matches the parent): draw two landscapes over the same horizontal axis of slider settings.

  • has its valley bottom at .
  • has its valley bottom somewhere else.

Gradient descent on slides toward the new bottom — which means climbing out of the old valley. That climb-out is the forgetting.

Why the topic needs it: this two-valley picture is the mental model for every fix. Rehearsal = add the old valley back into the terrain you descend. EWC = staple a spring to . LoRA = don't move the base sliders at all.


5. "How much did each slider matter?" — importance & the Fisher

The parent's fix (EWC) needs to know which sliders were critical for the old task and which were idle. Picture the old valley again: in some directions it is a steep narrow gorge (move a little, loss shoots up → that slider mattered a lot); in others it is a flat wide floor (move freely, loss barely changes → that slider was idle).

The formula the parent writes:

You do not need to derive this here — the full story lives in Fisher Information and its Gaussian-fitting cousin Laplace Approximation. You only need: = importance of slider .


6. The spring penalty: and

Now assemble the last pieces of the boxed EWC loss.

Put importance × distance-squared together and you get a per-slider spring of stiffness :

Read it now that every symbol is earned: "be good at the new task (), plus pay a penalty () that pulls every important () slider back toward its old home ()." Idle sliders () feel no pull — the new task learns in the leftover room. This is why the parent's Multi-task Learning and Continual Learning links matter: EWC is a cheap stand-in for training everything at once.


7. The prerequisite map

Here is how every foundation above feeds the topic. Read bottom-up: symbols at the top are needed to state the ones below them.

weights theta and slider theta i

model f theta of x

loss L over dataset D

gradient nabla and step size eta

update rule slides theta downhill

loss landscape two valleys

old optimum theta star

CATASTROPHIC FORGETTING

Fisher importance F i

spring penalty lambda and displacement

EWC loss the fix


Equipment checklist

Cover the right side; can you answer each before reading on? If not, reread its section.

  • What does stand for, and what is ? ::: = the whole list of the network's weights (all sliders); = the single -th weight.
  • What does the subscript in tell you? ::: The output depends on the slider settings — move the weights and the same input gives a different answer.
  • Difference between and ? ::: = penalty for one example; = the average penalty over a whole dataset.
  • What do , , and mean? ::: = add up; = "is inside the set"; = the number of pairs in dataset .
  • What does the gradient point toward, and which way do we step? ::: It points uphill (fastest loss increase); we step the opposite way to go downhill.
  • In the update , what is ? ::: The learning rate — the size of each step; smaller means less drift from the old optimum.
  • What is in the loss-landscape picture? ::: The weight setting at the bottom of the old task's valley — where we landed after training the old task.
  • Why do "two valleys" cause forgetting? ::: The new task's valley bottom sits elsewhere, so descending the new loss climbs out of the old valley.
  • What does a large tell you about slider ? ::: It was important for the old task (steep curvature) — moving it hurts the old skill a lot, so EWC penalizes moving it.
  • What role does play in the EWC loss? ::: It scales overall protectiveness — big = stiff springs defending old knowledge, small = freer new-task learning.
  • Why does behave like a spring? ::: It is zero at the old home and grows with the square of displacement — exactly a spring's energy that pulls back harder the further you stray.

Connections

  • Catastrophic Forgetting — the parent topic these foundations unlock.
  • Fisher Information — the full story of the importance .
  • Laplace Approximation — where the Gaussian-around- picture comes from.
  • Learning Rate & Optimization — the step size and why smaller reduces drift.
  • Fine-Tuning LLMs — where these symbols get used in practice.
  • LoRA and Adapters — the "freeze the base sliders" alternative.
  • Continual Learning · Multi-task Learning — the broader settings EWC approximates.