Quiz: self-distillation and foundation models
Before this unit: Contrastive learning (previous unit); Day 41: Modern deep learning; Day 37: Training networks in practice.
See also: Denoising and what you may measure (day 5).
Short questions on students, teachers, collapse and frozen features. Try each on paper first, then open the answer.
Q1. In self-distillation, which network is trained by backpropagation, and how does the other one change?
One of them gets no gradient.
The student is trained by backpropagation to match the teacher’s output on another view. The teacher gets no gradient; its weights are a moving average of the student’s weights, updated after every step.
Q2. Self-distillation has no negatives. What stops every image from getting the same output?
Two operations on the teacher’s output.
Centring (subtracting a running mean of the teacher’s scores) stops one prototype from winning for all images; sharpening (a low teacher temperature) stops the outputs from becoming uniform. Together, with the slowly moving teacher, they keep the outputs confident per image and different between images.
Q3. With m = 0.99, how far has the teacher followed a sudden change of the student after 100 steps?
1 - m^n.
1 - 0.99^{100} = 0.63: about two thirds.
Q4. Name two ways in which microscopy images differ from the photographs most foundation models were trained on.
Channels, scale, what texture means.
For example: many fluorescence channels instead of three colours; objects of a few pixels in very large fields; texture that carries biological meaning (chromatin) rather than surface; no natural orientation; intensities that are measurements.
Q5. You cluster frozen embeddings of cells from 12 plates and get 12 clean clusters. What do you check before calling them phenotypes?
Colour the clusters by something technical.
Whether the clusters coincide with the plates (a batch effect). If so, centre the embeddings per plate using control cells and cluster again; and evaluate on held-out plates.
Q6. How does an image–text model classify an image into classes it was never trained on?
Both images and captions are embedded in the same space.
Embed each class name as a caption (“a nucleus in mitosis”, …), embed the image, and choose the caption with the most similar embedding (zero-shot). It only works for concepts described in its training captions.
Q7. (math) Show that the gradient of -\sum_k t_k\ln s_k with s = \mathrm{softmax}(\mathbf g/\tau) with respect to \mathbf g is (s - t)/\tau.
Write \ln s_k = g_k/\tau - \ln\sum_j e^{g_j/\tau} and use \sum_k t_k = 1.
The loss is -\sum_k t_k g_k/\tau + \ln\sum_j e^{g_j/\tau}. Its derivative with respect to g_k is -t_k/\tau + s_k/\tau.