Open models Guide 18 of 25
Small models and distillation: shrinking a model to fit the job
Frontier labs routinely build their small models by distilling bigger ones. Your team can use the same technique on a narrow task, provided you know what it transfers and what it quietly drops.
Key takeaways
- Distillation trains a small student model on a large teacher’s outputs or probabilities, which carry far more signal per example than plain labels.
- Three methods dominate: matching the teacher’s token probabilities, fine-tuning on teacher-written text, and on-policy distillation, where the teacher corrects the student’s own attempts token by token.
- Distillation transfers narrow, well-covered skills well. Broad imitation copies style faster than substance, so judge students with labeled evals, not preference ratings.
- Distill when the task is narrow, stable, and high-volume and you already have an eval set. Otherwise prompt a small model or keep the large one.
- Read the teacher’s license and terms before generating training data. Unauthorized distillation from a provider’s model can breach its terms of service.
On this page 7 sections
In its May 2025 technical report, the Qwen3 team compared two ways to improve the same 8-billion-parameter model on competition math. Reinforcement learning (RL) reached 67.6% on AIME 2024, a hard US math exam, after 17,920 graphics processing unit (GPU) hours. Having a larger teacher model correct the small model’s own attempts reached 74.4% in 1,800 GPU hours, a tenth of the compute.
That teacher-student method is distillation: training a small student model to imitate a large teacher. It matters because most production traffic for large language models (LLMs) is not open-ended conversation but one narrow job — classify this ticket, extract these fields — repeated millions of times. For that work, a model a tenth or a hundredth of the size can be cheaper, faster, and small enough to run on your own hardware, if you can make it good enough.
This is no longer a research curiosity: Anthropic noted in February 2026 that frontier labs regularly distill their own models into smaller, cheaper ones. This guide covers how distillation works, where it falls short, and when it pays off on your own task.
What counts as a small model, and why did they get good?
There is no official cutoff. Here, small means roughly a few hundred million to about 15 billion parameters: models that fit on a single GPU, a laptop, or even a phone at the low end. Fewer parameters means less memory to move for every generated token, so small models are cheaper and faster to serve, quicker to fine-tune, and practical to host wherever your data lives.
Small models used to trail far behind, and distillation is one of the main reasons that gap has narrowed. Google trained every Gemma 3 model with distillation and reported in March 2025 that its 4-billion-parameter instruction-tuned model was competitive with the previous generation’s 27-billion-parameter one.
Alibaba’s Qwen team made a similar bet in May 2025, covering six Qwen3 models: five dense models from 0.6 billion to 14 billion parameters and a 30-billion-parameter mixture-of-experts model. Rather than run each through the four-stage post-training pipeline used for its flagships, the team distilled them from those larger siblings. The small models were still pretrained normally; distillation replaced only post-training.
An off-the-shelf small open-weight model is often a distilled one already. The open question is whether to distill again, on your task.
How does knowledge distillation work?
The name and the modern form of the technique come from a 2015 paper by Geoffrey Hinton, Oriol Vinyals, and Jeff Dean at Google, which built on earlier model-compression work. A trained classifier does not just pick an answer; it assigns a probability to every possible answer. The wrong answers are informative. A ticket classifier might give a refund request a small chance of being a billing question and almost none of being a job application, and that pattern encodes how the categories relate.
Distillation trains the student to match the teacher’s whole probability distribution, called soft targets, rather than only the single correct label. A temperature setting, applied to both models during training, flattens the teacher’s distribution so those small probabilities carry more weight.
On the MNIST handwritten-digit benchmark, the paper’s large network made 67 test errors. A small one trained normally made 146, but trained on the large network’s soft targets it made just 74. In speech recognition, one distilled model kept more than 80% of the accuracy gain from an ensemble of 10 models.
The most useful result for engineers came from a data-starved run. Trained on only 3% of the speech data, the soft-target model reached 57% test frame accuracy, nearly matching the 58.9% achieved with the full dataset. With hard labels, the same model peaked at 44.5% before overfitting. A teacher’s outputs are a dense training signal, so a student needs far less data than labels alone would require.
Three ways to distill a language model
For a language model, the answer at each step is the next token, and the teacher’s probabilities across its vocabulary are the soft targets. In practice, three methods dominate. They differ in what the student learns from and how much teacher access you need.
Logit distillation
Here the student learns directly from the teacher’s token probabilities (logits are the raw scores those probabilities come from). Gemma 3’s vocabulary has more than 250,000 tokens, and its pretraining kept just 256 sampled candidates per position rather than the teacher’s full distribution. Candidates were drawn in proportion to the teacher’s probabilities, and the student matched the teacher’s renormalized distribution over them.
The method needs the teacher’s probabilities at every token, which in practice means running its weights, and in its simplest form a shared tokenizer. That makes it mainly a tool for labs and for teams running an open-weight teacher.
The same report flagged a subtlety: for short training runs a smaller teacher produced the better student, but with longer training the larger teacher pulled ahead. Bigger is not automatically better.
Fine-tuning on teacher-written text
The simplest method needs only the teacher’s text. You send prompts to the teacher, keep its answers, and train the student on them with ordinary supervised fine-tuning (SFT). It works through an application programming interface (API), so almost any team can use it, and the richer the teacher’s output, the more the student learns.
Google Research’s distilling step-by-step method (2023) prompted the teacher to write out its reasoning, then trained the student on two tasks at once: predicting the answer and generating that rationale. A 770-million-parameter T5 model beat the 540-billion-parameter PaLM, prompted with a few worked examples, on the Adversarial Natural Language Inference (ANLI) benchmark while using only 80% of the training set. Standard fine-tuning of the same small model fell short of PaLM even with the full dataset.
DeepSeek applied the idea to reasoning. It fine-tuned Qwen and Llama models from 1.5 billion to 70 billion parameters on about 800,000 curated samples generated with DeepSeek-R1, with no RL stage. For the roughly 600,000 reasoning samples, the team generated several answers per prompt and kept only the correct ones.
The distilled 32-billion-parameter model scored 72.6% on AIME 2024, the American Invitational Mathematics Examination. The same base model trained with more than 10,000 steps of RL scored 47.0%.
On-policy distillation
Training on teacher-written text has a blind spot. The student only studies the teacher’s good answers, but at run time it writes its own, and one early slip can lead somewhere the training data never went. On-policy distillation lets the student write the response, then has the teacher supply its next-token probabilities at every position. The student is trained to close the gap between the two distributions, so corrections land exactly where its choices drift.
That is the Qwen3 experiment from the opening, run on math and coding prompts. The shared starting checkpoint had already been fine-tuned on teacher-written text, and on-policy distillation also raised the share of problems solved within 64 attempts, which RL did not.
The catch is access: the teacher must run alongside training, so outside teams need an open-weight teacher, ideally one with a matching vocabulary.
| Method | Student learns from | Teacher access needed | Best fit | Main risk |
|---|---|---|---|---|
| Logit distillation | The teacher’s token probabilities | The weights, or per-token probabilities | Pretraining or deep compression of an open model | Compute and storage; tokenizers must match |
| Fine-tuning on teacher text | The teacher’s answers and reasoning | An API is enough | Narrow tasks; transferring reasoning | Copies style faster than substance; terms of service |
| On-policy distillation | The teacher’s probabilities on the student’s own output | A teacher running alongside training | Polishing a student you have already fine-tuned | Infrastructure; mismatched vocabularies |
What can’t distillation do?
A student rarely outgrows its teacher, and it inherits the teacher’s blind spots. The DeepSeek-R1 authors drew a related conclusion: distillation is economical and effective, but going further may still demand stronger base models and bigger RL runs. If the teacher gets an extraction wrong, the student learns the wrong extraction, confidently.
Broad imitation is also shallower than it looks. In a 2023 UC Berkeley study, researchers fine-tuned models of 1.5 to 13 billion parameters on ChatGPT outputs. Crowdworkers rated about 70% of imitation-model answers as equal to or better than ChatGPT’s, yet targeted benchmarks showed little real gain outside tasks heavily represented in the imitation data. The models had learned the confident tone, not the knowledge.
Two rules follow. Distill only narrow tasks your transfer data actually covers. And judge a student on labeled data with hard cases, never on preference ratings or a few impressive samples.
Safety behavior is a third gap. Anthropic argues that models distilled without authorization will probably lack the original’s safeguards. Authorized students get no guarantee either, because a narrow transfer set rarely exercises refusals. Rerun refusal, policy, and prompt-injection tests rather than assume the behavior carried over.
Then there is the legal question. In the same post, Anthropic said three AI labs had used roughly 24,000 fraudulent accounts to log more than 16 million exchanges with Claude, breaching its terms of service. None of this makes the technique itself suspect.
“Distillation is a widely used and legitimate training method.” — Anthropic, 23 February 2026
The line is authorization. Before generating a single training example, read the terms of any API teacher and the license of any open-weight one.
What does distillation look like in production?
LinkedIn’s February 2026 paper on semantic search shows distillation carrying real traffic. The team distilled frontier LLM judges into an in-house 8-billion-parameter model that grades query–result relevance, reaching a 0.77 agreement score with human labels (linear-weighted kappa). That judge’s grades trained an intermediate teacher, which in turn produced soft labels for a 0.6-billion-parameter ranking model.
Conventional engineering followed. The team scaled judge-labeled job-search data from 200,000 to 8 million query–document pairs, stopping when gains flattened. It pruned the ranker from 600 million to 375 million parameters without losing people-search quality, and compressed long inputs. Overall, the paper reports more than 75 times the ranking throughput at a fixed latency budget, with quality close to the teacher’s on normalized discounted cumulative gain (NDCG).
Three lessons generalize. The judge came first, because cheap, trustworthy grading made every later step both trainable and measurable. Distillation came in stages, from frontier judges down to the small ranker. And the student shipped alongside pruning and input compression, because the model is only part of the serving cost.
A practical distillation workflow
- Prove the task on the large model. Settle the prompt, output schema, and quality bar before shrinking anything.
- Build the eval set first. A few hundred human-checked examples, hard cases over-represented, will judge the teacher, the student, and every retrain.
- Collect inputs that look like production. Log real requests, scrub personal data, and deduplicate.
- Generate and filter teacher outputs. Keep only outputs that pass your validators, the same discipline DeepSeek applied when it discarded incorrect reasoning samples.
- Try two or three student sizes. Fine-tune each, fully or with low-rank adaptation (LoRA), and keep the smallest that clears the bar.
- Add an on-policy pass if you can run the teacher. It targets the student’s own mistakes, and in Qwen3’s experiments it beat RL at a tenth of the GPU hours.
- Ship behind a router. Send low-confidence or unusual requests to the large model, watch for drift, and re-distill when inputs change.
What this means for your team
Distill when the task is narrow and stable, volume is high enough that per-call cost or latency matters, and you have an eval set or will build one. A reason to own the model, such as data residency, on-device use, or predictable cost, strengthens the case.
Do not distill when the task needs broad world knowledge, changes every few weeks, or runs at low volume. A hosted small model or a better prompt will usually win.
Try cheaper levers first. Run an off-the-shelf small model against your eval set; it may already pass. Then consider quantization and routing, and distill only if a measurable gap remains.
Budget for data, not GPUs. The expensive parts are the eval set, the logging and scrubbing pipeline, and the filtering. For a narrow task, training runs are cheap and repeatable once that pipeline exists.
Keep the teacher. It remains your fallback for hard inputs, your labeler for fresh data, and often your judge. A distilled student is a cache of the teacher’s behavior on your task, and caches go stale.
The usual pitfalls are judging the student by how fluent it sounds, letting the transfer set drift from live traffic, skipping safety tests, and ignoring the teacher’s terms. The same reasoning shapes high-volume pipelines such as catalog enrichment and search, where per-item cost decides whether the system pays for itself. Measure the large model first, then find out how small you can go.
Sources
-
Distilling the Knowledge in a Neural Network (opens in new tab) — Hinton, Vinyals and Dean, Google (arXiv), 2015 arxiv.org
-
Distilling step-by-step: Outperforming larger language models with less training data and smaller model sizes (opens in new tab) — Google Research, 2023 research.google
-
Gemma 3 Technical Report (opens in new tab) — Gemma Team, Google DeepMind (arXiv), 2025 arxiv.org
-
DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (opens in new tab) — DeepSeek-AI (arXiv), 2025 arxiv.org
-
Qwen3 Technical Report (opens in new tab) — Qwen Team, Alibaba (arXiv), 2025 arxiv.org
-
The False Promise of Imitating Proprietary LLMs (opens in new tab) — Gudibande et al., UC Berkeley (arXiv), 2023 arxiv.org
-
Semantic Search At LinkedIn (opens in new tab) — LinkedIn (arXiv), 2026 arxiv.org
-
Detecting and preventing distillation attacks (opens in new tab) — Anthropic, 2026 anthropic.com