Distillation produces a compact model whose quality is close to that of a large one: the student learns not only from the correct answers but also from how the teacher scores the alternatives. Such a model is cheaper to store and run.
How it works
In the original paper by Hinton and colleagues (2015), the teacher outputs a probability distribution over classes for each example. These are “soft targets”: they show what the teacher considers similar, not just which answer is correct. To make small probabilities more visible, the softmax temperature T is raised, and after the student is trained it is set back to T = 1. The loss function is a weighted sum of two parts: cross-entropy with the soft targets and cross-entropy with the true labels.
Distilling language models
For large language models, the teacher often just produces answers to a large set of prompts, and the student is then fine-tuned on those answers in the usual way (SFT). This is how the small DeepSeek-R1-Distill models were made: the DeepSeek-R1 authors fine-tuned Qwen and Llama models from 1.5B to 70B on 800,000 examples generated with DeepSeek-R1.
| Variant | What the student learns | Example |
|---|---|---|
| Soft targets | the teacher’s probability distribution (with temperature) | a classifier, Hinton’s 2015 paper |
| On the teacher’s text | answers and reasoning produced by the teacher | DeepSeek-R1-Distill-Qwen-7B |
Before using another model’s outputs for training, check the teacher’s licence: its terms may restrict such use.
Sources
the term is written from these pagesVerified 18 Nov