AI & ML Atlas
Deep LearningtechniqueAnimated walkthrough
Knowledge Distillation
Trains a small "student" to imitate a large "teacher".
The idea
The teacher's soft output probabilities carry more information than hard labels: they say a cat photo looks a bit like a dog and nothing like a car. The student is trained to match these softened outputs (using a temperature) as well as the true labels, packing much of the teacher's behaviour into a smaller model.
L = α·KL(softmax(zₜ/T) ‖ softmax(zₛ/T))·T² + (1 − α)·CE(y, zₛ)
Watch it run
The pipeline lights up one step at a time. Use the controls to pause or step through it.
- 1Train or take a large teacher model.
- 2Run the data through the teacher with a softmax temperature T > 1 to get soft targets.
- 3Train the student on a blend of soft-target loss and normal label loss.
- 4Deploy the small student.
L = α·KL(softmax(zₜ/T) ‖ softmax(zₛ/T))·T² + (1 − α)·CE(y, zₛ)
1/4
Step by step
- 1Train or take a large teacher model.
- 2Run the data through the teacher with a softmax temperature T > 1 to get soft targets.
- 3Train the student on a blend of soft-target loss and normal label loss.
- 4Deploy the small student.
Where it is used
DistilBERT, on-device models, cheaper inference.
Watch out for
The student usually cannot fully match the teacher.