Soft targets are the softened probability distributions produced by a teacher model's softmax layer, which contain richer supervisory information than traditional one-hot labels. This "dark knowledge" encodes the teacher's learned inter-class similarities and relative confidences, providing a more informative training signal. During knowledge distillation, a student model is trained to mimic these distributions, often using a temperature scaling parameter (T > 1) to further smooth the probabilities and emphasize relational structure.
Glossary
Soft Targets

What is Soft Targets?
In knowledge distillation, soft targets are the probability distributions output by a teacher model's final softmax layer, used to train a more compact student model.
The primary advantage of using soft targets is the transfer of generalization capability from a large, accurate teacher to a smaller, more efficient student. The student learns not just the correct class, but the teacher's nuanced understanding of class relationships and ambiguity. This technique is central to model compression pipelines, enabling the deployment of high-performance neural networks on resource-constrained devices like mobile phones and embedded systems where the original teacher model would be too large or slow.
Key Characteristics of Soft Targets
Soft targets are the probability distributions output by a teacher model's final softmax layer. Unlike hard labels, they contain rich 'dark knowledge' about inter-class relationships, which is the core information transferred during knowledge distillation.
Probabilistic Distributions
A soft target is a vector of probabilities produced by applying the softmax function to a teacher model's output logits. Each element represents the model's confidence that the input belongs to a specific class. For example, for an image of a cat, a model might output [cat: 0.7, dog: 0.25, lion: 0.05]. This distribution is inherently non-binary and non-sparse, containing more information than a one-hot label like [1, 0, 0].
Contain Dark Knowledge
The term 'dark knowledge' refers to the implicit, learned similarities between classes encoded within the soft targets. A model trained to distinguish 'cats' from 'dogs' learns that a 'cat' is more similar to a 'lion' than to a 'truck'. This inter-class similarity information is captured in the non-zero probabilities for incorrect classes. By learning to match these softened distributions, the student model internalizes the teacher's nuanced understanding of the feature space, often leading to better generalization than training on hard labels alone.
Temperature-Scaled Softmax
To control the 'softness' of the target distribution, a temperature parameter (T) is introduced into the softmax function: softmax(z_i / T).
- High Temperature (T > 1): Smoothens the distribution, making probabilities more uniform and amplifying dark knowledge. This is typically used during distillation.
- Low Temperature (T = 1): Recovers the standard softmax, producing a sharper distribution.
- Very Low Temperature (T → 0): Approximates a hard, one-hot label. Temperature scaling is essential for making the rich information in the logits accessible for the student model to learn from.
Primary Use in Distillation Loss
The core objective in logit-based knowledge distillation is to minimize the difference between the teacher's soft targets and the student's softened outputs. This is typically measured using Kullback-Leibler Divergence (KL Divergence), a statistical distance between two probability distributions. The total loss for the student is often a weighted sum:
L_total = α * L_CE(hard_labels, student) + (1-α) * T^2 * L_KL(teacher_soft_targets, student_soft_outputs)
Where L_CE is the standard cross-entropy loss with true labels, and α balances the two objectives.
Contrast with Hard Targets
Understanding the distinction is crucial for effective distillation.
Hard Targets (One-Hot Labels):
- Format: Sparse vector (e.g.,
[0, 1, 0, 0]). - Information: Only specifies the correct class.
- Gradient Signal: Provides a single, strong signal for the correct class.
- Use Case: Standard supervised training.
Soft Targets (Teacher Distributions):
- Format: Dense probability vector (e.g.,
[0.05, 0.8, 0.1, 0.05]). - Information: Specifies correct class and relative similarity to other classes.
- Gradient Signal: Provides many smaller, corrective signals across all classes.
- Use Case: Knowledge distillation, label smoothing.
Related Concepts & Techniques
Soft targets are a foundational concept with connections to several advanced methods:
- Label Smoothing: A regularization technique that manually creates soft targets by mixing the one-hot label with a uniform distribution. It can be seen as distilling knowledge from a simplistic 'teacher'.
- Data-Free Distillation: Techniques that generate synthetic data or leverage the teacher's own representations to produce soft targets when the original training data is unavailable.
- Online Distillation: A paradigm where the teacher model is not static but is updated concurrently with the student, meaning the soft targets are dynamically evolving during training.
- Self-Distillation: A model distills knowledge from its own deeper layers or earlier training checkpoints, using self-generated soft targets.
How Soft Targets Work in Knowledge Distillation
A technical breakdown of soft targets, the probability distributions used to transfer 'dark knowledge' from a teacher model to a student model.
Soft targets are the continuous, probabilistic output distributions generated by a teacher model's final softmax layer, used as training labels for a student model in knowledge distillation. Unlike hard, one-hot labels that only indicate the correct class, these softened probabilities encode the teacher's learned inter-class relationships and confidence levels—often called dark knowledge—providing a richer training signal. The distribution is typically softened using a temperature scaling parameter (T > 1) in the softmax function to make the probabilities less peaked and easier for the student to learn from.
The student model is trained to minimize a distillation loss, most commonly the Kullback-Leibler divergence, between its own output distribution and the teacher's soft targets. This objective is often combined with a standard cross-entropy loss using the original hard labels. By learning to match these nuanced probability vectors, the compact student model internalizes the teacher's generalization behavior and relative similarity judgments between classes, frequently achieving higher accuracy than if trained on hard labels alone. This process is fundamental to compressing large models for efficient on-device deployment.
Soft Targets vs. Hard Targets
A comparison of the two primary label types used to train machine learning models, highlighting the specific advantages of soft targets for knowledge distillation.
| Feature | Soft Targets | Hard Targets |
|---|---|---|
Definition | The full probability distribution output by a teacher model's final softmax layer. | A one-hot encoded vector where the correct class is 1 and all others are 0. |
Information Content | Rich, containing relative probabilities for all classes, including inter-class similarities (dark knowledge). | Sparse, containing only the identity of the single correct class. |
Primary Use Case | Training a student model via knowledge distillation. | Standard supervised training of a model from scratch. |
Label Source | Generated dynamically by a pre-trained teacher model. | Provided by the original dataset annotation. |
Training Signal | Provides a smoother, more informative gradient by indicating how 'wrong' answers relate to the correct one. | Provides a sharp, high-variance gradient focused solely on the correct class. |
Regularization Effect | High, as it prevents the student from becoming overconfident and encourages learning a broader feature space. | Low, can encourage overfitting to the specific training examples. |
Typical Loss Function | Kullback-Leibler Divergence (KL Divergence) between teacher and student distributions. | Categorical Cross-Entropy between predictions and the one-hot label. |
Temperature Scaling | Required. A temperature parameter (T > 1) softens the distribution to amplify dark knowledge. | Not applicable. Uses the standard softmax (T=1). |
Frequently Asked Questions
Soft targets are a core concept in knowledge distillation, the process of training a compact student model using the outputs of a larger teacher model. These FAQs address common questions about their role, mechanics, and advantages.
Soft targets are the continuous probability distributions output by a neural network's final softmax layer, which contain richer information than traditional hard labels. Unlike a hard label (e.g., [0, 0, 1, 0] for class 3), a soft target (e.g., [0.05, 0.15, 0.75, 0.05]) encodes the teacher model's confidence across all classes, including inter-class similarities and relative difficulty—a concept known as dark knowledge. This probabilistic output serves as the supervisory signal for training a smaller student model in the knowledge distillation process, enabling it to learn a more nuanced decision boundary.
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.
Related Terms
Soft targets are a core component of knowledge distillation. The following terms define the key mechanisms, loss functions, and architectural frameworks that enable this powerful model compression technique.
Knowledge Distillation
Knowledge distillation is a model compression technique where a smaller, more efficient student model is trained to mimic the behavior and outputs of a larger, more powerful teacher model. The process transfers the teacher's learned representations, including the rich dark knowledge in its soft targets, to the compact student.
- Primary Goal: Create a deployable model with minimal performance drop.
- Core Mechanism: Uses a distillation loss (e.g., KL Divergence) to align student outputs with teacher outputs.
- Applications: Enables deployment of large models (e.g., BERT, GPT) on mobile devices and edge hardware.
Teacher-Student Framework
The teacher-student framework is the foundational architecture for knowledge distillation. It consists of a pre-trained, often cumbersome teacher model and a lightweight, trainable student model.
- Teacher Role: Provides supervisory signals beyond simple class labels, typically via its logits or soft targets.
- Student Role: Learns to approximate the teacher's function through a combined loss of distillation loss and standard cross-entropy loss.
- Key Insight: The student learns the teacher's generalization behavior, often achieving better performance than if trained on hard labels alone.
Temperature Scaling
Temperature scaling is a technique used to soften the teacher model's output probability distribution, making the soft targets richer and easier for the student to learn from. A temperature parameter (T) is applied to the softmax function.
- Mechanism:
softmax(logits / T). Higher T values produce a softer, more uniform probability distribution. - Purpose: Amplifies the dark knowledge—the relative differences between non-target classes that are suppressed in a standard (T=1) softmax.
- Training: The same T is used when computing the distillation loss for the student. At inference, T is set back to 1.
Dark Knowledge
Dark knowledge refers to the implicit, inter-class relationships and similarities captured within a trained neural network's softened output probabilities. This information, not present in one-hot labels, is the key value transferred via soft targets.
- Source: A model's confidence that a 'cat' image also somewhat resembles a 'lynx' or 'tiger'.
- Transfer: By learning to match these softened probabilities, the student model internalizes a more nuanced understanding of the data manifold.
- Analogy: It is the 'how' and 'why' behind a prediction, not just the final 'what' of a hard label.
Logits Distillation
Logits distillation is a direct form of knowledge distillation where the student model is trained to match the raw, pre-softmax output logits of the teacher model, rather than its post-softmax probabilities.
- Advantage: Avoids the potential information loss from the softmax saturation. Gradients can flow more directly.
- Loss Function: Typically uses Mean Squared Error (MSE) between teacher and student logits.
- Relation to Soft Targets: Logits can be seen as the unnormalized precursors to soft targets. Applying temperature scaling to logits before a softmax generates the softened distributions used in standard distillation.
Kullback-Leibler Divergence (KL Divergence)
Kullback-Leibler divergence is a statistical measure of how one probability distribution diverges from a second, reference distribution. It is the most common distillation loss function for matching soft targets.
- Role in Distillation: Minimizes the KL Divergence between the student's softened output distribution and the teacher's softened output distribution.
- Formula:
KL(P_teacher || P_student) = Σ P_teacher * log(P_teacher / P_student). It is asymmetric. - Interpretation: Measures the extra information (in nats or bits) required to encode samples from the teacher's distribution using the student's distribution. A lower KL divergence indicates a better match.

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