HomeArticlesComputer Science

Elastic Weight Consolidation

Elastic Weight Consolidation is a clever technique in machine learning that helps AI models learn new things without losing their memory of what they already know.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

Elastic Weight Consolidation

Elastic weight consolidation (EWC) is a technique used in machine learning to prevent catastrophic forgetting. This means that when a model learns a new task, it doesn't completely forget what it learned before.

Essentially, EWC adds a penalty term to the loss function that discourages large changes to the important weights of the neural network. These ‘important’ weights are identified using information about how much each weight contributes to the overall performance.

Diagonal Approximation

The core idea behind EWC is to approximate the Fisher Information Matrix, which measures the sensitivity of the loss function to changes in the weights. Calculating this matrix exactly can be computationally expensive.

Instead, a diagonal approximation is used – essentially treating each weight independently and assuming they are uncorrelated. This simplification allows for efficient computation while still capturing the essential information about weight importance.

live demo · related simulation● LIVE

EWC Loss

The EWC loss combines two key components: a standard loss function that measures the error on the current task, and the elastic penalty term. This penalty is proportional to the Fisher Information Matrix of the weights.

This combined loss ensures that the model learns effectively while simultaneously protecting its previously learned knowledge. It’s a crucial element in continual learning and adaptive systems.

Frequently asked questions

What is elastic weight consolidation?

Elastic Weight Consolidation (EWC) is a method used to prevent catastrophic forgetting in machine learning models by adding a penalty term to the loss function that discourages large changes to important weights.

How does EWC work to avoid forgetting?

EWC estimates the importance of each weight in the neural network and applies an elastic penalty based on this estimate, preventing drastic changes during learning new tasks that could erase previously learned knowledge.

Why is diagonal approximation used instead of the full Fisher Information Matrix?

Calculating the full Fisher Information Matrix can be computationally very demanding. The diagonal approximation provides a faster, approximate solution while still effectively capturing the key information needed for EWC.

Try it live

Everything above runs in your browser — open Hash Function Avalanche Visualizer and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Hash Function Avalanche Visualizer simulation

What did you find?

Add reproduction steps (optional)