# Overcoming catastrophic forgetting in neural networks

EWC lets neural networks learn new tasks without forgetting old ones

James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu and 8 more · arXiv · 2016-12-2

- **Problem** Neural networks trained on tasks in sequence overwrite the weights that earlier tasks depend on, so old skills drop off abruptly.
- **Method** EWC adds a penalty for each weight that holds it near its old value, scaled by how much the earlier task needs it.
- **Results** With EWC, the agent learned multiple Atari games in sequence, while plain gradient descent never learned more than one, keeping its human-normalized total below one.

## Why sequential training erases old tasks

Continual learning asks an agent to learn consecutive tasks without losing how to perform the earlier ones. A neural network trained on task B changes the weights that task A relied on, so task A's performance drops abruptly. This is catastrophic forgetting, and it appears when the network is trained on several tasks in sequence.

Multitask training avoids the problem by mixing data from all tasks, but it needs the earlier data to be stored and replayed. The replay memory then grows with the number of tasks, which the authors call impractical for large task sets. Brains seem to avoid the problem through synaptic consolidation, where strengthened synapses are made less plastic.

## A consolidation idea for network weights

The key idea is to give each weight a stiffness that reflects how much the earlier task needs it. Weights that matter little to task A stay free to move, so task B can use them. This works because a network with many parameters usually has many settings that solve task A, so a nearby setting may also solve task B.

The authors start from Bayes' rule, where the posterior over parameters after task A carries what task A needed. When the data split into task A and task B, the loss for task B is the only term that changes during training on task B. The true posterior is intractable, so the authors use a Laplace approximation: a Gaussian centred on the task A solution, with a diagonal precision taken from the Fisher information matrix.

Figure 1 shows why a per-weight stiffness is needed, since a single coefficient for every weight blocks learning of task B.

## How the EWC loss is formed

Training on task B minimises the task B loss plus one quadratic term for each parameter. The loss is \\\[L(\\theta)=L\_B(\\theta)+\\sum\_i \\frac{\\lambda}{2}F\_i(\\theta\_i-\\theta^\*\_{A,i})^2\\\], where L\_B is the task B loss, theta\*\_A are the parameters after task A, and F\_i is the diagonal Fisher entry for parameter i. The scalar lambda sets how much the old task counts compared with the new one.

Its diagonal can be computed from first-order derivatives alone, which keeps the cost low even for large models. When a third task arrives, the penalties for tasks A and B simply add up, so the weights stay near both earlier solutions.

## Permuted MNIST results

Each task applied a fixed random permutation to the input pixels of MNIST digits, so every task was as hard as MNIST but needed its own solution. Training used shuffled small batches, and after a fixed amount of training on a task the authors stopped using that task's data. Plain SGD forgot the first permutation as soon as training switched to the second.

An L2 penalty protected task A more gently, but it treated every weight equally and left too little capacity to learn task B. EWC instead weighted each weight by its importance to task A, so the network learned task B without forgetting task A. Figure 2A shows three permutations, A, B and C, trained with EWC, L2 and plain SGD.

Earlier attempts with careful hyperparameter choices reached reasonable results on only up to two random permutations. Compared with SGD plus dropout, the authors found dropout did not scale to more tasks.

## Do tasks share weights?

The authors measured the overlap between pairs of tasks' Fisher information matrices. A small overlap means the two tasks depend on different weights, while a large overlap means the weights serve both tasks. Two MNIST versions that differ in only an 8x8 pixel square share weights throughout the network.

When the permuted square grows to 26x26 pixels, the tasks begin to use separate weights in the early layers. Layers closer to the output are still reused, because the input changes but the class labels stay the same.

## Running EWC inside a DQN agent

The authors start from a DQN agent similar to the one in van Hasselt et al., with a larger network, a smaller transition table and task-specific biases and gains at each layer. A new generative model is added when it explains recent data better than the existing ones, using a procedure inspired by forget me not.

The Fisher information matrix is computed at each task switch, and each task adds a penalty anchored at the current parameter values. The penalty is scaled by lambda and applies only to games that have been played for at least 20 million frames. Experience replay gets a separate short-term buffer for each inferred task, so short-timescale learning stays local while EWC handles the longer timescale.

## Atari sequence results

Each experiment used ten games chosen at random from those DQN plays at human level or above. Scores are the total human-normalized score over the ten games, with each game clipped to 1.

The authors report that plain gradient descent never learned more than one game, so its total stayed below one. With EWC, the agents did learn to play multiple games in sequence. Giving the agent the true task labels helped only modestly compared with using labels inferred by forget me not.

## Are the Fisher-based importance estimates reliable?

The authors trained a single-game DQN on Breakout and added noise to its weights. The noise was drawn with uniform covariance, with the inverse Fisher, or within the nullspace of the Fisher. Each evaluation ran ten full game episodes, with a new random perturbation at every timestep.

Inverse-Fisher perturbations hurt the score less than uniform ones, which supports the diagonal Fisher as an importance estimate. Nullspace perturbations should have had no effect under the approximation, yet they behaved like inverse-Fisher perturbations. The authors read this as over-confidence about parameters that are unimportant, so the approximation likely under-estimates uncertainty.

The EWC agent falls short of the score that ten separately trained DQNs would reach. The authors suspect the Fisher approximation of parameter uncertainty is the main reason.

## Limitations

The posterior variance comes from a point estimate, which the authors call a significant weakness. They suggest Bayesian neural networks might give a better local estimate. The posterior is approximated as a factorised Gaussian, which keeps the computation cheap.

Each synapse needs three stored values under EWC: the weight, its variance and its mean. The experiments cover permuted MNIST and Atari sets of ten games, and no other task families were tested.

## Paper info

- **Authors**: James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, Raia Hadsell
- **Venue**: arXiv · Preprint
- **First published**: 2016-12-2
- **Added**: 2026-11-11
- **Updated**: 2017-1-25
- **Version**: v2
- **arXiv**: 1612.00796
- **DOI**: 10.1073/pnas.1611835114
- **Category**: cs.LG · cs.AI · stat.ML
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1612.00796v2) · [PDF ↗](https://arxiv.org/pdf/1612.00796v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, Raia Hadsell (2016). Overcoming catastrophic forgetting in neural networks. arXiv:1612.00796v2. https://doi.org/10.1073/pnas.1611835114

**BibTeX**

```
@article{kirkpatrick2016overcoming,
  title = {{Overcoming catastrophic forgetting in neural networks}},
  author = {James Kirkpatrick and Razvan Pascanu and Neil Rabinowitz and Joel Veness and Guillaume Desjardins and Andrei A. Rusu and Kieran Milan and John Quan and Tiago Ramalho and Agnieszka Grabska-Barwinska and Demis Hassabis and Claudia Clopath and Dharshan Kumaran and Raia Hadsell},
  year = {2016},
  eprint = {1612.00796},
  archivePrefix = {arXiv},
  doi = {10.1073/pnas.1611835114},
  url = {https://arxiv.org/abs/1612.00796v2}
}
```

## Other paper commentary

- [Wide Residual Networks](https://refivu.com/en/papers/1bd6014c-67f5-4e80-9e66-e667155a3f6e-wide-residual-networks.md)
- [Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising](https://refivu.com/en/papers/42b88b1a-7986-4ec5-b7e5-406b2cec7f9e-beyond-a-gaussian-denoiser-residual-learning-of-deep.md)
- [Towards Evaluating the Robustness of Neural Networks](https://refivu.com/en/papers/6d9ac642-a922-416e-871a-f2ef8022e354-towards-evaluating-the-robustness-of-neural-networks.md)
- [Attention U-Net: Learning Where to Look for the Pancreas](https://refivu.com/en/papers/b480e08e-027d-4c11-b1c5-0d3a4a63ead9-attention-u-net-learning-where-to-look-for.md)
- [node2vec: Scalable Feature Learning for Networks](https://refivu.com/en/papers/dc0725e4-ec21-4d60-9363-0eac2fc69a10-node2vec-scalable-feature-learning-for-networks.md)
- [Explainable Artificial Intelligence (XAI): Concepts, Taxonomies, Opportunities and Challenges toward Responsible AI](https://refivu.com/en/papers/3f686a20-03db-4642-80bb-f85fafc1d04f-explainable-artificial-intelligence-xai-concepts-taxonomies.md)
- [GPT-4o System Card](https://refivu.com/en/papers/7f73de51-bae5-43e2-85f2-6decfe19e7c4-gpt-4o-system-card.md)
- [An overview of gradient descent optimization algorithms](https://refivu.com/en/papers/96d69873-e1ce-41dd-9333-645272090396-an-overview-of-gradient-descent-optimization-algorithms.md)
- [GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium](https://refivu.com/en/papers/e19fb2a4-2e7f-47ba-9ba7-ba5660b1efb6-gans-trained-by-a-two-time-scale-update.md)
- [Multi-Scale Context Aggregation by Dilated Convolutions](https://refivu.com/en/papers/d3d006c0-f6b8-44aa-adba-a3ef2b601bbf-multi-scale-context-aggregation-by-dilated-convolutions.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [stochastic gradient descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [reinforcement learning](https://refivu.com/en/terms/6c51042515d2-reinforcement-learning)
- [catastrophic forgetting](https://refivu.com/en/terms/0039a430b4e3-catastrophic-forgetting)
- [experience replay](https://refivu.com/en/terms/5ee9a599e6c6-experience-replay)
- [L2 regularization](https://refivu.com/en/terms/60e7f644f7c5-l2-regularization)
- [Fisher information matrix](https://refivu.com/en/terms/805248ff459f-fisher-information-matrix)
- [Atari 2600](https://refivu.com/en/terms/529ac229bf48-atari-2600)
- [dropout regularization](https://refivu.com/en/terms/6e95c9111eca-dropout-regularization)
- [hidden Markov model](https://refivu.com/en/terms/5d4b4c1c6819-hidden-markov-model)
- [human-normalized score](https://refivu.com/en/terms/fc3568b3e76f-human-normalized-score)
- [elastic weight consolidation](https://refivu.com/en/terms/4d375a470ed6-elastic-weight-consolidation)
- [Laplace approximation](https://refivu.com/en/terms/1c5026663f86-laplace-approximation)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e39e1a97-7b59-4a3d-95cd-a82be4c40f43-overcoming-catastrophic-forgetting-in-neural-networks)
