Model Distillation Best Practices That Keep Quality High
Model distillation shrinks a teacher model into a smaller student that keeps most of the quality. These practices cover teacher choice, data, training and checks.
On this page
Short answer
Model distillation works best when you pick a teacher that is strong on your exact task, train the student on realistic prompts the teacher answers, and judge the student on held-out tests rather than training scores. A small student can then answer most requests at a fraction of the cost and latency of the teacher.
What is model distillation?
Model distillation is a training method where a large teacher model produces answers that a smaller student model learns to copy, so the student keeps much of the teacher's skill at a fraction of the size and cost. The student is trained on the teacher's outputs rather than only on human-written labels.
The teacher answers prompts from your real workload, and the student learns to match those answers. The student can be a model with far fewer parameters, which makes it cheaper to run and faster to answer, and small enough to run on modest hardware.
| Role | Size | Job | Cost per request |
|---|---|---|---|
| Teacher model | Large | Produces training answers | High |
| Student model | Small | Answers live requests | Low |
| Training data | Prompt set | Carries teacher behaviour | One-off |
| Evaluation set | Held-out prompts | Measures real quality | One-off |
Distillation is not the same as fine-tuning on human labels. The teacher's soft answers carry more information than a single correct label, such as which wrong answers are close and which are far off. For the basic idea, see what model distillation is.
How do you pick the right teacher model?
You pick the right teacher model by testing candidates on your own task, not by picking the largest model on the market. A teacher that is strong on general benchmarks can still be weak on your prompts, your tone or your edge cases.
Run a small bake-off. Take 200 to 500 prompts from real traffic, ask each candidate teacher to answer them, and score the answers with the same checks you will use for the student. Look at accuracy, format, length and how often the model refuses or hedges.
Also check what the teacher costs to run during training. Distillation needs many teacher answers, so a teacher that is twice as good but ten times the price may not be worth it. A mid-size teacher that is strong on your task is often the better choice.
Finally, confirm you are allowed to use the teacher's outputs for training. Some model licences restrict training other models on their outputs, so read the terms before you start.
What data should you distil on?
You should distil on prompts that match your real workload, including the awkward cases. A student trained only on clean, typical prompts will fail on the long, vague or hostile prompts that real users send.
Build the prompt set from three sources. First, sample real requests from logs, with personal data removed. Second, write prompts that cover each task type, each format and each failure mode you have seen. Third, add prompts that test the edges: very long inputs, missing context, contradictory instructions and requests outside the scope.
Keep the set balanced. If half your prompts are one easy task, the student will overfit to it and underperform on the rest. Aim for a spread that matches the mix you expect in production.
Label a held-out set separately and never train on it. That set is the only honest measure of whether the student is ready.
How do you set temperature and loss weights?
You set temperature and loss weights by starting from common defaults and then testing small changes on your held-out set. There is no single setting that works for every task, so treat these as dials to tune, not values to guess once.
Temperature controls how soft the teacher's answers are. A higher temperature spreads probability across more possible answers, which gives the student more information about what the teacher considers close. A common starting point is a temperature of 2 to 4 for the teacher's output distribution.
Loss weights balance two signals: matching the teacher and matching the true labels. When you have good labels, a mix of both usually works best. When labels are thin or noisy, weight the teacher signal more heavily.
Change one dial at a time and record the result on the held-out set. If you change temperature, loss weights and data size together, you will not know which change helped.
How do you evaluate the student properly?
You evaluate the student properly by testing it on prompts it has never seen, with the same checks you use in production. Training scores tell you the student learned the training data, not that it will work for real users.
Use three kinds of checks. First, task accuracy: does the student give the right answer on held-out prompts? Second, behaviour checks: does it follow the required format, stay in scope and refuse safely? Third, side-by-side comparison: show reviewers the teacher's and the student's answers without labels and ask which is better.
Measure cost and latency too. A student that matches the teacher on quality but is still slow or expensive has not delivered the point of distillation. Record tokens per second, time to first token and cost per request alongside quality.
Set a pass bar before you start, such as keeping at least 95 percent of the teacher's accuracy while cutting cost by 80 percent. A fixed bar stops the team from shipping a student that is close but not good enough.
Example (hypothetical): distilling a support classifier
Example (hypothetical): a support team routes 10,000 tickets a day with a large teacher model that costs 2 cents per ticket. That is 10,000 x $0.02 = $200 a day, and the teacher takes about 320 milliseconds per ticket.
The team builds a prompt set of 40,000 real tickets, with personal data removed, and asks the teacher to label each one with a category and a short reason. A small student is trained on those labels and tested on 2,000 tickets it has never seen.
The student reaches 91 percent accuracy where the teacher reaches 94 percent, and it answers in 45 milliseconds. Its cost is 0.2 cents per ticket, so 10,000 x $0.002 = $20 a day. The team saves $180 a day and answers seven times faster.
The team ships the student for routine tickets and keeps the teacher for the cases the student flags as uncertain. That split keeps quality high where it matters and saves money where it does not.
What are the common mistakes?
The most common model distillation mistakes are training on the wrong prompts, trusting training scores, and distilling a teacher that was never good at the task.
- Training on clean prompts only. Real traffic is messy. If the prompt set has no long, vague or hostile inputs, the student will fail on them in production.
- Judging by training scores. A student can memorise training answers and still fail on new prompts. Only held-out tests count.
- Picking the biggest teacher. A huge teacher that is weak on your task produces weak training data. Test teachers on your prompts first.
- Ignoring the licence. Some models forbid training on their outputs. Check the terms before you invest in a prompt set.
- Distilling once and stopping. Traffic changes. A student trained on last year's prompts slowly drifts from what users ask today.
- Skipping the cost check. If the student is only slightly cheaper than the teacher, the project may not be worth the effort.
Most of these mistakes share one root: the team treats distillation as a one-off training run instead of a product with data, tests and a maintenance plan.
How do you deploy and maintain a distilled model?
You deploy and maintain a distilled model by shipping it behind the same checks as any other model, then retraining on a schedule as traffic changes. Distillation does not end when training finishes.
Start with a shadow deployment. Run the student alongside the teacher on live traffic without showing its answers to users, and compare the two for a week or two. Ship only when the student holds its held-out quality on live prompts.
Keep the teacher available as a fallback for cases the student flags as uncertain. That fallback protects quality while the student handles the bulk of traffic cheaply.
Retrain on a fixed rhythm, such as monthly, using fresh prompts sampled from recent traffic. Track accuracy, cost and latency on the same dashboard, so a drift in any of them is visible before users complain. For the build steps, see how to implement model distillation.
For the budget side, see model distillation cost.
Key takeaways
- Distillation copies a teacher's behaviour into a smaller, cheaper student
- Pick the teacher by testing it on your own prompts, not by size alone
- Train on realistic prompts, including messy and hostile cases
- Judge the student only on held-out tests, with a fixed pass bar
- Keep the teacher as a fallback and retrain as traffic changes
Frequently asked questions
What is the difference between distillation and fine-tuning?
Fine-tuning trains a model on human-written labels for a task. Distillation trains a smaller student on a larger teacher model's outputs, which carry richer signals about which answers are close. The two can be combined: a student can learn from both teacher outputs and true labels.
How much smaller can the student be than the teacher?
It depends on the task. For narrow tasks such as classification or routing, a student with a tenth of the teacher's size can often keep most of the quality. For open-ended generation, the gap is larger and a bigger student is usually needed. Test on held-out prompts to find the right size.
How much training data does distillation need?
Narrow tasks can work with a few thousand teacher-labelled examples, while broader tasks may need tens of thousands. The key is coverage: the prompt set must cover every task type, format and edge case the student will meet in production, not just the easy cases.
Does distillation work for any model type?
It works best when the teacher and student share the same kind of task, such as text classification, extraction or short generation. It is harder when the teacher's skill depends on long reasoning chains or tool use, because those behaviours are harder for a small student to copy faithfully.
What does distillation cost?
The main cost is generating teacher answers for the training set, plus the compute to train the student. That is a one-off cost. The saving comes afterwards: the student answers each request for a fraction of the teacher's price, so high-volume workloads usually pay the training cost back quickly.
When should you not distil a model?
Skip distillation when traffic is low, when the task changes every week, or when the teacher is only slightly better than a small model you already have. In those cases the training effort and maintenance cost outweigh the savings, and calling the teacher directly is simpler.