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 -
Students only see the 60 big dots (ringed dots have the wrong colour). Scores are on 600 fresh dots with the right colours.
Student scores while learning
Challenges
What just happened?
- The teacher is big and studied lots of dots, so its map follows the spiral and ignores most wrong colours.
- The colours-only student sees just 60 dots, and some are wrong. It has to guess the rest of the spiral and gets fooled by the fibs.
- The hints student hears "this dot is 80% blue, 15% green, 5% red". That says much more per dot, and the teacher quietly fixes the wrong colours.
- The small "maybe" numbers are dark knowledge: which wrong answers are nearly right. Temperature makes them big enough to learn from.
- The student is about 30 times smaller and faster than the teacher, but nearly as good. That is why phones run distilled models.
How it works
- Make 600 spiral dots in 3 colours, and give 1 in 5 a wrong colour.
- The teacher (2 → 32 → 32 → 3) studies all 600 dots.
- Two identical students (2 → 6 → 3) start from the same random knobs. They both get only the first 60 dots.
- Student 1 learns from the colours. Student 2 learns mostly from the teacher's softened "how sure" numbers.
- 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.