Knowledge distillation transfers the generalization capabilities of a cumbersome teacher model to a compact student model by training the student on the teacher's output distributions. Rather than learning from hard labels alone, the student mimics the soft probability outputs—known as dark knowledge—which encode richer inter-class similarity structures.
Glossary
Knowledge Distillation

What is Knowledge Distillation?
Knowledge distillation is a model compression technique where a smaller 'student' model is trained to replicate the behavior and performance of a larger, more complex 'teacher' model or ensemble.
In legal knowledge graph construction, this technique compresses massive Legal-BERT or Graph Neural Network teachers into lightweight models suitable for on-device node classification and link prediction. The student learns to approximate the teacher's relational inferences, preserving high citation integrity while drastically reducing inference latency and compute cost.
Key Features of Knowledge Distillation
Core mechanisms and architectural patterns that enable the transfer of representational knowledge from a high-capacity teacher model to a compact, deployment-ready student model.
Teacher-Student Architecture
The foundational two-model paradigm where a large, pre-trained teacher network generates soft probability distributions over outputs. The smaller student model is trained not just on hard labels but on these soft targets, which encode rich inter-class similarities learned by the teacher. The student minimizes a composite loss function combining the standard cross-entropy loss with a distillation loss, typically Kullback-Leibler divergence, weighted by a temperature hyperparameter.
Response-Based Distillation
The most common form of knowledge transfer, where the student mimics the final output layer of the teacher. This approach is straightforward to implement but loses intermediate representational information. It is particularly effective for classification tasks where the relative probabilities of incorrect classes carry significant semantic meaning about the input data manifold.
Feature-Based Distillation
Transfers knowledge by aligning the intermediate feature representations of the student and teacher networks. A regression loss, such as L2 distance, is applied between the teacher's hidden layer activations and a learned linear projection of the student's corresponding layer. This method captures the hierarchical feature extraction process, enabling the student to learn better internal representations beyond just mimicking final outputs.
Relation-Based Distillation
Preserves the structural relationships between data samples rather than individual outputs. The student learns to replicate the similarity matrices generated by the teacher, capturing how the teacher organizes the embedding space. Techniques include:
- Instance Relationship Graph: Matching pairwise distances between samples in a batch.
- Flow of Solution Procedure (FSP): Matching Gram matrices between two layers to preserve the problem-solving process.
Online Distillation
A peer-learning paradigm where the teacher and student models are trained simultaneously from scratch, rather than sequentially. In architectures like Deep Mutual Learning, a cohort of untrained student networks learn collaboratively by matching each other's soft predictions. This eliminates the need for a pre-trained, computationally expensive teacher and often yields students that outperform individually trained counterparts.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Explore the core concepts behind model compression and teacher-student training paradigms used to deploy efficient, high-performance AI in resource-constrained environments.
Knowledge distillation is a model compression technique where a compact student model is trained to mimic the behavior of a larger, high-capacity teacher model or an ensemble of models. Rather than training the student on hard labels (one-hot encoded ground truth), the student learns from the soft labels produced by the teacher's final softmax layer. These soft labels contain rich, dark knowledge about inter-class similarities—for instance, a teacher classifying a car might assign a small probability to 'truck' but zero to 'apple,' revealing a meaningful latent structure. The student is optimized using a composite loss function that combines the standard cross-entropy loss with ground truth and a Kullback-Leibler (KL) divergence loss against the teacher's softened output distribution, controlled by a temperature parameter T. Higher T softens the probability distribution, exposing more granular relational knowledge for the student to absorb.
Related Terms
Core techniques and architectural patterns for transferring knowledge from complex teacher models to efficient student models, enabling high-performance inference on constrained hardware.
Teacher-Student Architecture
The foundational two-model training paradigm where a large, pre-trained teacher model generates soft probability distributions over outputs. The smaller student model is trained to match these soft targets rather than hard ground-truth labels, capturing the teacher's nuanced decision boundaries and inter-class relationships that one-hot labels miss.
Soft Targets & Temperature Scaling
A technique using a temperature parameter (T) in the softmax function to soften the teacher's output probabilities. Higher temperatures produce richer, more informative training signals by revealing the relative similarities between incorrect classes. The student trains on these softened distributions, learning not just what is correct but what is plausibly similar.
Distillation Loss Functions
The combined objective function balancing two signals:
- Distillation Loss: KL-divergence between the softened teacher and student outputs, weighted by T²
- Student Loss: Standard cross-entropy with ground-truth hard labels This dual-loss approach ensures the student learns both the teacher's internal representations and the task's objective accuracy.
Feature-Based Distillation
An extension beyond output-level matching where the student learns to replicate the teacher's intermediate representations. The student's hidden layer activations are trained to minimize distance from the teacher's corresponding feature maps, transferring the hierarchical feature extraction patterns that make large models effective at representation learning.
Self-Distillation
A variant where a model acts as its own teacher through iterative training cycles. The model's predictions from previous epochs serve as soft targets for subsequent training rounds. This technique can improve generalization without requiring a separate larger model, effectively extracting additional signal from the model's own learned representations.
Online Distillation
A co-training paradigm where multiple peer models train simultaneously, sharing knowledge during the training process rather than sequentially. A cohort of smaller models learns collaboratively, with each model's predictions informing the others. This eliminates the need for a pre-trained teacher and can produce ensembles that outperform individually trained models.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us