Soft targets, also called soft labels, are the probability distributions output by a teacher model's final softmax layer, often after applying temperature scaling (T > 1). Unlike hard one-hot labels that assign 100% probability to a single class, these softened distributions encode the teacher's relative confidence across all classes, capturing inter-class similarities and dark knowledge. This richer information serves as the primary learning signal for training a smaller student model.
Glossary
Soft Targets / Soft Labels

What are Soft Targets / Soft Labels?
In machine learning, particularly knowledge distillation, soft targets are the probabilistic outputs of a teacher model that provide a richer training signal than traditional hard labels.
Using soft targets as the training objective, typically via a Kullback-Leibler Divergence loss, allows the student model to learn the nuanced decision boundaries and generalization patterns of the larger teacher. This is the core mechanism of knowledge distillation, enabling the creation of compact, efficient models that retain much of the teacher's accuracy. The technique is foundational to models like DistilBERT and TinyBERT.
Key Characteristics of Soft Targets
Soft targets are the probability distributions output by a teacher model's final softmax layer, containing richer information than hard labels. They are the primary learning signal in knowledge distillation.
Probabilistic Distributions
Unlike hard targets (one-hot encoded vectors), soft targets are full probability distributions over all possible classes. For a classification task with N classes, a soft target is a vector of N values where each value represents the model's confidence that the input belongs to that class. The sum of these probabilities is 1. This format conveys the teacher's uncertainty and relative similarity between classes.
- Example: For an image of a cat, a hard label is
[1, 0, 0]for classes [cat, dog, car]. A corresponding soft target from a well-trained teacher might be[0.85, 0.12, 0.03], indicating the model is highly confident it's a cat, sees some visual similarity to a dog, and is very sure it's not a car.
Contain Dark Knowledge
The primary value of soft targets is the dark knowledge they encode. This term, coined by Geoffrey Hinton, refers to the rich, inter-class similarity information learned by the teacher model during training. A one-hot label only tells the student that 'this is a cat.' A soft target additionally conveys that 'this is very much a cat, somewhat similar to a lynx, but not at all like a truck.'
This relational information acts as a powerful regularizer and learning signal, teaching the student the nuanced relationships within the data manifold that the teacher has discovered. It is this dark knowledge that allows a small student model to often match or exceed the performance of training solely on hard labels.
Temperature-Scaled
Soft targets are almost always generated using temperature scaling applied to the teacher's logits (pre-softmax activations). The standard softmax function is modified with a temperature parameter T: softmax(logits / T).
- T = 1: Produces the teacher's normal output distribution.
- T > 1: 'Softens' the distribution, making it smoother. Probabilities become more uniform, amplifying the differences between non-argmax classes. This makes the dark knowledge more pronounced and easier for the student to learn.
- T → ∞: Distribution becomes uniform.
- T < 1: Sharpens the distribution, making it more like a one-hot vector.
A typical value for distillation is T between 2 and 10. During student inference, T is set back to 1.
Primary Training Signal
In the canonical knowledge distillation loss function, the soft targets provide the main learning objective. The total loss (L_total) is a weighted sum of two components:
L_total = α * L_hard + (1 - α) * L_soft
- L_soft: The distillation loss, typically the Kullback-Leibler (KL) Divergence between the student's temperature-scaled soft predictions and the teacher's temperature-scaled soft targets. This term forces the student to mimic the teacher's probability distribution.
- L_hard: The standard cross-entropy loss with the ground-truth hard labels. This term anchors the student to the true labels.
- α: A weighting hyperparameter (often small, e.g., 0.1).
This combination allows the student to learn both the correct answer and the teacher's refined understanding of the problem space.
Contrast with Hard Labels
Understanding the functional differences between soft and hard targets clarifies why distillation works.
| Characteristic | Hard Target (One-Hot) | Soft Target |
|---|---|---|
| Information | Single bit of truth (class ID). | Rich probability distribution. |
| Gradient Signal | Provides a single, strong gradient for the correct class. | Provides many smaller, nuanced gradients across all classes. |
| Regularization | Limited implicit regularization. | Strong explicit regularization via dark knowledge. |
| Noise Handling | Treats all misclassifications equally. | Encodes similarity; a mistake between 'cat' and 'dog' is less penalized than between 'cat' and 'airplane'. |
Soft targets provide a denser, more informative training signal, which is particularly valuable when the student model has limited capacity, as it learns a smoother, more generalizable function.
Applications Beyond Classification
While foundational to classification tasks, the concept of soft targets extends to other domains:
- Regression: Teacher's continuous predictions (with uncertainty estimates) can serve as soft targets.
- Reinforcement Learning: In policy distillation, the action probability distribution (policy) of a complex teacher agent is distilled into a student.
- Object Detection: The teacher's bounding box confidence scores and class distributions for region proposals can be soft targets.
- Natural Language Processing: Teacher's next-token probability distributions over a large vocabulary are used to distill language models (e.g., DistilBERT).
- Cross-Modal Tasks: A student model in one modality (e.g., text) can learn from the soft predictions of a teacher in another modality (e.g., vision).
The core principle remains: transferring the teacher's refined, probabilistic understanding of the task is more effective than training only on ground-truth data.
How Do Soft Targets Work in Distillation?
Soft targets are the probability distributions output by a teacher model, which serve as a richer training signal for a student model than traditional hard labels.
Soft targets, also called soft labels, are the output of a teacher model's final softmax layer, typically after applying temperature scaling (T > 1). This process softens the probability distribution, reducing the confidence gap between the top prediction and other classes. This distribution encodes dark knowledge—the teacher's learned understanding of inter-class similarities—which provides a more informative gradient for the student model than a one-hot encoded hard label.
During training, the student model minimizes a distillation loss, such as Kullback-Leibler (KL) Divergence, between its own softened outputs and the teacher's soft targets. This primary objective is often combined with a standard cross-entropy loss using the original hard labels. By learning to match this richer probability distribution, the student generalizes better, often achieving higher accuracy than if trained on hard labels alone, despite having significantly fewer parameters.
Soft Targets vs. Hard Labels: A Comparison
A comparison of the two primary types of supervisory signals used to train machine learning models, highlighting their distinct properties and roles in knowledge distillation.
| Feature / Characteristic | Soft Targets (Soft Labels) | Hard Labels (One-Hot Labels) |
|---|---|---|
Definition | A probability distribution over classes, typically the output of a teacher model's softmax layer (often with temperature scaling). | A one-hot encoded vector assigning a probability of 1.0 to the ground-truth class and 0.0 to all others. |
Information Content | Rich, containing relative probabilities and inter-class similarity information (dark knowledge). | Sparse, containing only the identity of the single correct class. |
Primary Use Case | The primary learning signal in knowledge distillation for training a student model. | The standard supervisory signal for training a model directly on a labeled dataset. |
Source | Generated by a pre-trained teacher model or an ensemble. | Derived directly from the dataset's ground-truth annotations. |
Training Objective | Minimize divergence (e.g., KL Divergence) between student and teacher output distributions. | Minimize cross-entropy loss between model predictions and the one-hot vector. |
Effect on Model Calibration | Encourages the student model to produce calibrated, less overconfident probability estimates. | Can lead to overconfident predictions, as the model is trained to output extreme probabilities. |
Role in Distillation Loss | Forms the basis of the distillation loss term (e.g., L_KD). | Forms the basis of the standard cross-entropy loss term (e.g., L_CE), often used alongside distillation loss. |
Handling of Label Noise / Ambiguity | Robust; provides a probabilistic, softer target for ambiguous or mislabeled examples. | Brittle; incorrect or noisy hard labels directly contradict the model's training objective. |
Practical Applications and Examples
Soft targets are the primary vehicle for transferring 'dark knowledge' from a teacher to a student model. Their applications extend beyond standard classification to improve model calibration, enable data-efficient training, and facilitate learning in complex domains.
Core Mechanism in Knowledge Distillation
The canonical use of soft targets is in Knowledge Distillation (KD). A pre-trained teacher model (e.g., a large BERT model) generates softened class probabilities for a training batch. The student model (e.g., DistilBERT) is then trained using a composite loss:
- Distillation Loss (KL Divergence): Minimizes the statistical difference between the student's and teacher's soft predictions.
- Hard Label Loss (Cross-Entropy): Ensures alignment with the ground-truth one-hot labels. This dual signal provides richer information than hard labels alone, allowing the student to learn inter-class similarities (e.g., that a 'cat' is more similar to a 'lynx' than to a 'truck').
Improving Model Calibration and Generalization
Models trained solely on hard one-hot labels often become overconfident, assigning near-1.0 probability to their predictions even when wrong. Training with soft targets acts as a regularizer:
- Label Smoothing Effect: Soft targets inherently prevent the model from becoming maximally confident on any single class.
- Better Uncertainty Estimation: The student learns to output more nuanced probability distributions that better reflect true uncertainty, especially on ambiguous or out-of-distribution samples.
- Reduced Overfitting: The softened signal provides a less noisy training target, which can improve generalization performance on validation and test sets.
Enabling Data-Free and Data-Efficient Training
Soft targets unlock training paradigms where original data is scarce or unavailable:
- Data-Free Distillation: A teacher model can generate soft labels for synthetically created inputs (e.g., via adversarial generation), enabling a student to be trained without any real data.
- Dataset Distillation: The goal is to synthesize a tiny, core dataset where the soft labels for each synthetic sample capture the essential information of a large original dataset.
- Learning from Noisy Labels: In crowdsourced or weakly labeled data, aggregating multiple annotations into a soft label (a probability distribution) can provide a more robust learning signal than using a single, potentially incorrect, hard label.
Cross-Modal and Policy Distillation
The concept extends to transferring knowledge between different model types and domains:
- Cross-Modal Distillation: A powerful image teacher model generates soft labels for a set of images. A text-based student model (e.g., a vision-language model's text encoder) learns to predict these labels from textual descriptions, transferring visual knowledge into the language modality.
- Policy Distillation in Reinforcement Learning (RL): A complex RL teacher agent's action-selection policy (a probability distribution over actions) serves as the soft target. A simpler, more efficient student policy is trained to mimic this distribution, enabling deployment in latency-sensitive environments.
- Federated Knowledge Distillation (FKD): A central server sends a teacher model's soft predictions to client devices. Local student models train on this consensus, sharing only soft labels instead of raw private data, enhancing privacy.
Temperature Scaling for Information Control
The temperature (T) parameter is a critical hyperparameter for manipulating the information content of soft targets.
- High Temperature (T >> 1): Dramatically softens the probability distribution, making it more uniform. This emphasizes the dark knowledge—the relative differences between non-true classes—which is most valuable for distillation.
- Low Temperature (T ≈ 1): Produces a distribution closer to the original hard targets. Used in later training stages or when the student capacity is high.
- Practical Tuning: A common practice is to use a high T (e.g., 4-20) during the main distillation phase and anneal it to 1 for final fine-tuning. The loss function scales the distillation loss by T² to keep gradients manageable.
Real-World System: DistilBERT and TinyBERT
Prominent examples demonstrate the industrial application of soft targets:
- DistilBERT: Uses a triple loss during pre-training: 1) Language Modeling loss (MLM), 2) Cosine Embedding loss on hidden states, and 3) Distillation loss on soft labels from BERT-base. This allows it to achieve 97% of BERT's GLUE score with 40% fewer parameters.
- TinyBERT: Implements a two-stage distillation (general and task-specific) that transfers knowledge from multiple layers:
- Embedding-layer output
- Attention matrices (Query, Key, Value)
- Hidden states of Transformer layers
- Prediction-layer logits (soft targets) This comprehensive use of soft information at different abstraction levels enables extreme compression without catastrophic performance loss.
Frequently Asked Questions
Soft targets, also known as soft labels, are the probability distributions output by a teacher model's final softmax layer. They contain richer inter-class similarity information than hard one-hot labels and serve as the primary learning signal for a student model in knowledge distillation.
Soft targets, also called soft labels, are the continuous-valued probability distributions output by a neural network's final softmax layer, typically after applying temperature scaling (T > 1). Unlike hard targets (one-hot encoded ground truth labels), which assign all probability mass to a single class, soft targets distribute probability across all possible classes, capturing the teacher model's relative confidence and the dark knowledge of inter-class similarities. For example, an image of a husky might yield a soft target of [dog: 0.7, wolf: 0.25, cat: 0.05], revealing the model's understanding of visual and semantic relationships that a simple "dog" label does not.
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 patterns that enable this knowledge transfer.
Knowledge Distillation (KD)
Knowledge Distillation (KD) is the overarching model compression technique where a smaller student model is trained to mimic the predictive behavior of a larger teacher model. The primary mechanism is for the student to learn from the teacher's softened output probabilities (soft targets), which contain dark knowledge about inter-class relationships, rather than just hard one-hot labels.
- Core Process: The teacher generates soft targets; the student is trained using a combined loss function.
- Objective: Achieve comparable accuracy to the teacher with a significantly reduced computational and memory footprint.
Temperature Scaling
Temperature scaling is a hyperparameter technique critical for generating effective soft targets. A temperature parameter (T), where T > 1, is applied to the softmax function of the teacher model's logits.
- Effect: Produces a smoother, more informative probability distribution. Higher values of T increase the entropy, spreading probability mass across more classes.
- Purpose: Reveals the dark knowledge—the teacher's learned similarities between classes (e.g., that a 'cat' is more similar to a 'dog' than to an 'airplane').
- Inference: The temperature is set back to T=1 when the final student model is deployed.
Distillation Loss (KD Loss)
The distillation loss is the composite objective function used to train the student model. It is typically a weighted sum of two components:
- Hard Loss: The standard cross-entropy loss between the student's predictions (with T=1) and the ground-truth one-hot labels.
- Soft Loss / Mimicry Loss: A measure of the difference between the student's and teacher's softened outputs. The most common is the Kullback-Leibler Divergence (KL Divergence) Loss.
The total loss is: L_total = α * L_hard + (1 - α) * L_soft, where α is a weighting hyperparameter.
Logits
Logits are the raw, unnormalized output vectors from the final linear layer of a neural network, before the application of the softmax function. In knowledge distillation, logits are the direct source from which soft targets are derived.
- Teacher Logits: The teacher's logits are scaled by the temperature (T) and then passed through softmax to create the training targets for the student.
- Student Logits: The student's logits are similarly scaled by T during training to compute the soft loss against the teacher's targets.
- Information: Logits contain the model's relative confidence scores for each class, which form the basis for the richer supervisory signal in distillation.
Dark Knowledge
Dark knowledge is the foundational concept that makes knowledge distillation effective. It refers to the rich, inter-class similarity information encoded within a trained model's softmax probabilities (after temperature scaling), which is not present in one-hot ground truth labels.
- One-Hot Label: Only says "this is class 7."
- Soft Target / Dark Knowledge: Says "this is most likely class 7, but it also has some characteristics of class 3 and a slight resemblance to class 9."
- Origin: Introduced by Geoffrey Hinton in the seminal 2015 distillation paper. The student learns this relational structure, leading to better generalization and often higher accuracy than training on hard labels alone.
Teacher & Student Models
These are the two primary agents in the distillation process.
- Teacher Model: A large, pre-trained, high-accuracy model (e.g., BERT, ResNet-50). It is frozen during distillation and serves as a source of soft targets and/or feature representations. Its role is purely to provide supervisory signals.
- Student Model: A smaller, more efficient model (e.g., DistilBERT, MobileNet) that is being trained. It learns by minimizing a loss function that aligns its outputs with both the ground truth and the teacher's softened predictions. The goal is to achieve a favorable accuracy-efficiency trade-off.

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