What a probability distribution can teach #
A digit classifier might assign a picture a 90 percent chance of being a seven, 9 percent of being a one, and 1 percent divided among the remaining choices. A conventional label gives only the correct class. The teacher’s probabilities also reveal which other shapes it found plausible. Across thousands of images, these relative preferences can give a student information about similarities among inputs and classes.
An ensemble combines predictions from several models, which can be expensive to run for every request. Buciluă, Caruana and Niculescu-Mizil investigated compressing ensemble behavior into a smaller model in 2006. Hinton, Vinyals and Dean later developed an influential formulation of distillation using softened output distributions. The student can have a different internal arrangement from the teacher because the fitting target is an observable prediction.
Temperature and the transfer set #
A softmax converts numerical scores into class probabilities. Raising its temperature makes the distribution less concentrated and can expose differences among classes to which the teacher assigned very low probabilities. During training the student can match these softened targets while also learning from ordinary labels where they are available. At deployment the temperature used for classification can return to its usual setting.
The inputs used for transfer matter. Suppose a teacher recognizes both printed and handwritten numerals, but the student sees only printed examples. Even perfectly matching the teacher on this transfer set gives little direct evidence about handwriting. Distillation experiments therefore need a separate evaluation set and an account of how its inputs compare with those used for transfer.
A smaller transformer #
The DistilBERT team applied distillation during language-model pretraining. Its training objective combined a language-modeling loss, a term matching the teacher’s output distribution and a term encouraging similarity in internal representations. The authors reported a model with 40 percent fewer parameters than BERT-base that preserved about 97 percent of its performance on their GLUE comparison. The ratio describes a specific aggregate of benchmark results. Individual tasks and the hardware serving the student can yield different trade-offs.
What survives compression #
Consider a rare category with high consequences for a particular application. Losing half its correct predictions might barely move a benchmark dominated by common examples. Evaluating each category and measuring latency at the intended batch size can reveal whether the smaller model suits that deployment. Distillation can also transfer systematic errors. A teacher that consistently misreads a particular font supplies confidently wrong targets. Ground-truth examples and independent tests remain valuable even when the student closely imitates the teacher. Model collapse asks what happens across repeated rounds of learning from generated material. Retaining the original examples changes the comparison with repeatedly replacing them.
A transfer set with a missing digit #
Hinton and colleagues ran an unusually revealing digit-recognition experiment. They removed every image labeled three from the transfer set used to teach the student. The teacher still assigned some probability to the class three when shown other digits. The student could therefore receive information about that class without seeing a transfer example in which three was the correct answer. On the test set it misclassified 133 of the 1,010 threes.
The researchers then adjusted the output bias for that class and reported only 14 errors on threes. They chose the adjustment to optimize overall performance on the test set. The second figure is best read as a diagnostic showing that the student had learned useful distinctions despite an unfavorable class bias. Estimating how well that correction would generalize would require choosing the bias on separate validation data and checking it on a fresh test set.
Sources
- Geoffrey Hinton, Oriol Vinyals and Jeff Dean, Distilling the Knowledge in a Neural Network (2015) arxiv.org
- Cristian Buciluă, Rich Caruana and Alexandru Niculescu-Mizil, Model Compression (2006) cs.cornell.edu
- Victor Sanh and colleagues, DistilBERT, a distilled version of BERT (2019) arxiv.org
- Matthias Gerstgrasser and colleagues · Is Model Collapse Inevitable? Breaking the Curse of Recursion by Accumulating Real and Synthetic Data (2024) arxiv.orgCited in