Topic 4 of 5 · 4 min read
Measuring student against teacher
Goal: Read a comparison of teacher, student and baseline results and decide whether the student is good enough to ship.
Judge a student with three rows, not two: the teacher, the student, and the same small model without distillation, all on your own held-out task, with latency and cost next to accuracy.
Check yourself · 1 of 3
Why include the untuned small model in a student-versus-teacher comparison?
Why it matters
A student that scores 90% sounds good. It is only good if the teacher scores 91% and the untuned small model scores 60%. Without the three rows, you cannot tell how much of the gain came from distillation, how much quality you gave up, or whether you needed distillation at all.
How to do it
- Freeze a test set before training: 300 to 1,000 real prompts, never used for training or tuning. Keep a hidden slice for the final check.
- Run all three models with the same prompts, the same prompt template and the same settings.
- Score the task, not the style. Use an exact check where one exists (valid JSON, correct label, tests pass). Use a rubric or a human sample where it does not.
- Measure cost and speed: median and 95th-percentile latency, and cost per 1,000 requests including hosting. Include the one-off cost of teacher calls and training when you compare payback.
- Break results down by category and by hard cases, not only the average.
- Decide with a rule written beforehand, for example "ship if accuracy is within 3 points of the teacher and cost per 1,000 requests is under a fifth."
Before and after
Weak report: "Student accuracy 89%. Looks great." Better report:
| Model | Accuracy | p95 latency | Cost per 1,000 requests |
|---|---|---|---|
| Teacher | 93% | 2.1 s | $4.00 |
| Student | 89% | 0.4 s | $0.30 |
| Untuned small model | 61% | 0.4 s | $0.30 |
The student keeps most of the quality at the speed and price of the small model. The 4-point gap is the figure the team must accept or reject.
What goes wrong
- Leakage. Test prompts that also appear in the teacher-generated training set inflate the student's score.
- Agreement with the teacher is not accuracy. If the student copies the teacher's errors, "matches the teacher" looks perfect while both are wrong. Score against ground truth when you have it.
- Averages hide failures. A 2% overall drop can be a 20% drop on your highest-value category.
- One-run noise. With sampling, repeat runs and report the spread.
- Wrong cost frame. A student at one fifth the price still loses if it needs retries or human review on one request in four.
Examples
A ship decision
Rule set in advance: ship if accuracy is within 3 points of the teacher. Results are teacher 93%, student 89%, untuned 61%. The gap is 4 points, so the student misses the rule. The team looks at errors by category: nearly all lost points are in refund disputes. They add 2,000 teacher-labelled refund tickets and retrain.
Leakage caught
A student scores 97% on the test set, higher than the teacher. A check finds 400 test tickets also appear, nearly word for word, in the training prompts. After removing them, the score is 88%. The first figure measured memory, not skill.
Key points
- Compare three rows on the same held-out set: teacher, student and the untuned small model.
- Freeze the test set before training and make sure none of it appears in the training data.
- Report latency and cost per 1,000 requests beside accuracy, including the one-off training cost when computing payback.
- Score against ground truth where it exists, because matching the teacher also copies its errors.
- Write the ship rule before looking at results and check performance by category, not only the average.
Common mistakes
- Reporting the student's accuracy without the teacher and untuned baseline next to it.
- Letting test prompts overlap with the distillation training prompts.
- Reporting 'agrees with the teacher' as if it were accuracy.
- Choosing the ship threshold after seeing the results.
Check yourself · 2 of 3
A student scores 97% on a test set, above the teacher's 93%. What do you check first?
Check yourself · 3 of 3
Accuracy: teacher 93%, student 89%, untuned 61%. Cost per 1,000 requests: teacher $4.00, student $0.30. The rule was 'within 5 points and under a quarter of the cost'. What follows?
Practice items, not counted towards your mastery.
Start here
- Distilling the Knowledge in a Neural Network (opens in a new tab)PaperFree
The original soft-target and temperature recipe that every later distillation method builds on.
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (opens in a new tab)PaperFree
Reports distilling a large reasoning model's outputs into smaller Qwen and Llama models, and compares that with running RL on the small model.
- Hugging Face TRL: Generalized Knowledge Distillation Trainer (opens in a new tab)DocsFree
A working trainer for logit distillation with the loss and sampling options explained.
More for this topic
- DistilBERT, a distilled version of BERT (opens in a new tab)PaperFree
A concrete size, speed and quality trade-off from distilling a language model.