Hinton's original distillation paper: one model absorbs 80% of a 10-model ensemble's gain

Distilling the Knowledge in a Neural Network

Geoffrey Hinton, Oriol Vinyals, Jeff Dean

stat.ML, cs.LG, cs.NE

2015-03-09

Train a small model on a large model's high-temperature soft targets: on Google speech, one distilled net captured 80%+ of a 10-model ensemble's gain at an equal 10.7% WER.

What problem this solves

Train many models and average their predictions, and almost any machine learning task gets better; that is the old appeal of ensembles. Nobody serving a large user base can afford to run ten big neural nets per request, though. Training and deployment have opposite requirements: training extracts structure from huge redundant datasets and can take as long as it needs, while deployment lives under latency and compute budgets. Hinton's analogy is the insect, a larva built for extracting energy and an adult built for travel and reproduction, whereas ML practice uses one model for both stages.

Compressing an ensemble into a single model had been shown by Caruana's group, who fit the large model's logits (the raw scores before the softmax). The habit holding the idea back was equating knowledge with learned parameter values. Hinton reframes knowledge as the learned mapping from input vectors to output vectors: a BMW image has a tiny chance of being called a garbage truck, yet that error is many times more likely than calling it a carrot. The relative probabilities of wrong classes encode how the model generalizes, and that is exactly what should be handed to a small model.

Method

Distillation is one move: raise the temperature T in the teacher's softmax to produce soft targets, train the student to match them at the same high temperature, and set T back to 1 for deployment.

The second half handles datasets where even training an ensemble is unaffordable. JFT holds 100M images across 15,000 classes, and the baseline CNN had trained for about six months. The design pairs one generalist with many specialists: each specialist owns 300 confusable classes and collapses the rest into a single dustbin class to shrink its softmax, with groupings from online K-means on the covariance of the generalist's predictions, no labels needed. Specialists are initialized from the generalist and see half specialist-heavy, half random data. At inference, the generalist picks the top class, only specialists covering it are activated, and the final distribution minimizes KL divergence to the active models. Unlike mixtures of experts, no gating network couples anything, so specialists train fully in parallel.

Results

On MNIST, the teacher (two 1200-unit layers, dropout, input jitter) makes 67 test errors; a two-800-unit net trained normally makes 146, and matching the teacher's T=20 soft targets as its only regularization brings that to 74. In the extreme version, every 3 is deleted from the transfer set, and after a bias fix the model still gets 98.6% of the 1010 test 3s right, never having seen the digit.

The speech experiment uses a version of the Android voice search acoustic model: 8 layers of 2560 units, 85M parameters, 14,000 output states, about 2000 hours of English.

SystemFrame accuracyWER
Baseline single model58.9%10.9%
10-model ensemble61.1%10.7%
Distilled single model60.8%10.7%

The ten models differ only in random initialization. More than 80% of the ensemble's frame-classification gain transfers to the distilled model of the same size, with WER equal to the ensemble. Related work distilling at T=1 recovered only 28% of the error gap between large and small models, so temperature is not a hyperparameter to set casually.

Data efficiency is the sharpest result. On 3% of the speech data, the same 85M model reaches 44.5% test frame accuracy with hard targets and needs early stopping; with soft targets from a teacher trained on the full data it reaches 57.0% without early stopping, about 2 points below the full-data 58.9%.

On JFT, 61 specialists lift overall top-1 from 25.0% to 26.1% (4.4% relative) and conditional accuracy on covered classes from 43.1% to 45.9%, with each specialist trained in days. Classes covered by more specialists gain more: from +3.4% relative with one covering specialist to +16.6% with nine.

Why it matters

This is the March 2015 paper by Hinton, Vinyals and Dean that named knowledge distillation. The practical value has not aged: deployment gets ensemble-level accuracy at single-model inference cost; soft targets double as regularization and data amplification, with 3% of the data landing within 2 points of full-data accuracy; and specialists give a parallelizable route when class counts make full ensembles untrainable. Feeding a small language model a large model's output distribution is still this mechanism, logit matching plus temperature, a decade on.

Limitations

The authors state that they have not shown specialists can be distilled back into a single large net, and the soft-target fix for specialist overfitting is listed as ongoing work. WER moves only from 10.9% to 10.7%; the ensemble itself barely improves the final metric, which the authors attribute to the frame-level objective mismatching recognition. The 98.6% figure depends on adding 3.5 to the digit-3 bias, a value tuned on the test set, so it is optimistic; without it, 133 of the 1010 test 3s are errors. Temperature is sensitive: a student with 30 units per layer only works in the narrow 2.5-4 range. Specialist inference runs per-image gradient descent to combine distributions, so test-time cost is not reduced.

Terms

Source

What people are saying

Related papers

All paper explainers