Bring the mental model from Maximum Likelihood; this page will reuse it instead of restarting from zero.
Efficiency
Knowledge Distillation: Learning from Teachers
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.

Concept Structure
Knowledge Distillation: Learning from Teachers
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Knowledge Distillation: Learning from TeachersConceptual Bridge
What should feel connected as you move through this page.
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.
The next edge should feel earned: use the demo prediction here before following Speculative Decoding: Lossless Multi-Token Generation.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
If you train a model on hard labels, every example is treated like a one-bit fact: "this is a cat."
A good teacher model knows more than that. It might say:
- 0.84 cat
- 0.12 dog
- 0.04 fox
Those "almost" probabilities carry what is often called dark knowledge: relative non-target probabilities can encode similarity structure learned from data. Distillation trains a student to match the teacher's distribution, so the student can inherit the teacher's behavior even with fewer parameters or a different architecture.
In LLMs, distillation often extends the same intuition to next-token distributions: a smaller model is trained to approximate a larger model's token probabilities. Speculative decoding uses a fast draft model as an approximation to the final model; the draft may be distilled, but speculative decoding's correctness comes from verification rather than distillation itself.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let the teacher and student produce logits and over a discrete output space.
With temperature , define softened probabilities:
A standard modern way to write the soft-target distillation term is teacher-student KL divergence; with a fixed teacher distribution, this is equivalent to soft-target cross-entropy up to a teacher-only constant:
where:
The second term can be a hard-label loss for classification or a standard next-token loss in an LLM setting.
Rule of thumb: increasing makes the teacher distribution softer (more informative about non-top classes), but if is too large it becomes nearly uniform and carries little signal.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
def softmax(z, tau=1.0):
z = z / tau
z = z - z.max()
e = np.exp(z)
return e / e.sum()
def kl(p, q):
eps = 1e-12
return float(np.sum(p * (np.log(p + eps) - np.log(q + eps))))
teacher_logits = np.array([4.0, 2.0, 0.0])
student_logits = np.array([3.0, 0.5, -0.5])
for tau in [1.0, 2.0, 4.0]:
pT = softmax(teacher_logits, tau)
pS = softmax(student_logits, tau)
print("tau=", tau, "pT=", np.round(pT, 3), "pS=", np.round(pS, 3), "KL=", round(kl(pT, pS), 3))
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The demo below asks you to predict the largest non-label pull before revealing the softened teacher distribution. The key invariant is that distillation transfers structure in the teacher's non-argmax probabilities, not only the hard top label.
Live Concept Demo
Explore Knowledge Distillation: Learning from Teachers
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what Knowledge Distillation: Learning from Teachers should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Knowledge Distillation: Learning from Teachers should make visible.
Visual Inquiry
Make the image answer a mathematical question
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.
Which visible object should carry the first intuition?
Pick the cue that should make Knowledge Distillation: Learning from Teachers easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds temperature-softened soft targets and the incorrect-class probability-ratio/similarity-structure intuition used by the page.
Open sourceClaim Review
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.
Claims without a substantive review badge still need exact source-support review.
hinton-2015-distillation
Use equation, code, and demo objects to check whether the source support is operational.
Hinton et al. define softened class probabilities with temperature, train the distilled model to match teacher soft targets, say incorrect-answer probability ratios encode rich similarity structure, and mix soft-target cross-entropy with label cross-entropy. The page instantiates the equivalent teacher-student KL term plus temperature, gaps, and hard/KD mixing.
Sources: Distilling the Knowledge in a Neural NetworkThis checks Hinton-style finite-class soft-target distillation. It does not check sequence-level LLM distillation recipes, speculative-decoding correctness, teacher quality, capacity matching, data filtering, or universal compression gains.A bounded review summary is present; still check caveats and exact source scope.Hinton et al. support high-temperature soft targets, matching the teacher at the same temperature, incorrect-class probability ratios as similarity structure, and weighted soft-target plus hard-label cross-entropy with T^2 scaling. Oracle accepted the page's fixed-teacher KL form as cross-entropy-equivalent and the toy math/code/demo as witnesses for tau-softmax, tau^2 KL, non-label pull, and hard/KD mixing.
Reviewer: codex+oracle; reviewed 2026-05-07Practice Loop
Try the idea before it explains itself
Train a smaller student to mimic a stronger teacher by matching soft probability distributions (often with temperature), transferring 'dark knowledge' beyond hard labels.
Before touching the demo, predict one visible change that should happen in Knowledge Distillation: Learning from Teachers.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Knowledge Distillation: Learning from Teachers
What is the smallest example that makes Knowledge Distillation: Learning from Teachers click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:efficiency/knowledge-distillation.
- Source ids to inspect: hinton-2015-distillation
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Knowledge Distillation: Learning from Teachers Object key: concept:efficiency/knowledge-distillation Context: Efficiency Anchor id: concept/concept-notebook/efficiency/knowledge-distillation Open question: What is the smallest example that makes Knowledge Distillation: Learning from Teachers click without losing the math? Evidence to inspect: - Source ids to inspect: hinton-2015-distillation - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/efficiency/knowledge-distillation
concept:efficiency/knowledge-distillation