Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 2 of 9 in this unit

Build AI Systems · SOURCE LESSON 18

Learn something new without losing the old.

Train a shared neural network on two tasks, measure forgetting, and compare replay with a parameter-change penalty.

By the end: Explain interference between shared weights, compare retention and new learning, and distinguish replay, regularization, modularity, and memory.

Start with the exampleJump to the experimentRead the explanation
Prerequisites and path options

Why learn this? Protect an existing skill while teaching a model a new one, using explicit checks for regressions.

01 · TRY

Start with something concrete.

Learning a new keyboard layout can interfere with familiar typing habits. A neural network can have a similar problem: changing shared parameters to improve a new task can damage an older behavior.

Try the interactive model
02 · PREDICT
Before you experiment

Task B’s training loss falls. What does this tell you about task A?

Task B’s training loss falls. What does this tell you about task A?
03 · EXPERIMENT

Change one thing. Watch what follows.

Loading this browser experiment…

04 · UNDERSTAND
READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Explain interference between shared weights, compare retention and new learning, and distinguish replay, regularization, modularity, and memory.

The idea in everyday terms

Learning a new task changes shared weights. Those changes can damage an older task even when the two tasks are both representable. The new examples do not automatically remind the model of everything it learned before.

What to watch in the experiment

Replay mixes old examples into later training. Anchoring discourages changes away from earlier weights. Compare the old-task and new-task errors together under the same training budget; protecting one task can slow improvement on another.

What this does not establish

Neither replay nor anchoring guarantees that every old skill survives. The lab uses controlled tasks, so its comparisons do not establish broad continual-learning ability.

Open the full worked examples, calculations and limitations

This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.

Shared weights can support several skills

Catastrophic forgetting occurs when learning new tasks substantially damages earlier capabilities. The new gradient optimizes the examples it sees; it does not automatically preserve behaviors absent from that training batch.

Our two tasks occupy different input regions. A labels left-side points by whether y is positive. B labels right-side points by whether y is negative. A nonlinear network can represent both rules together. They are not contradictory labels for identical inputs, so poor retention need not be an unavoidable conflict in the task definition.

Train A, save the checkpoint, and then train B. Compare both independently sampled evaluation sets after each stage. B’s improvement can coincide with A’s collapse. Inspecting only the latest task would hide the regression.

A local way to understand interference

For a small parameter change, the old loss changes approximately by the old gradient dotted with that parameter change:

ΔLA≈∇θLA⋅Δθ\Delta L_A\approx\nabla_\theta L_A\cdot\Delta\theta

If a B update moves in a direction that increases A’s loss, interference occurs. The walkthrough calculates this approximation and compares it with the actual one-step change on A’s training examples. It does not use evaluation examples to choose gradients. A first-order approximation can differ from the exact change when curvature or step size matters.

Replay preserves experience

Replay includes old examples in new training. The old gradients can then influence shared parameters instead of disappearing from the objective. In the lab, replay uses 32 stored A examples and 32 B examples per update. New-only training uses 64 B examples. Both process 64 examples, but their exposure to B differs; state that tradeoff when comparing them.

Representative memory matters. A replay buffer that omits rare old cases may fail to protect them. Storing all prior data can be expensive or inappropriate, and no fixed buffer guarantees indefinite retention. Measure old and new performance separately rather than hiding one behind an average.

Penalties and modular updates

A parameter-change penalty discourages moving away from an earlier solution. Our anchor strategy pulls every parameter toward the A checkpoint with the same coefficient. Stronger protection can also make learning B harder. This is a simple regularizer, not full Elastic Weight Consolidation (EWC).

EWC weights the penalty using estimates of which parameters mattered to prior tasks. Its importance estimates and assumptions can be imperfect. Modularity takes another approach: isolate some updates in specialists or adapters while freezing shared parts. The source’s chess-and-Go example uses separate adapters over a shared frozen backbone to reduce interference. Isolation also limits what can be shared or improved jointly.

None of these methods removes genuine contradictions or unlimited capacity demands. The separate scalar example makes that limit explicit:

WeightOld loss (w − 2)²New loss (w + 2)²
2016
044
−2160

Equal replay favors a compromise at zero, with average loss four. It cannot make one scalar equal to both two and minus two.

Remembering need not mean updating weights

An agent can update working state during inference, store an episode between tasks, and train its neural components later. These are different timescales. New library API details might belong in a retrievable knowledge record; a repeated debugging skill might eventually justify parameter training.

External memory can store new facts without immediately altering model weights, though retrieval and outdated records create their own problems. Deciding what to store, retrieve, consolidate, or forget is part of the system design. We will explore that directly in the memory module.

05 · APPLY
Check your understanding

For old loss (w−2)² and new loss (w+2)², what are the losses at w = 0?

For old loss (w−2)² and new loss (w+2)², what are the losses at w = 0?
06 · CONTINUE

Take this idea with you.

Measure old and new behavior after updates. Replay, penalties, and modularity can reduce interference, while external memory can store some new information without changing weights.

My Learning
Explore related topics and the topic map

How this topic connects

Explore this topic on the interactive map

Use these connections to review a foundation or choose where to go next. You can open any topic without completing the others.

What it builds on

  • Backpropagation

    Trace a wrong update to its source so you can debug learning code and distinguish calculating gradients from changing weights.

  • Classifier project

    Use the classifier workbench to connect fitted parameters, predictions and separate evaluation examples before extending the experiment.

  • Promotion gates

    Build practice loops that reward correct results instead of letting a weak checker reinforce mistakes.

You are hereLearn something new without losing the old

Train a shared neural network on two tasks, measure forgetting, and compare replay with a parameter-change penalty.

What it enables

Show 1 more connections