Running a frontier model for every request gets expensive fast. If your product answers the same kind of question thousands of times a day, most of that capability goes unused. That is the situation where teams start asking whether they can distill a large model into a small one that handles their specific workload at a fraction of the cost.
Distillation is a real technique with real limits. It works well for narrow, well-defined tasks and badly for open-ended ones. This guide explains how it works, what you gain and lose, and how to decide whether it fits your use case.
What it means to distill a large model
Model distillation trains a small model, called the student, to copy the behavior of a large model, called the teacher. The teacher generates answers on a set of prompts, and the student learns from those answers instead of from the original training data. The goal is a model that behaves like the teacher on your task while running on far less hardware.
The key detail is what the student actually learns from. A teacher does not just hand over a final answer. In the classic setup, known as knowledge distillation, it also hands over its confidence across possible answers, known as soft labels. A student trained on soft labels learns which answers were close calls and which were clearly wrong, so it picks up more of the teacher’s judgment than it would from hard right-or-wrong labels alone. Modern setups often skip soft labels and train on the teacher’s generated text directly, which is simpler and works well for language models, though it passes along less of that extra signal.
Think of it as an apprenticeship. The student never sees the teacher’s weights or training data, only what the teacher produces. That is why the student can end up much smaller and still perform well on the task it trained for, and also why it cannot match the teacher on tasks it never practiced.
How distillation works in practice
A typical distillation project follows four steps.
- Pick the teacher and the task. Choose a large model that already does your task well, and define the task narrowly. “Answer refund questions from our help center” is a task. “Be generally smart” is not.
- Build a prompt set. Gather or generate prompts that look like real traffic. This set matters more than almost anything else. A student trained on tidy, synthetic prompts will struggle with the messy phrasing real users send.
- Generate teacher outputs. Run the teacher over the prompt set and collect its answers. For many teams this is the most expensive step, since teacher API calls cost real money. Keep the outputs, because you will reuse them across experiments.
- Train and evaluate the student. Fine-tune a small base model on the teacher’s outputs, then test it on held-out prompts your team wrote by hand. Compare it against the teacher on accuracy, and against your current setup on latency and cost.
That last step is where most projects succeed or fail. If you evaluate the student only on prompts that resemble its training data, the numbers will look great and the product will still disappoint. Hold out realistic edge cases: typos, vague requests, and questions just outside the task boundary.
What you gain, and what you give up
The gains are concrete. A distilled small language model in the 1 to 8 billion parameter range can run on a single GPU or even on a decent CPU setup, which cuts inference cost per request sharply compared with calling a frontier API. Latency drops too, since a smaller model generates each token faster, and you can host it yourself, which helps when data cannot leave your servers. There are already small models that punch above their weight on narrow tasks, and distillation is one way to build one tuned to your exact workload.
The trade-offs are just as concrete. The student is narrower than the teacher. It handles the task it trained on and degrades quickly outside it, so you need routing or guardrails to catch out-of-scope requests. It also inherits the teacher’s mistakes. If the teacher gives confident wrong answers on some slice of your data, the student will learn those wrong answers as correct.
When distillation is the right call
Distillation pays off when four conditions line up. First, the task is narrow and stable. Classification, extraction, summarization in a fixed format, and answering from a fixed knowledge base are all good candidates. Second, you have high volume. If you serve thousands of requests a day, the savings from a small self-hosted model add up quickly. At low volume, the engineering time usually costs more than the API bill you would save. Third, the teacher already does the task well, because the student cannot exceed its teacher on the same data. Fourth, latency or privacy matters enough to justify hosting your own model.
A common winning pattern is a support triage bot. The teacher writes draft replies, the team reviews them, and over time the distilled student handles the routine half of the queue on its own while the teacher stays in the loop for the hard cases. This setup pairs naturally with fine-tuning a small model on your own corrected outputs, which often matters more than the distillation step itself.
When you should skip it
Skip distillation when the task is broad or still changing. If your product needs open-ended reasoning, creative writing, or long multi-step planning, a small student will disappoint, and you will spend the savings on workarounds. Skip it when volume is low. Ten requests a minute does not justify a training pipeline. Skip it when you cannot evaluate properly. Without a held-out test set built from real traffic, you cannot tell a good student from a bad one.
Also skip it when your real problem is cost per token rather than capability. Quantization shrinks an existing model without retraining, and prompt caching can cut repeat costs with no training at all. If you have not tried those first, do that before committing to distillation. Similarly, if the goal is simply to run a model on a laptop, start by picking a small model to run offline from the many capable open models already available. Distillation only makes sense once an off-the-shelf small model falls short on your specific task.
Distillation vs fine-tuning vs quantization
These three techniques solve different problems, and teams often confuse them. The table below separates them by what each one actually does.
| Technique | What it does | Best when | Main drawback |
|---|---|---|---|
| Distillation | Trains a small student to copy a large teacher | High-volume, narrow task with a strong teacher | Student inherits teacher errors; needs re-training as data drifts |
| Fine-tuning | Trains a model further on your own labeled data | You have quality examples and a specific style or format | Needs labeled data; can narrow the model too much |
| Quantization | Reduces the precision of an existing model’s weights | You need a model to run on cheaper hardware now | Small quality loss; no new capability learned |
In practice the techniques combine. A common pipeline is to distill a teacher into a small student, then fine-tune that student on your own corrected outputs, then quantize the result for deployment.
A short checklist before you start
Before you write any training code, confirm the following. Do you have at least a few hundred realistic prompts, ideally sampled from real traffic? Do you have a held-out test set that nobody on the team has used for training? Can you state the accuracy bar the student must clear before it ships? Do you know your current cost per thousand requests, so you can tell whether the savings justify the work?
If you cannot answer most of those, spend a week on measurement first. Log real prompts, build the test set, and measure the teacher’s current quality and cost. That groundwork makes the distillation project faster and gives you a baseline to judge the student against.
Frequently asked questions
Can a distilled model ever beat its teacher?
On the narrow task it trained on, sometimes. The student sees thousands of teacher outputs on that one task, and focused training can close the gap or even pass the teacher on that slice. On anything outside that slice, no. The teacher’s breadth is what you gave up.
How much data do you need to distill a model?
Most successful small projects use thousands to tens of thousands of teacher-generated examples. Fewer than a thousand rarely produces a reliable student. Quality matters more than raw count: prompts that match real traffic beat a larger set of synthetic prompts.
Is distillation legal with a commercial API as the teacher?
It depends on the provider’s terms. Some providers prohibit using their outputs to train a competing model, while others allow it within limits. Read the terms of the API you use before generating training data.