Lesson 1 · Unit 03
What to train
Forgetting, small learning rates, and how much to unfreeze
What you practise
- Full fine-tuning, a frozen backbone with a new head, layer-wise choices, catastrophic forgetting, why pretrained weights want a small learning rate
Try a question from this lesson
Pick one
The weight starts at 2, a perfect fit for task A (y = 2x), and is then trained only on task B (y = -x). What does this print: the weight, then the loss on task A?
w = torch.tensor(2.0, requires_grad=True)
opt = optim.SGD([w], lr=0.1)
x = torch.tensor([1.0, 2.0])
for step in range(50):
opt.zero_grad()
loss = ((w * x + x) ** 2).mean()
loss.backward()
opt.step()
task_a = ((w * x - 2 * x) ** 2).mean()
print(round(w.item(), 2),
round(task_a.item(), 1))Hint
The loss being minimised mentions only task B. Where does that pull the weight, and what does task A think of the result?
Correct answer
-1.0 22.5
Why
The loss only mentions task B, so the weight goes all the way to -1, and task A's loss rises from 0 to 22.5. Nothing held the weight near 2. A model has no memory of what its weights were good for.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Catastrophic forgetting
Fine-tuning moves weights toward the new task, and the new loss says nothing about the old abilities. They fade as the weights drift. This is called catastrophic forgetting.
The defences all limit the drift: a small learning rate, few steps, freezing the layers you want kept, and mixing examples of the old skills into the new data.
10 more exercises in the app
- 4× multiple choice
- 2× true or false
- 1× fill the blanks
- 2× type the answer
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.