A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Knowledge Distillation

Research Depth 92 in the knowledge graph ☐ I know this ☆ Set as goal
640prerequisites beneath it
See this on the map →
Neural Network FundamentalsAdvanced Ensemble Methods→
distillation teacher-student compression

Core Idea

Knowledge distillation transfers knowledge from large, accurate teacher models to smaller, faster student models by training students to mimic teacher outputs. Using soft probability distributions instead of hard labels provides richer supervision signals. Students achieve similar accuracy with orders of magnitude fewer parameters.

Explainer

From your work with neural networks, you know that larger models with more parameters generally achieve better accuracy — but they also consume more memory and compute at inference time. A massive model that takes seconds per prediction is useless in a real-time application. Knowledge distillation solves this by training a small, efficient student model to reproduce the behavior of a large, powerful teacher model, capturing most of the teacher's accuracy at a fraction of the cost.

The key insight is in *what* the student learns from. In standard supervised learning, the model trains against hard labels — a cat image gets the label "cat" and nothing else. But the teacher model produces soft targets: a probability distribution like 0.85 cat, 0.10 tiger, 0.03 lynx, 0.02 other. These soft probabilities carry far more information than a hard label. The fact that the teacher thinks "tiger" is more likely than "car" reveals something about the visual structure of the image — the student learns not just the right answer but the *relationships between classes*. This is sometimes called the "dark knowledge" hidden in the teacher's outputs.

In practice, the teacher's output probabilities are sharpened by a temperature parameter applied to the softmax function. At temperature T=1 (normal softmax), the dominant class often has probability near 1.0, washing out the informative relationships among other classes. Raising the temperature to T=3 or T=5 produces softer distributions that spread probability mass more evenly, making the inter-class relationships more visible to the student. The student is then trained on a weighted combination of two losses: one matching the soft teacher outputs (at high temperature) and one matching the true hard labels (at normal temperature).

The results can be striking. A student network with 10x fewer parameters than the teacher often recovers 95% or more of the teacher's accuracy. If you have studied ensemble methods, you will recognize a connection: an ensemble of models can serve as the teacher, and distillation compresses that ensemble's collective knowledge into a single small network. This is how knowledge distillation bridges the gap between the accuracy of large-scale training and the efficiency demands of deployment — you train big, then distill small.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Angle Pairs: Complementary, Supplementary, and Vertical → Parallel Lines and Transversals → Corresponding Angles → Alternate Interior Angles → Triangle Angle Sum Theorem → Exterior Angle Theorem → Triangle Inequality Theorem → Similar Triangles: AA Similarity → Similar Triangles: SSS and SAS Similarity → Proportions in Similar Triangles → Right Triangle Trigonometry Introduction → Sine, Cosine, and Tangent Ratios → Trigonometric Ratios Review → Radian Measure → Converting Between Degrees and Radians → The Unit Circle → Graphing Sine and Cosine → Graphing Tangent and Reciprocal Trigonometric Functions → Derivatives of Trigonometric Functions → Antiderivatives → Indefinite Integrals → Basic Integration Rules → Riemann Sums → Definite Integral Definition → Probability Density Functions and Continuous Distributions → Cumulative Distribution Functions → Continuous Random Variables → Probability Density Functions → Expected Value → Linear Regression in Machine Learning → Neural Network Fundamentals → Knowledge Distillation

Longest path: 93 steps · 640 total prerequisite topics

Prerequisites (2)

Leads To (0)

No topics depend on this one yet.