Quiz: transfer learning

Short questions on reusing a pretrained network. Try each on paper first, then open the answer.


Q1. Name the four ways to reuse a pretrained network (besides training from scratch), from the fewest to the most trained weights.

What stays fixed, and what learns?

As is (nothing trained); frozen backbone + new head (a linear probe: only the last layer); last layers tuned (the later layers and the head); all layers tuned (every weight, starting from the pretrained ones).


Q2. You have 12 annotated images. Frozen features + a probe, or fine-tuning all layers? Why?

How many weights can 12 labels pin down?

Frozen features + a probe: it trains few weights, so it cannot memorise the 12 images, and the pretrained features already describe them. Tuning all layers can drive the training loss to zero and drift away from the useful features (in the toy with 9 labels: 97 % frozen against 81 % all layers).


Q3. Why are the first layers of a pretrained network more reusable than its last layers?

What do the first layers detect?

The first layers detect edges, blobs and simple textures, which every kind of image contains. The last layers combine them into the classes of the old task (dogs, cars, or here rings and bars), which are specific to that task.


Q4. A frozen probe on your bright-field images reaches only 73 %, and its training loss stays high however many labels you add. What does that tell you, and what do you do?

Underfitting or overfitting?

It underfits: the frozen features do not separate your classes, so no head on top of them can. More labels will not help the probe. Fine-tune the backbone (all layers) so that the features adapt, or train from scratch if you have many labels.


Q5. Fine-tuning reached 82.7 % at step 60 and 80.7 % at step 300 on the validation set. Which network do you keep, and which number do you report?

The validation set was used for the choice.

Keep the step-60 weights (early stopping). Report its accuracy on a separate test set: 82.7 % is optimistic, because the step was chosen on those validation images.


Q6. (math) A linear probe has K(d + 1) parameters for d features and K classes. How many for 2048 features and 5 classes? Why is its training loss convex?

The features are fixed numbers; the scores are linear in the weights.

5 \cdot 2049 = 10{,}245. The scores are linear in the weights, and the cross-entropy -z_y + \log\sum_j e^{z_j} is a convex function of the scores (log-sum-exp is convex); a convex function of a linear map is convex.