Exercises — Continual and lifelong learning
This page tests the machinery of catastrophic forgetting, regularization-based methods, replay, and architecture methods. A few problems are geometric — look at the chalkboard figures as you read.
Level 1 — Recognition
Goal: can you name the pieces and read the notation?
L1.1 — Reading the forgetting metric
We write = the accuracy on task measured after the model has finished training through task . So means "how well does the final-ish model (trained up to task 3) still do on task 1?"
Given this table:
| Acc on Task 1 | Acc on Task 2 | Acc on Task 3 | |
|---|---|---|---|
| after Task 1 | 0.90 | — | — |
| after Task 2 | 0.72 | 0.88 | — |
| after Task 3 | 0.60 | 0.75 | 0.85 |
Compute the backward transfer on task 1, defined as with final task , task index .
Recall Solution
compares the final accuracy on task 1 to the accuracy on task 1 right when it was learned ().
- (bottom-left cell: task 1 accuracy after all training).
- (top-left cell).
Negative means the model got worse on task 1 — it forgot. The magnitude says it lost 30 percentage points.
L1.2 — Which family is which?
Match each one-line description to its family: Regularization-based, Replay-based, or Architecture-based.
(a) "Freeze old columns, add a new column with lateral connections for the new task." (b) "Penalize moving weights that had high Fisher information on the old task." (c) "Keep 500 old examples in a buffer and mix them into new mini-batches."
Recall Solution
- (a) → Architecture-based (this is Progressive Neural Networks — see Neural Architecture Search for the design-space idea). Old parameters never updated ⇒ zero forgetting by construction.
- (b) → Regularization-based (Elastic Weight Consolidation, EWC). The Fisher information measures how sharply the log-likelihood changes when you nudge weight ; high = important weight to protect.
- (c) → Replay-based (Experience Replay). Related to Online Learning streams and biologically to hippocampal replay.
Level 2 — Application
Goal: plug numbers into the formulas correctly.
L2.1 — Fisher information for logistic regression
For a logistic-regression head, the Fisher information of weight is
where is the model's predicted probability for example , and is feature of example . Here is the sigmoid (squashes any number into ), and is largest () when the model is maximally uncertain ().
Suppose task 1 has examples, average , mean-square feature values and . Compute and .
Recall Solution
Because we're using averages, the sum .
Reading it: , so weight 1 is roughly more "important" for task 1. EWC will make weight 1 much stiffer than weight 2 when learning task 2.
L2.2 — The EWC penalty cost
The EWC objective is
The last term is a spring: moving weight away from its old value costs energy proportional to stiffness . Using , from L2.1, , and old optimum :
Compute the penalty cost of (a) moving by , (b) moving by .
Recall Solution
Penalty per weight .
(a)
(b)
The same displacement of costs on the stiff weight but only on the loose one — a ratio of , exactly the Fisher ratio. EWC automatically puts the rigidity where forgetting would hurt.
L2.3 — Reservoir sampling probability
In reservoir sampling we keep a fixed buffer of examples out of a stream of total. The rule guarantees every example ends up in the buffer with probability . Also, when example number (with ) arrives, it is accepted into the buffer with probability .
With and a stream of : (a) what is the final probability any given example sits in the buffer? (b) what is the acceptance probability for the -th arriving example?
Recall Solution
(a) By the reservoir guarantee, (2.5%).
(b) Acceptance probability (50%).
Note (b) (a): early arrivals get accepted often but face many later chances to be evicted, and the two effects balance out to the uniform .
Level 3 — Analysis
Goal: reason about why methods behave as they do.
L3.1 — When do two gradients cause forgetting?
Consider a 2-weight model. At the task-1 optimum , the task-1 loss looks like a bowl . A single SGD step for task 2 uses the task-2 gradient . We step .
Show, using a first-order change in , that whether task 1 gets worse depends on the dot product of with the task-1 gradient direction — and evaluate for , .
Recall Solution
The dot product measures alignment: positive if two vectors point the same general way. We use it here because the first-order change in any function along a step is exactly (gradient)·(step).
Change in task-1 loss for a small step : But at the optimum , ! So to first order .
Forgetting at the exact minimum is a second-order effect. Compute at the new point directly. Step: , new . We rose from to : forgetting happened, driven by the curvature (the Hessian, here the identity), which is exactly what EWC's Fisher term protects. See figure below.

L3.2 — Why replay changes the gradient
With plain SGD the task-2 update uses only . Experience Replay minimises
where is the buffer of old examples and weights their influence. Suppose the pure new-task gradient is (which we saw raises ) and the buffered old-task gradient is . With , compute the combined gradient and the resulting change in after a step from .
Recall Solution
Combined gradient: .
Step: , new .
Compare to from L3.1 without replay: forgetting dropped from to — a 5× reduction. The old-task gradient pulled the step back toward the region that keeps low. This is the replay "compromise" made concrete. See figure.

Level 4 — Synthesis
Goal: combine pieces into a design or a proof.
L4.1 — Budgeted replay allocation
You have a total buffer of examples and have already finished tasks 1 and 2, currently holding from task 1 and from task 2. Task 3 now arrives with fresh examples. You decide on an equal-per-task buffer after task 3.
(a) How many examples per task should the final buffer hold? (b) A mini-batch of size is drawn uniformly across the buffer's tasks. Roughly how many come from each task? (c) If instead you keep replay proportional to buffer counts before rebalancing (500 : 400 : 0), why does task 3 risk never being rehearsed, and what's the fix?
Recall Solution
(a) Three tasks share equally: examples per task. So we subsample task 1 down from 500→300 and task 2 from 400→300, and admit 300 from task 3.
(b) Uniform across 3 tasks ⇒ examples per task in each mini-batch.
(c) With weights , task 3 has zero replay weight (it isn't in the "old" buffer while it's the current task, and the given proportional scheme allocates 0). The model would train on task 3's stream but never rehearse it against the buffer's balance, so once task 4 arrives, task 3 is under-protected. Fix: insert task 3 examples into the buffer as they stream in (reservoir/class-balanced), and rebalance to equal shares — exactly part (a). This mirrors the class-balanced buffer idea and connects to online updating.
L4.2 — Design a hybrid and predict forgetting order
Rank these four setups by expected final forgetting on task 1 (lowest forgetting first), and justify with one mechanism each:
(i) Plain SGD, no protection. (ii) EWC with large . (iii) Experience Replay, buffer 300/task. (iv) Progressive Networks (frozen old columns).
Recall Solution
Predicted order (lowest forgetting → highest):
- (iv) Old parameters are never updated ⇒ zero forgetting by construction — strictly the best on retention (cost: model grows each task; see Neural Architecture Search).
- (iii) Replay directly reinjects old-task gradients (L3.2 showed 5× reduction), strong retention, bounded by buffer size and quality; ties to replay in the brain.
- (ii) EWC only protects along Fisher-important directions via a quadratic approximation; large boosts stability but sacrifices plasticity and errs where the quadratic approximation is poor. Related: Regularization Techniques.
- (i) No memory, no penalty ⇒ worst forgetting; this is the baseline that motivates all of Continual and lifelong learning.
(Replay vs strong-EWC ordering can swap in practice; the key defensible claim is (iv) best, (i) worst.)
Level 5 — Mastery
Goal: derive, generalise, and reason at the limits.
L5.1 — Derive the EWC update and its fixed point
Starting from , derive the gradient-descent update for a single weight, then find the fixed point (the the update converges to) assuming the new-task loss is locally quadratic per weight, where is the new-task curvature and its preferred value.
Recall Solution
Gradient of the EWC objective w.r.t. weight : Update:
Fixed point = where the gradient is zero (steady state): Solve for : Interpretation: the equilibrium is a weighted average of the new-task ideal and the old value , with weights (new-task curvature) and (protection). See figure.
Limits (all cases):
- (unimportant weight): — free to fully adapt. ✔ plasticity.
- (very important weight, strong penalty): — pinned to old value. ✔ stability.
- : reduces to plain SGD, — no protection (recovers L3 forgetting).

L5.2 — Numeric mastery check on the fixed point
Using the boxed formula, take , , , , . Compute . Then double to and recompute. Which way does the equilibrium move, and does that match "more ⇒ more stability"?
Recall Solution
With : .
With : .
The equilibrium moved from toward — closer to the old value . Doubling pulled the weight back toward its task-1 setting: more stability, less plasticity, exactly as claimed. ✔
Connections
Prerequisites and neighbours: Continual and lifelong learning · Catastrophic Forgetting · Regularization Techniques · Transfer Learning · Meta-Learning · Knowledge Distillation · Neural Architecture Search · Online Learning · Neuroscience - Memory Consolidation · Hinglish version