Fine-tuning

Teacher and Student

A big, slow teacher brain studied 600 dots of a three-colour spiral (1 in 5 has the wrong colour!). A tiny, fast student only gets 60 of those dots. One student just sees the colours. The other also hears how sure the teacher was.

The teacher is studying first…

How to play: press Teach and compare the two students' maps and scores. Hover or tap a map to see the teacher's "how sure" bars for that spot.

Three brains -

Teacher-
Student: colours only-
Student: teacher's hints-

Students only see the 60 big dots (ringed dots have the wrong colour). Scores are on 600 fresh dots with the right colours.

Teacher
-
Colours only
-
Teacher's hints
-

Student scores while learning

colours onlyteacher's hintsteacher

Challenges

Good hints: train until the student with teacher's hints beats the colours-only student by 5 points or more.
Dark knowledge: find a spot where, at T = 10, the teacher's second answer is at least 20%.
No hints: set α to 0% and train. Now both students learn the same way. Are their scores alike?
More dots: give the students 240+ dots and train. Does the gap get smaller?

What just happened?

How it works

  1. Make 600 spiral dots in 3 colours, and give 1 in 5 a wrong colour.
  2. The teacher (2 → 32 → 32 → 3) studies all 600 dots.
  3. Two identical students (2 → 6 → 3) start from the same random knobs. They both get only the first 60 dots.
  4. Student 1 learns from the colours. Student 2 learns mostly from the teacher's softened "how sure" numbers.
  5. Both are tested on 600 fresh dots with correct colours.
For grown-ups: what's really going on

Knowledge distillation (Hinton, Vinyals & Dean, 2015). Teacher logits t, student logits z; the student minimises (1−α)·CE(y, softmax(z)) + α·T²·KL(softmax(t/T) ‖ softmax(z/T)). The T² keeps gradient magnitudes comparable across temperatures: ∂/∂z = (1−α)(p − y) + α·T·(pT − qT).

  • Teacher: MLP 2 → 32 → 32 → 3, tanh, Adam lr 0.01 with L2 2·10⁻³, 500 full-batch steps on 600 points with 20% symmetric label noise. Students: 2 → 6 → 3 (39 parameters vs 1,251), trained on a 60-point transfer set (a subset of the teacher's data), Adam lr 0.01, full batch.
  • Here the gain comes mostly from soft targets carrying far more information per example (Hinton's "3% of the data" result) and from the teacher denoising labels. With only 3 classes temperature matters less than on, say, 1,000 ImageNet classes.
  • "Speed" = multiply-adds per prediction (weights in the network): teacher 1,184, student 30.
  • Distillation is everywhere: DistilBERT, small LLMs trained on bigger models' outputs, and on-device vision models.