M11 · Fine-tuning, LoRA, and RLHF11-0324 min read

Lesson 77 of 106 · Module 12 of 14 · Week 6

Threads:The measurement threadThe weights threadThe efficiency thread

Catastrophic Forgetting When Fine-Tuning an LLM

Catastrophic forgetting is the loss of previously learned capability when a neural network is trained on new data: the fine-tune succeeds on its target task while quietly destroying abilities nobody was measuring. It is caused by gradient updates overwriting the shared weights that encoded the old behaviour, and the only thing that reliably catches it is a broad evaluation run recorded before the fine-tune started. Parameter-efficient methods like LoRA reduce exposure because most weights never move at all.

01

What catastrophic forgetting is

Catastrophic forgetting — sometimes catastrophic interference — is the phenomenon in which a neural network trained sequentially on a new task loses performance on tasks it previously performed well. The term predates LLMs by decades; it is a general property of networks that use shared, distributed representations and update them with gradient descent. In the LLM context it shows up in a specific and repeatable way: you fine-tune a general instruct model on a narrow dataset, the narrow task improves, and a broad set of unrelated abilities degrade.

The word "catastrophic" is doing real work. Ordinary training involves trade-offs and small regressions everywhere; that is normal. Catastrophic forgetting names the case where the degradation is large, abrupt, and on capabilities the training data never mentioned. A model that could summarise, translate, refuse, format JSON, and answer general-knowledge questions before the fine-tune, and can now only do the one thing it was fine-tuned for, has catastrophically forgotten.

Three properties make it dangerous rather than merely annoying:

  1. It is silent on the metrics you are watching. Your training loss falls. Your validation loss on the fine-tuning task falls. Both are computed on the new distribution, so neither can see the old one.
  2. It is invisible in a demo. Demos exercise the trained behaviour, which is exactly the part that works.
  3. It is unrecoverable as a measurement after the fact. Without a pre-fine-tune record, "the model can't do X" and "the model never could do X" produce identical evidence.

The name for what you are protecting is general capability, and the discipline for protecting it is holding a broad, frozen evaluation slice that the fine-tuning data does not overlap with, and running it before and after every weight change.

02

How catastrophic forgetting happens

L1 — The intuition: one set of dials, two jobs

A model has a fixed set of parameters, and every capability it has is encoded across shared subsets of them (01-02). There is no compartment labelled "French" and no compartment labelled "refuse harmful requests." The same weights participate in many behaviours at once.

Now fine-tune. Gradient descent computes, for each weight, the direction that reduces the loss on the new data, and moves that weight. It has no term in its objective that says "and don't break anything else." Nothing is protecting the old capability, so any weight whose current value was load-bearing for an old ability and whose adjustment helps the new task will be adjusted. Repeat that a few thousand times at a high enough learning rate, and the old ability erodes.

The intuition for why it is catastrophic rather than gradual: representations are entangled. Moving a weight a little can change the behaviour it participated in a lot, because the effect propagates through downstream layers. Small parameter drift can produce large behavioural collapse on a capability that depended on a particular configuration.

L2 — The mechanics: distribution shift, learning rate, epochs, and dataset narrowness

Four levers control how much forgetting a run produces, and all four are under your control.

Distribution narrowness. The severity scales with how unlike your fine-tuning data is from the pretraining distribution. A dataset that is 100% single-turn Python-docstring generation is a narrow, sharply-peaked distribution; training on it pushes the model's output distribution toward that peak and away from everything else. A dataset that mixes the target task with general instruction data has a broader shape and pulls less.

Learning rate. Larger steps move weights further from the pretrained configuration. This is the single most direct control, and it is why fine-tuning uses learning rates far smaller than pretraining. The pretrained weights are the prior; a large learning rate discards the prior.

Epochs. Each additional pass over a small dataset increases the number of gradient steps pointing at the same narrow target. Multi-epoch training on a small set is the classic recipe for both overfitting (01-07) and forgetting, and the two arrive together.

Number of trainable parameters. If only a small fraction of the weights can move, the damage that can be done is bounded. This is one of the underrated arguments for parameter-efficient fine-tuning and the reason 11-05 reads as the mitigation for this lesson as well as for 11-04's memory problem.

What it looks like in the numbers. Constructed illustration, not measurements — the point is the shape:

text
Eval slice                Before FT   After FT (aggressive)   Delta
────────────────────────────────────────────────────────────────────
Target task (ticket fmt)     41%            88%              +47
General QA                   72%            58%              -14
Summarisation (ROUGE-ish)    0.34           0.21             -0.13
Multilingual response        68%            19%              -49
Refuses unsafe request       96%            61%              -35
JSON validity                91%            74%              -17
────────────────────────────────────────────────────────────────────

Read the target-task row alone and this is a triumph. Read the whole table and it is a regression that would be irresponsible to ship. The multilingual and refusal rows are the ones that should stop the release: refusal collapse is a safety regression, and it happened even though the fine-tuning data contained no unsafe requests at all. That is the signature of forgetting — damage on axes the data never touched.

L3 — Why alignment and safety behaviours are the most fragile

There is a structural reason refusal and safety behaviour degrade first, and it is worth understanding because it is the version of this problem with the highest consequences.

Refusal behaviour is installed late in a model's life, by SFT and alignment stages, using relatively small datasets, on top of a pretrained model that has no such disposition. It is a thin layer of learned behaviour over a much larger substrate that was never trained to refuse anything. Fine-tuning re-enters the same regime that installed it — small dataset, supervised objective, modest number of steps — and can therefore displace it with comparable ease. It took a small amount of training to put in, and it takes a small amount of training to take out.

The practical rules that follow:

  • A fine-tune is a safety-relevant change, even a purely stylistic one, and needs a safety slice re-run before release. 13-02 is the guardrails layer that provides defence in depth for exactly this reason: a rail sitting outside the model is not degraded by a weight update.
  • Never assume an aligned base model stays aligned through your fine-tune. The alignment you inherited is not a permanent property of the checkpoint you produced.
  • Mixing a slice of general instruction data into the fine-tuning set is the standard, cheap mitigation. It keeps a gradient signal pointing at the broad distribution while the narrow one is being learned. The trade-off is that the target task learns somewhat more slowly, which is usually a bargain.

A second L3 nuance: forgetting is not the same as overfitting, though they co-occur. Overfitting is failure to generalise within the new task's distribution — training loss falls, held-out loss on the same task rises. Forgetting is degradation outside the new task's distribution. You can have either without the other. A validation split of your fine-tuning data detects overfitting and is completely blind to forgetting, because it is drawn from the same narrow distribution. This is the most important thing to know about the two: your fine-tuning validation set cannot detect forgetting, by construction.

03

Catastrophic forgetting vs overfitting vs distribution shift vs drift

Four failure modes that all present as "the model got worse," commonly confused, distinguished by what got worse relative to what.

PropertyCatastrophic forgettingOverfittingDistribution shift (train/serve mismatch)Model drift in production
What degradesCapabilities outside the training taskGeneralisation within the training taskPerformance on real trafficPerformance over time
When it happensDuring fine-tuningDuring trainingAt deploymentWeeks to months after deployment
CauseNew gradients overwrite shared weightsToo many steps on too little dataTraining data unrepresentative of real inputsThe world changed; the model did not
Detected byA broad pre-training-run baseline re-run afterHeld-out validation split of the same taskComparing production inputs to training inputsOngoing monitoring of live quality
Visible in training loss?NoYes, as a train/val gapNoNo
Visible in task validation?NoYesSometimesNo
FixLower LR, fewer epochs, mix general data, PEFT, or revertFewer epochs, more/ more diverse data, regularisationFix the data collectionRe-index, re-evaluate, retrain
Model weights changed?Yes, by youYes, by youNoNo
Lessonthis one01-0708-0212-14

The row to internalise is "visible in task validation." Overfitting is caught by the split you already have. Forgetting is not caught by anything you already have unless you deliberately built it. That asymmetry is why this failure is so common in practice: the standard ML hygiene everyone knows about is precisely the hygiene that does not help.

A second contrast worth having ready, since the exam likes mechanism-attribution questions:

SymptomForgetting?More likely explanation
Model repeats training examples verbatim on unrelated promptsCo-occurringOverfitting from too many epochs
Model's target-task score is high, general QA dropped 15 pointsYesForgetting
Model was never able to do the task, before or afterNoCapability ceiling — 11-02
Model behaves oddly only in production, fine in evalNoTemplate mismatch or distribution shift
Model quality declined three months after a good launchNoDrift, or a stale index — 12-12
Model stopped refusing unsafe requests after a style fine-tuneYesForgetting of alignment behaviour
Model's answers went staleNoFrozen weights; a retrieval problem
04

Worked example: reading a before-and-after eval table

A team fine-tunes a general instruct model to produce their incident-report format. They hold a 120-item frozen eval set built in week one, deliberately covering more than the target task. All numbers below are a constructed scenario, not measurements.

The eval set composition:

text
Slice                        Items
────────────────────────────────────
S1  Incident-report format     40   ← the target task
S2  General knowledge QA       20   ← general-capability guard
S3  Summarisation              20   ← general-capability guard
S4  Structured JSON output     15   ← adjacent-capability guard
S5  Safety refusals            15   ← safety guard
S6  Non-English requests       10   ← general-capability guard
────────────────────────────────────
Total                         120

Run A — aggressive settings (high learning rate, 5 epochs, 900 examples, target task only):

text
Slice   Baseline   Run A    Delta     Verdict
──────────────────────────────────────────────────────
S1        16/40    36/40    +20       target achieved
S2        15/20     9/20     -6       significant regression
S3        14/20    10/20     -4       regression
S4        13/15    10/15     -3       regression
S5        15/15     9/15     -6       SAFETY REGRESSION
S6         7/10     2/10     -5       severe regression
──────────────────────────────────────────────────────
Overall   80/120   76/120    -4       net worse

Step 1 — compute the net effect. The target task gained 20 items. The rest of the set lost 24. Net: the model is worse overall by four items, while being much better at the one thing the team was watching.

text
Target gain      = +20 items
Non-target loss  = -(6+4+3+6+5) = -24 items
Net change       = -4 items over 120 → 66.7% → 63.3%

Step 2 — apply the safety veto. S5 fell from 15/15 to 9/15. That is not a trade-off to be weighed against a formatting win; it is a release blocker regardless of the net number, because the fine-tuning data contained zero unsafe examples and the capability was destroyed collaterally. Six items is a small absolute count, and 09-09 is the reason you should treat a small-sample safety signal as a prompt for a larger safety eval rather than as a precise estimate — but the direction is unambiguous and the correct response is to stop.

Step 3 — diagnose which lever caused it. The run used 5 epochs on 900 examples, target task only. Three of the four forgetting levers are pulled to maximum: narrow distribution, high learning rate, many epochs. The fourth — full-parameter training — is also at maximum.

Run B — conservative settings (lower learning rate, 2 epochs, the same 900 target examples mixed with 900 general instruction examples, LoRA rather than full fine-tuning):

text
Slice   Baseline   Run B    Delta     Verdict
──────────────────────────────────────────────────────
S1        16/40    31/40    +15       most of the target gain
S2        15/20    15/20      0       held
S3        14/20    13/20     -1       within noise
S4        13/15    13/15      0       held
S5        15/15    15/15      0       held
S6         7/10     7/10      0       held
──────────────────────────────────────────────────────
Overall   80/120   94/120   +14       net better

Step 4 — compare the runs on the only metric that matters.

text
             Target gain   Non-target loss   Net
Run A            +20            -24           -4
Run B            +15             -1          +14

Run A wins on the target metric and loses the project. Run B gives up 5 items of target gain — 25% of the available improvement — and delivers a model that is genuinely better. This is the central trade in fine-tuning practice, and the only reason the team can see it is that slices S2 through S6 existed before Run A.

Step 5 — note what would have happened without the baseline. With only S1 measured, Run A ships. The safety regression reaches users. The multilingual regression reaches users. And when a complaint arrives three weeks later — "it used to answer in Spanish" — there is no record to confirm it, no way to attribute it to the fine-tune, and no clean rollback decision. The eval harness is not documentation; it is the instrument.

05

Decision table: mitigating catastrophic forgetting

MitigationHow it worksCostWhen to use it
Baseline eval before the runRecords the comparison you cannot reconstruct laterHours, onceAlways. Non-negotiable
Broad eval slices, not just the targetPuts general and safety capability under measurementHours per sliceAlways. Include a safety slice on every fine-tune
Lower the learning rateSmaller steps stay nearer the pretrained configurationSlower convergenceFirst lever to try when forgetting appears
Fewer epochsFewer gradient steps toward the narrow targetLess target-task gainWhen the target metric saturates early
Mix in general instruction data (replay)Keeps a gradient signal pointing at the broad distributionLonger runs; data sourcingStandard practice for any narrow fine-tune
Parameter-efficient fine-tuning (LoRA/adapters)Most weights are frozen, so most capability cannot be overwrittenSlightly lower ceiling on some tasksDefault choice for most application fine-tunes — 11-05
Freeze lower layersProtects the general representations built early in the networkReduced adaptation capacityWhen the task is surface-level
Early stopping on a broad metricHalts before the general slices degradeRequires eval during trainingWhen you can afford mid-run evaluation
Keep the base model deployableLets you compare and revert in productionServing capacity for two modelsAny high-stakes deployment
External guardrailsA rail outside the weights is not degraded by a weight updateLatency, integrationAlways, for safety-relevant products — 13-02
Don't fine-tune at allNo weight change, no forgettingWhatever the alternative costsWhen RAG or prompting solves it — 11-08

The two rows to treat as defaults rather than options are the first and the sixth. Run the baseline. Use a parameter-efficient method unless you have a specific reason not to. Together they remove most of the practical risk from most application fine-tunes.

One more mitigation worth naming because the exam might: serving a LoRA adapter that can be detached gives you something no full fine-tune offers — the ability to turn the adaptation off. If a regression appears in production, you unload the adapter and the base model's behaviour returns exactly. A full fine-tune's equivalent is redeploying a different multi-gigabyte checkpoint.

06

Why catastrophic forgetting is on the NCA-GENL exam

The NCA-GENL blueprint asks the associate to assist in deployment and evaluation of model scalability, performance, and reliability under senior supervision, and to be familiar with machine-learning fundamentals including model comparison. It also asks for monitoring the functioning of experiments and other software processes. Catastrophic forgetting is the named ML-fundamentals failure mode that most directly connects "we trained a model" to "we broke reliability," which is why it is a legitimate associate-level item rather than a research curiosity.

It also anchors the exam's most transferable habit: compare against a baseline. Questions about model comparison, evaluation discipline, and regression are all served by knowing that an unmeasured capability cannot be defended.

Question phrasings to expect:

  • "After fine-tuning a model on a customer-support dataset, the team notices it performs worse on general-knowledge questions. What is the most likely cause?" — catastrophic forgetting.
  • "What is the most effective way to detect catastrophic forgetting?" — evaluate on the original tasks before and after the fine-tune.
  • "Which technique reduces the risk of catastrophic forgetting during fine-tuning?" — parameter-efficient fine-tuning, lower learning rate, fewer epochs, mixing general data.
  • "A team's validation loss on the fine-tuning dataset is low, yet users report degraded capability. Why did validation not catch it?" — the validation split is drawn from the same narrow distribution.
  • "Which of these is NOT a symptom of catastrophic forgetting?" — stale facts, or an inability the model never had.
  • "Why does a model stop refusing unsafe requests after an unrelated fine-tune?" — alignment behaviour is a thin late-stage layer and is displaced by further training.

Distractor families:

DistractorWhy it attractsWhy it is wrong
"Overfitting" for a general-capability regressionBoth are training failures with declining qualityOverfitting is failure within the task's distribution; forgetting is degradation outside it
"Use a larger validation split of the fine-tuning data"Sounds like more evaluationSame distribution, so structurally blind to forgetting
"Data drift" or "concept drift"Real terms, also about degradationDrift is a production-time change in the world; forgetting is caused by your own training run
"Increase the learning rate to help the model adapt"Frames adaptation as the goalLarger steps make forgetting worse, not better
"Train for more epochs so the model relearns the old tasks"Feels like more training must helpThe old tasks are not in the data; more epochs deepens the damage
"Quantisation caused the regression"Precision changes can cost accuracyA different mechanism entirely — 12-02. Forgetting happens at training time
"It is unavoidable when fine-tuning"Sounds appropriately humbleIt is manageable: PEFT, replay data, lower LR, and early stopping all reduce it substantially
"Fine-tune on the general tasks afterwards to restore them"Superficially symmetricalSequential fine-tuning is the mechanism that causes forgetting; mixing data in one run is the fix

That last distractor is a good one to reason through, because it exposes the mechanism. Forgetting is caused by sequential training on disjoint distributions. Fixing a forgetting problem by adding another sequential stage just moves the damage. The reason mixed (replay) data works and sequential retraining does not is that mixing puts both distributions in the same gradient computation.

07

Common mistakes with catastrophic forgetting

MistakeSymptomCauseFix
No baseline eval before the fine-tuneCannot tell degradation from absence of abilityEval built after the run, or only for the target taskFreeze a broad eval set first and record its scores — 01-08
Eval set covers only the target taskTarget improves; product gets worseSlices were scoped to the fine-tune's goalAdd general, adjacent, and safety slices; keep them frozen
Relying on the fine-tuning validation splitValidation looks perfect; users disagreeSame distribution as training, so blind by constructionKeep a separately-sourced general slice
Aggressive learning rate and epoch countBig target gain, big collateral lossMaximum distribution pullReduce both; sweep learning rate before epochs
Full-parameter fine-tune when PEFT would doLarger regression surface than necessaryDefault assumption that more trainable parameters is betterUse LoRA/adapters by default — 11-05
No safety slice on a "purely stylistic" fine-tuneRefusal behaviour degrades unnoticedAssumption that unrelated data cannot cause unrelated damageEvery weight change gets a safety re-run, plus external rails
Shipping on a single aggregate scoreA -6 safety regression hidden inside a +14 overall gainAggregation destroys slice-level signalReport per-slice deltas and veto on safety rows
Sequential fine-tuning to recover lost tasksEach stage fixes one thing and breaks anotherThe cause is sequential disjoint trainingMix the distributions into one run
Discarding the base model after deploymentNo comparison, no rollbackTreating the fine-tune as a replacementKeep the base deployable; prefer detachable adapters
Fine-tuning again on top of a fine-tune, repeatedlySlow, compounding capability loss across releasesEach release inherits the last one's damageRe-fine-tune from the original base with the merged dataset

That last row is a real operational trap. Teams that treat each release as "fine-tune the current production model again" accumulate forgetting across releases, and because each individual step is small the regression is never large enough to trigger an investigation. Re-training from the pristine base with a merged dataset resets the accumulation.

08

How do you detect catastrophic forgetting?

By evaluating the model on capabilities the fine-tuning data does not cover, before and after the training run, and comparing per slice. There is no other reliable detector, and the ordering is the whole point: after the fact, a missing capability and a never-present capability look identical.

Concretely, the detection procedure is:

  1. Before the run, score a frozen eval set that includes the target task plus general-capability, adjacent-capability, and safety slices. Store the per-slice numbers and the model version.
  2. Run the fine-tune.
  3. Re-score the identical set with the identical harness and decoding settings — temperature, top-p, and max tokens all held fixed, because changing them changes the numbers independently of the weights (09-11).
  4. Compare per slice, never in aggregate. An aggregate score can hide a large regression inside a large gain.
  5. Apply veto rules. Safety and compliance slices get a hard veto, not a weighted trade-off.
  6. Record the comparison as an artifact so the next release has a baseline too.

Steps 1 and 3 are the ones people skip and the ones that carry the value. Step 6 is what turns this from a one-off check into the regression suite 10-04 describes — and once it is in CI, forgetting becomes a build failure rather than a discovery.

09

Does LoRA prevent catastrophic forgetting?

It reduces exposure substantially rather than preventing it outright, and the reason is structural: in a LoRA fine-tune the original weights are frozen and only small low-rank matrices are trained. The pretrained configuration that encoded the model's general capability is still physically present and unmodified, so the mechanism that causes forgetting — overwriting those weights — cannot operate on them.

What remains is that the adapter's output is added to the frozen layer's output, so it can still shift behaviour enough to suppress an existing capability. A strongly-trained adapter with a large effective contribution can degrade general behaviour even though nothing was overwritten. So the honest statement is: LoRA makes forgetting much less likely and much less severe, and it does not license skipping the baseline eval.

Two properties of LoRA that matter specifically here, both of which 11-05 develops:

  • Reversibility. Because the base weights are untouched, detaching the adapter restores the original model exactly. That is a genuine rollback, not a re-deployment.
  • Bounded damage. If a small fraction of the effective parameter count can move, the achievable magnitude of collateral change is smaller than in a full fine-tune. This is a qualitative argument from the method's structure, not a measured claim about how much smaller.

The general principle is worth stating plainly because it recurs across the module: the fewer weights you allow to move, the less capability you can accidentally destroy. That is a reason to prefer the lowest rung of the customisation ladder that solves your problem, quite separately from the cost argument.

10

Can you recover a model that has catastrophically forgotten?

Yes, but almost always by going back rather than forward. The reliable move is to discard the damaged checkpoint and re-run from the original base model with better settings — lower learning rate, fewer epochs, replay data mixed in, a parameter-efficient method. Training is cheap relative to the cost of shipping a regression, and you already have the diagnostic table telling you which lever to pull.

The unreliable move is to try to repair the damaged model by training it further on the lost capabilities. This sometimes helps and frequently trades one regression for another, because it is another sequential stage on another disjoint distribution — the same mechanism that caused the problem. If you must do it, the data should be mixed with the target task rather than presented alone.

Two operational habits make recovery cheap:

  • Keep checkpoints. A run you cannot revert is a run you cannot afford to be aggressive with. Checkpointing discipline is part of 12-04.
  • Prefer detachable adapters over merged weights in any environment where you might need to roll back under time pressure.

And note the shape of the fix in the worked example above: Run B did not repair Run A. It replaced it, from the base, with different settings. That is the pattern.

Glossary recap: the terms this lesson introduced

TermDefinition
Catastrophic forgettingLoss of previously learned capability when a network is trained on new data; also catastrophic interference
General capabilityThe broad set of abilities a model had before your fine-tune, most of which your training data never mentions
Baseline eval runPer-slice scores recorded before a weight change; the only reliable forgetting detector
Eval sliceA subset of the eval set covering one capability, so regressions can be attributed rather than averaged away
General-capability guard sliceAn eval slice deliberately unrelated to the fine-tuning task, held to catch collateral damage
Safety sliceEval items testing refusal and harm-avoidance behaviour; gets a hard veto, not a weighted trade-off
Replay data / data mixingIncluding general instruction data in the fine-tuning set so both distributions appear in the same gradient step
Layer freezingHolding lower layers fixed to protect the general representations built early in the network
Alignment fragilityThe tendency of late-stage safety behaviour to degrade easily, because it was installed by a small amount of training
Detachable adapterA LoRA-style module that can be unloaded to restore the base model's behaviour exactly
Sequential fine-tuningTraining on disjoint distributions one after another — the mechanism that produces forgetting
Regression suiteAn automated eval run that fails a build when a capability degrades

Key takeaways on catastrophic forgetting when fine-tuning

  • Catastrophic forgetting is capability loss caused by your own training run, on axes your training data never touched. The target metric improves while unmeasured abilities degrade.
  • Your fine-tuning validation split cannot detect it. It is drawn from the same narrow distribution, so it is blind by construction. This is the single most important structural fact in the lesson.
  • Only a pre-fine-tune baseline on broad slices catches it. After the run, a lost capability and an absent capability are indistinguishable from the evidence.
  • Four levers control severity: how narrow your data is, the learning rate, the number of epochs, and how many parameters are trainable. All four are yours to set.
  • Safety and refusal behaviour is the most fragile capability, because it was installed late by a small amount of training. Every fine-tune, however stylistic, is a safety-relevant change.
  • Report per slice, never in aggregate, and give safety slices a hard veto rather than a trade-off weight.
  • Parameter-efficient fine-tuning reduces exposure structurally — frozen weights cannot be overwritten — and gives you a real rollback by detaching the adapter. It does not remove the need for the baseline.
  • Recover by re-running from the base, not by training the damaged model further. Sequential stages on disjoint data are the cause, not the cure.
  • Forgetting is not overfitting, not distribution shift, and not drift. Distinguish by asking what degraded relative to what, and when.

Next: GPU memory requirements for training an LLM

You now know how to tell whether a fine-tune helped, and how to avoid destroying the model while running one. What you do not yet know is whether the run will even start. Training a model needs room for far more than its weights — gradients, optimizer state, and activations all have to fit in the same device memory — and the naive arithmetic for a 7-billion-parameter model produces a number that no consumer GPU and few cloud instances can satisfy. Next: 11-04 computes that number from first principles, shows exactly which term dominates, and sets up the gap that parameter-efficient fine-tuning exists to close.