← All posts

July 9, 2026

What Is Catastrophic Forgetting in Fine-Tuning and How Do You Prevent It

Fine-tuning on a narrow task can quietly degrade everything the base model used to do well. The model gets better at your task and worse at everything else. Here is what causes it, how to detect it, and how to prevent it before it ruins your model.

TL;DR

Catastrophic forgetting is what happens when fine-tuning on a narrow task causes a model to lose capabilities it had before training. The model improves on your specific task while quietly degrading on general language understanding, reasoning, instruction following, or other behaviors that were not represented in your training data. This post explains what causes catastrophic forgetting, how to detect it before you ship a broken model, and the specific techniques that prevent it.

You fine-tune a model on customer support conversations. The results look great. It handles your specific product questions well. The tone is right. The format is consistent.

Then someone uses it for something slightly outside your training distribution. Maybe a user asks a general question. Or the model needs to reason through a multi-step problem. And it falls apart. Not slightly. Badly.

What happened?

The fine-tuning worked. And that is exactly the problem.

What Catastrophic Forgetting Actually Is

Catastrophic forgetting is not a bug in the software. It is a fundamental property of how neural networks learn.

When you fine-tune a model, gradient updates move the weights in a direction that reduces loss on your training data. That is good. But those same updates can also move the weights away from configurations that supported other capabilities the model had before training.

Think of it this way. The model's weights encode a huge amount of knowledge and capability from pre-training. That knowledge is stored in the specific configuration of billions of numbers. When fine-tuning pushes those numbers in a specific direction for your task, it can inadvertently push them away from configurations that supported unrelated capabilities.

The more aggressive the fine-tuning, the higher the learning rate, the more epochs, the narrower the training data, the more likely it is to overwrite capabilities the base model had.

What Gets Affected

Catastrophic forgetting does not erase all capabilities equally. Some things are more vulnerable than others.

General reasoning and instruction following. If your fine-tuning data does not include diverse instruction types, the model can lose its ability to follow instructions it was not specifically trained on. A model fine-tuned only on short Q&A pairs may struggle with multi-step tasks that require holding context across several reasoning steps.

Language quality and coherence. Aggressive fine-tuning on low-quality data can degrade the model's writing quality. The model starts producing outputs that are grammatically correct but lack the coherence and nuance of the base model.

Knowledge outside your training domain. A model fine-tuned heavily on medical text may start getting basic general knowledge questions wrong that the base model handled correctly.

Refusals and safety behaviors. Fine-tuning can inadvertently reduce the model's tendency to decline harmful requests if your training data does not include examples of appropriate refusals.

How to Detect It

The most reliable detection method is a general capability test suite that you run on every checkpoint.

Before you start fine-tuning, build a small set of test inputs that cover capabilities you want to preserve. Include things like:

  • General instruction following on tasks unrelated to your fine-tune
  • Multi-step reasoning questions
  • A few examples of appropriate refusals or boundaries
  • Basic factual questions the base model handles well

Run these same inputs against the base model before training and record the outputs. Then run them against each of your trained checkpoints. Compare directly.

You do not need a large test set for this. Twenty to fifty carefully chosen examples is enough to catch significant forgetting. You are looking for pattern-level degradation, not individual failures.

from transformers import AutoModelForCausalLM, AutoTokenizer
import json

def evaluate_model(model, tokenizer, test_prompts):
    results = []
    for prompt in test_prompts:
        inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
        outputs = model.generate(**inputs, max_new_tokens=200)
        response = tokenizer.decode(outputs[0], skip_special_tokens=True)
        results.append({"prompt": prompt, "response": response})
    return results

# Run on base model before fine-tuning
base_results = evaluate_model(base_model, tokenizer, test_prompts)

# Run on fine-tuned model after training
finetuned_results = evaluate_model(finetuned_model, tokenizer, test_prompts)

# Save both for comparison
with open("capability_comparison.json", "w") as f:
    json.dump({"base": base_results, "finetuned": finetuned_results}, f, indent=2)

Look through the outputs side by side. If the fine-tuned model's responses to general prompts are noticeably worse than the base model's, you have forgetting.

The Main Causes and Their Fixes

Cause one: too many epochs on a narrow dataset.

Training for 5 or 10 epochs on a small, narrow dataset is the most common cause of catastrophic forgetting. The model has seen the same narrow examples so many times that it has over-specialized. Early in training it was learning your task. By epoch 8 it was overwriting general capabilities.

Fix: reduce the number of epochs. For most fine-tuning tasks, 1 to 3 epochs is sufficient. The model does not need to see every example 10 times to learn the behavior. More epochs on a narrow dataset means more forgetting, not better results.

Cause two: learning rate too high.

A high learning rate makes large updates to the weights on every step. Large updates mean faster learning but also faster forgetting. The model moves aggressively toward your training distribution and away from everything else.

Fix: reduce the learning rate. If you are seeing forgetting symptoms, try halving your learning rate before reducing epochs. A smaller learning rate means smaller steps that are less likely to overwrite distant capabilities.

Cause three: training data that is too narrow.

If every training example is from the same narrow domain with the same tone, the same format, and the same type of input, the model over-learns that specific pattern. It becomes very good at one thing and loses flexibility everywhere else.

Fix: add diversity to your training data. Include examples from adjacent domains, different input phrasings, and different output styles that still align with your goal. The diversity teaches the model to generalize rather than memorize.

Cause four: no general examples in the training mix.

This is the specific fix for instruction-following degradation. Adding a small percentage of general instruction-following examples to your fine-tuning dataset, roughly 10 to 20 percent of your total data, gives the model a signal to maintain its general capabilities while still learning your task.

These general examples do not need to be related to your domain. Public datasets like Alpaca, OpenHermes, or ShareGPT contain diverse instruction-following examples you can mix in. The goal is to remind the model during training that general instructions still matter.

datasets:
- path: your_custom_data.jsonl
type: alpaca
- path: tatsu-lab/alpaca # general instruction examples
type: alpaca
ds_type: json
split: train[:10%] # use 10% of alpaca for diversity

Does LoRA Reduce Catastrophic Forgetting

Yes, meaningfully.

Full fine-tuning updates all the model's weights. Every capability the model had is at risk of being overwritten. LoRA only updates the adapter parameters. The base model weights are frozen.

This means the representations learned during pre-training are fully preserved in the frozen base model. The adapter adds behavior on top without modifying what is underneath. In practice, LoRA models show significantly less catastrophic forgetting than full fine-tuning at the same learning rate and epoch count.

This is one of the practical reasons to prefer LoRA beyond the memory savings. You are building on top of the base model rather than rewriting it.

That said, LoRA does not eliminate forgetting entirely. At high learning rates, many epochs, or very narrow datasets, LoRA models can still show degraded general capabilities. The mechanisms above apply to LoRA too. They are just less severe.

The Simple Prevention Checklist

Before every fine-tuning run, confirm these four things:

One: epochs are set to 3 or fewer for a narrow task. Two: learning rate is 2e-4 or lower. Three: training data includes at least 10 to 20 percent general instruction-following examples. Four: you have a baseline evaluation set to compare against after training.

And after training, run your capability comparison before declaring the model ready. Forgetting that is caught before deployment is a config fix. Forgetting that is caught in production is a much bigger problem.