TL;DR
Learning without Forgetting (LwF) teaches a trained image classifier a new task using only the new task's images and labels. Before training starts, the original network's outputs are recorded on those images, and during training the network is kept close to them, which keeps the old task working. Across the paper's seven task pairs, it keeps the old task far better than fine-tuning and stays close to joint training, which uses the old data too.
Builds on: Convolutional Neural Network, Knowledge Distillation, Catastrophic Forgetting, Fine-Tuning · Leads to: later continual-learning methods that keep old outputs as a stand-in for old data
Why it mattered
The paper turned a common practice into a clear rule. Adapting a pre-trained network to a new task had usually meant fine-tuning it on the new data with a small learning rate and hoping the old behaviour survived. LwF replaces that hope with a direct constraint: the outputs on the new images should not drift from what the original network produced. The paper argues that for the new task alone, this often beats plain fine-tuning, which makes it a practical default for adding a capability to an existing network.
The idea of keeping an old model's outputs as a substitute for the old data is now a common pattern in continual learning. The paper also shows the cost of the simple alternatives. A deployed system that must keep its old skills cannot keep every old dataset, and that is the situation the paper addresses.
The problem
Suppose a convolutional network has been trained on ImageNet, with a shared trunk of layers and an output layer for its 1,000 classes. Now a new task must be added, such as recognising scenes or birds, and the ImageNet images and labels are no longer available. Three standard ways of doing this each fail in a different way.
Feature extraction keeps the shared layers frozen and trains a new classifier on their features. It keeps the old task exactly, but the shared features were not built for the new task, so the new task suffers.
Fine-tuning trains everything on the new data with a small learning rate. The new task does well, but the shared layers drift, and the old task can lose accuracy quickly. In the paper's Table I, fine-tuning ends up to 4.6 points below LwF on the old task.
Joint training trains on old and new data together. It is the best reference for how well both tasks can do, but it needs the old data, and it becomes more cumbersome to train as tasks are added.
Catastrophic forgetting is the name for the second failure, where learning the new task overwrites what the network knew. LwF's goal is to get close to joint training without the old data, and without the cost of a separate network per task.
How it works
Start with one network that has shared layers, an old output layer, and a new output layer that starts random. The paper's notation is for the shared parameters, for the old output parameters and for the new ones.
- Record the old network's answers. For every image in the new task's training set, run the original network and store its output probabilities for the old classes. Take a tiny example: an image whose recorded old-class probabilities are . Check: the two numbers add to 1.
- Add the new output nodes. Attach new output units for the new classes, with random weights. There are few new weights compared with the whole network. Check: the old output layer is unchanged in shape.
- Warm-up. Freeze and , and train only until it converges. This gives the new head a sensible starting point.
- Joint optimisation. Train , and together, on new-task images only. Each batch has two terms. The new-task term uses the new labels. The old-task term asks the network's old outputs on the same image to match the recorded ones. Take the same image: the new label is the true class, and the current network gives it probability . The new-task loss is . Check: a more confident network gives a smaller loss.
- Compare the old outputs with the recorded ones. The current network's old-class probabilities on that image are , against the recorded . The old-task loss, computed with the softened probabilities in step 6, is about . Check: the loss is smaller when the two sets of probabilities agree.
- Soften both sets of probabilities. Before comparing, raise each probability to the power with and renormalise, which makes small probabilities count more. The recorded becomes , and the current becomes about .
- Sum the losses. The total is the new-task loss plus the old-task loss, weighted by the balance (set to 1 in most of the paper), plus a small weight-decay term. In the example the total is about , before weight decay. The optimiser lowers this total, which moves the shared layers so the new task improves while the old outputs stay near the recorded ones.
flowchart LR A["Original network"] --> B["Record old outputs on new images"] A --> C["Add new output nodes"] C --> D["Warm-up: train new head only"] D --> E["Joint training on new images"] B --> F["Old-output loss"] E --> F E --> G["New-task loss"] F --> H["Adapted network"] G --> H
The math
The new-task loss is the usual multinomial logistic loss. Write for the one-hot ground-truth vector and for the network's softmax output:
With one correct class , this is , which is the example's .
The old-task loss is a knowledge-distillation style cross-entropy. The recorded old-class probabilities are and the current ones are , for old labels. They are softened with temperature :
The loss is then
The paper uses , chosen by grid search on a held-out set. Raising the probabilities to instead of is what makes small probabilities matter more, as in Softmax Temperature.
Checking the example: and . Their sum is , so . The current gives , sum , so . The loss is .
The paper's total objective is
where is a weight decay term of . Training uses Stochastic Gradient Descent with momentum , and the warm-up step is the one above. The paper takes as a balance: making it larger favours the old task, and this trade-off is traced out in the paper's Figure 7.
The paper also compares response-preserving losses, , , cross-entropy and the knowledge-distillation loss, and finds the last one slightly better. The difference is small, which the paper takes to mean that keeping the outputs close matters more than the exact distance measure.
Results
The main experiments use AlexNet, with ImageNet or Places365 as the old task and VOC, CUB or MIT indoor scenes as the new one. Table I gives LwF's own numbers and the differences of the other methods from LwF, so a negative value means that method scored below LwF on that task. Every number is an accuracy in percent, or mean average precision for VOC. Each figure is a mean over three runs.
On ImageNet to VOC, LwF reaches 56.2% on the old task and 76.1% on the new. Fine-tuning is 0.9 points lower on the old task and 0.3 lower on the new. Joint training reaches 56.9% old and 75.9% new. On Places365 to Scenes, LwF reaches 50.9% old and 75.2% new; fine-tuning is 2.1 lower on old and 1.7 lower on new.
The paper's main claims from Table I are these:
- On the new task, LwF beats feature extraction, fine-tuning FC and Less Forgetting Learning in all seven pairs. It beats fine-tuning in four pairs, ties on ImageNet to MNIST, and is slightly behind on Places365 to VOC (by 0.1 points) and Places365 to CUB (by 1.0 point, with fine-tuning at 35.8% against LwF's 34.8%).
- On the old task, LwF is much better than fine-tuning and worse than feature extraction in every pair, since feature extraction leaves the old task exactly as it was.
- LwF is close to joint training. It is slightly better on the new task and slightly worse on the old, which the paper attributes to the different image distributions of the two tasks.
- Dissimilar tasks cost more old-task accuracy. For CUB added to a Places365 network, the drop on Places365 is points for fine-tuning, for LwF and for joint training.
- The MNIST case is the failure case. The handwritten digits give little indirect supervision for the ImageNet task, and LwF's old-task accuracy falls to 49.8% while its new-task accuracy reaches 99.3%.
The multiple-task experiment adds VOC or Scenes in parts, recording the old outputs again each time, so the old network's answers always come from the latest model. LwF beats fine-tuning and feature extraction for most newly added tasks, but falls behind joint training on the old task after several additions.
The paper's design tests give further results. Adding more task-specific layers did not help. Expanding the network with new nodes and freezing the old ones performed worse than LwF on the new task. Simply lowering the learning rate of the shared layers did not protect the old task and reduced new-task accuracy. A soft constraint on the weights, which penalises the distance of shared weights from their original values, did worse than constraining the outputs.
The results are limited. The new-task datasets are small, with about 5,300 to 6,000 training images. The experiments are on image classification, with one tracking application in an appendix, and the authors list segmentation and detection as future work. The old network's outputs are only recorded on the new task's images, so they can be a poor sample of the old task's distribution, which the paper's MNIST result shows.
Reading guide
- Section I, introduction. Needs Catastrophic Forgetting, Fine-Tuning and Transfer Learning. Figure 2 shows what each compared method trains and which data it uses.
- Section II, related work. Needs Continual Learning for the methods the paper compares with, such as Less Forgetting Learning.
- Section III, method. Needs Convolutional Neural Network, Cross-Entropy Loss, Softmax Temperature and Knowledge Distillation. Work the example of this lesson alongside Section III's equations.
- Section III-A, implementation. Needs Stochastic Gradient Descent and Xavier (Glorot) Initialization. The learning rate and warm-up choices are the practical details.
- Section IV-A, main experiments. Needs Transfer Learning for the task pairs. Table I is the paper's main evidence.
- Section IV-B, design choices. No new prerequisites; each comparison is one change to the method.
- Section V, discussion. The argument that preserving outputs is a more direct way to keep shared structure than a low learning rate.
Check yourself
QuestionIn one sentence, what does Learning without Forgetting use in place of the old task's training data?Show answer
QuestionThe recorded old-class probabilities for an image are (0.8, 0.2) and the current ones are (0.6, 0.4). With T = 2, what are the softened recorded probabilities?Show answer
QuestionWhy does the paper use the knowledge-distillation loss with a temperature above 1, instead of the ordinary cross-entropy on the old outputs?Show answer
QuestionOn the Places365 to CUB pair, fine-tuning reaches 1.0 points more new-task accuracy than LwF. Why does LwF still count as a success on this pair?Show answer
QuestionA team has a network trained on ImageNet and wants to add a new visual task, but they no longer have the ImageNet data. Would Learning without Forgetting help, and what would they need to check?Show answer
Sources
- Li and Hoiem, "Learning without Forgetting" (2016), arXiv: https://arxiv.org/abs/1606.09282
- Hinton, Vinyals and Dean, "Distilling the Knowledge in a Neural Network" (2015), arXiv: https://arxiv.org/abs/1503.02531