Distillation trains a smaller student model to imitate a larger teacher, moving capability into a model that is faster and cheaper to serve.
Teacher outputs as training data
The classic method matches the teacher's full output distribution, known as soft logits. That carries more information than hard labels because it keeps the teacher's relative confidence across options. With large language models the usual route is data distillation:
- Run the teacher, for example GPT-4, over a set of prompts.
- Capture its answers and the reasoning behind them.
- Build a synthetic dataset from those outputs.
- Fine-tune the student on it with supervised fine-tuning (SFT).
- Evaluate the student on your task.
DeepSeek-R1's distilled Qwen and Llama variants follow this approach: DeepSeek fine-tuned them on about 800,000 samples generated by R1. So do many models trained on GPT-4 outputs. Check the provider's terms of service before training on a model's outputs.
Inherited blind spots and bias
A compiler turns high-level code into a lean binary and keeps the behavior. The student does something looser: it approximates the teacher statistically. It can copy the teacher's biases, blind spots and errors. How well it works depends on the quality of the teacher's outputs and the variety of the prompts used.
Serving cost and latency
A frontier model in production can be slow, costly and subject to provider rate limits. A smaller student, for example 7B parameters against a much larger teacher, cuts latency and cost, so you can serve more requests. How close the student gets to the teacher varies by task, so measure it on your own. You also keep the model under your own control, which helps with privacy.
When distillation fits and when it does not
| Situation | Choice |
|---|---|
| High volume, low latency, scoped domain | Distilled student |
| Open-ended queries | Frontier model |
| Low volume | Frontier model |
| Rapidly changing information | Frontier model |
Example scenario: a 72% student against a 90% teacher
Suppose the student scores 72% while the teacher holds 90%. Possible causes include too little or unrepresentative training data, or a distillation temperature set so low that the student copies the teacher's top predictions without learning the wider distribution.
- Check the distillation temperature. Temperatures above 1 soften the teacher's distribution and are common in distillation; tune the value on a validation set.
- Confirm the training set is large enough and representative of the task.
- Inspect the loss function to see whether it captures the student-teacher gap.
Raising the temperature softens the teacher's distribution, which can help the student learn it. Set a target, such as within 5% of the teacher, and track it after each change.