1. Can a smaller model learn from a teacher?
A capable model may require more memory, latency or compute than an application can afford. A smaller model can be easier to deploy, but its behaviour may fall short on the tasks that matter.
Distillation uses a teacher's behaviour as a training signal for a student. The student is often smaller, but the broader idea also includes learning from ensembles or teaching a different architecture.
It is not simply copying a parameter file. The student is trained to reproduce selected aspects of the teacher's behaviour on data.
2. Hard labels and soft targets
Consider a four-class question: “What is the capital of France?” The class order is Paris, London, Rome and Berlin. A one-hot hard label assigns probability one to Paris and zero to the other classes.
A teacher can also provide a probability distribution. Besides the top answer, it tells the student how that teacher distributes probability among alternatives.
Hard target · correct class Paris
Names the desired class without describing how the teacher scores alternatives.
Soft target · teaching logits at T = 4
[64.51%, 14.39%, 11.21%, 9.89%]
Class order: Paris, London, Rome, Berlin. Probabilities describe this hypothetical teacher, not objective similarity or truth.
These relative probabilities are sometimes called dark knowledge. They may reflect useful learned similarities or uncertainty. They may also contain biases, calibration errors or irrelevant associations.
A larger probability for London than Rome in our example does not prove that London is objectively a “more capital-like” city. These are hypothetical model scores for this question, not verified semantic distances.
A hard label is also not literally one bit of information in every problem: selecting one class out of many differs from a binary decision. The important distinction here is the supervision provided, not a fixed information-bit count.
Classical distribution distillation asks the student to match more than just the winning output. The teacher can remain fixed while optimisation changes the student's parameters.
3. Temperature reveals the distribution's softer shape
A very peaked teacher distribution puts little probability on alternatives. Temperature changes how its logits become probabilities:
For teacher logits , raising from to makes the distribution flatter. The top class remains Paris, but the other classes receive more probability mass.
Dividing by a larger positive temperature preserves the ordering of logits. It reduces logit gaps; it does not literally make the gaps larger. What becomes easier to inspect is the probability mass assigned to less likely alternatives. Higher temperature is not automatically a better training choice.
A common loss combines soft-target matching with ground-truth supervision:
where is the correct class. Both models use the same temperature in the soft term, while the hard term uses temperature one in this convention.
The KL direction matters:
When teacher targets are fixed, minimising this KL has the same student-dependent part as cross-entropy with the teacher's soft targets. The factor is commonly used to compensate for how temperature changes the gradient scale; it is not an extra guarantee about model quality.
Paris
Teacher 99.607% · student 82.283%
London
Teacher 0.247% · student 11.136%
Rome
Teacher 0.091% · student 4.097%
Berlin
Teacher 0.055% · student 2.485%
KL(teacher ∥ student): 0.175358 nats
T² × KL: 0.175358
Hard-label loss at T = 1 (Paris): 0.195007
Combined loss: 0.185183
Teacher logits [8, 2, 1, 0.5]; student logits [4, 2, 1, 0.5]. These are hand-picked numbers, not measured model predictions. Controls recalculate losses without updating weights. Teal bars show the teacher; grey bars show the student.
The experiment recalculates losses for fixed examples without training a student. Choosing the matching student makes the soft KL zero, but its hard-label loss is still positive because its probability of Paris is not exactly one.
Changing temperature can change both the raw KL and its scaling. Loss values at different temperatures should not be read as a direct ranking of model quality. Changing changes the training objective, not the underlying predictions in this fixed-logit demonstration.
At deployment, the student ordinarily produces its own predictions without a teacher alongside it. A distillation training temperature is not automatically the same setting as a text-generation sampling temperature.
4. Two teaching signals in practice
Distribution distillation
Input / shared prefix → teacher probabilities
Same output classes → student probabilities
Distribution loss → update student
Sequence distillation
Prompts → teacher generates text
Validate and filter → training examples
Response-token loss → update student
Distribution distillation
For language models, a teacher distribution can supervise the student's next-token probabilities at a shared prefix. Full-vocabulary probabilities or logits expose many alternatives beyond the sampled token.
This requires access to those scores, but not necessarily ownership of the teacher or its internal activations. An interface can expose scores, a subset of log probabilities or only text; those access patterns provide different information. A few returned top-token scores are not automatically the complete distribution.
Direct token-level KL assumes aligned output classes and compatible prefixes. If teacher and student use different tokenizers, their vocabulary entries and sequence positions do not directly match. Additional alignment methods or text-level supervision are needed.
Sequence distillation
The teacher generates responses to prompts, and the student trains on the resulting text, often using an SFT-style response loss:
where is a teacher-generated response. One selected sequence contains less explicit information about alternative next tokens than the full distributions along it, but it can still provide rich demonstrations.
Data filtering, deduplication and validation matter. A teacher can generate mistakes, unsupported claims or patterns that the student then imitates. Multiple samples, verified answers and a suitable prompt distribution can improve the teaching data, without guaranteeing success.
Reasoning-oriented distillation may train on teacher-generated solutions containing intermediate explanatory steps. These are generated sequences, not guaranteed access to the teacher's complete internal reasoning process. A fluent explanation is not proof that the solution is correct.
This text-level route can also accommodate different teacher and student architectures or tokenizers, because the student tokenizes the teaching text with its own tokenizer.
5. What transfers, what does not, and what does it cost?
DistilBERT is a published example of training a smaller BERT-style representation model with a combination of language-model, distillation and representation-alignment losses. Its reported size, speed and benchmark results describe a particular experiment; a single “percentage of intelligence retained” is not a general measure.
The DeepSeek-R1 work also describes distilling generated reasoning data into smaller student models. This illustrates sequence-based teaching; it does not establish that a student retains every teacher capability or that all tasks benefit equally.
A teacher is not an absolute performance ceiling
A student trained to exactly match one teacher distribution on the same inputs would reproduce that distribution. That narrow statement is different from claiming that a real student can never outperform its teacher on any evaluation.
Different training data, ground-truth supervision, regularisation, teacher ensembles or task specialisation can let a student outperform a teacher on some measures. It can also lose capabilities elsewhere. Neither superiority nor a fixed ceiling follows merely from the word “distillation”.
Capacity, data coverage and optimisation constrain what a student learns. It is not guaranteed to fit the teacher's entire behaviour, and any evaluation should include held-out cases and the application's actual requirements.
Pay for teaching before saving at deployment
Teacher inference, data validation, student training and evaluation have an upfront cost. A cheaper deployed student can offset that cost over enough requests, if it meets the required quality and service constraints.
A simplified cost comparison is:
If , equality occurs at:
Hypothetical costs: teacher request 100 units; student request 20 units; one-time data generation and training 10,000 units.
Teacher-only cost: 10,000 units
Student cost including setup: 12,000 units
Cost equality at 125 requests under these assumptions
Illustrative arithmetic only, excluding quality differences, hosting, maintenance and variable response lengths. These are not prices, measured savings or a deployment recommendation.
The displayed costs are deliberately hypothetical units. Real cost and memory depend on precision, model shape, context length, batching, hardware and response length. There is no universal claim that every seven-billion-parameter student fits on one particular GPU or saves a fixed factor.
Distillation can be combined with quantisation or pruning, but these are different techniques. A compact model's useful performance must be measured rather than inferred from its parameter count or training label.
6. What you have discovered
- Distribution distillation teaches from probabilities over alternatives; sequence distillation teaches from generated outputs.
- Temperature softens both teacher and student distributions in the soft-loss term, while the hard-label term can retain ordinary ground-truth supervision.
- Access to text, partial scores, full distributions or internal representations supports different distillation methods.
- Student capacity, data quality and evaluation determine what transfers; a teacher is not a universal performance ceiling.
- Upfront teaching costs and later deployment costs need to be considered together.
The main technical path is now in place: attention, Transformer components, tokenization, architectures, training and efficiency techniques. Next, we will revisit the journey from N-grams to Transformers, connecting the problems that motivated each step.