TL;DR
Label smoothing is a small change to the target a classifier learns from. Instead of saying the correct class has probability 1 and every other class has probability 0, it gives the correct class a little less than 1 and spreads the rest over the other classes. The model is then trained toward an answer it can be confident about without being certain. That reduces overconfidence and often helps the model generalise to new inputs.
Builds on: Cross-Entropy Loss, Softmax · Leads to: Softmax Temperature, Overfitting
Where it's used
Image classification. The 2015 Inception-v3 paper introduced label smoothing as a regulariser for a network that labels photos into about a thousand categories. Training with it reduced how sharply the network trusted its training labels.
Machine translation. The 2017 Transformer translation models were trained with label smoothing. Translation has many acceptable outputs for one input, so a target that gives a little probability to near-miss words fits the task better than a hard single word.
Any large classifier with noisy labels. When some labels are wrong, a hard target teaches the model to be certain about the mistakes. A softened target limits how much any single wrong label can pull the model.
How it works
Follow one image through a three-class classifier: cat, dog and bird. The true class is cat. The smoothing amount is ε = 0.3.
- The model scores the image. The network gives raw scores, called logits: cat 2.0, dog 1.0, bird 0.0. Check: the cat score is highest.
- Softmax turns the scores into probabilities. The number e (about 2.718) is raised to the power of each score, and each result is divided by the sum of all the results. The sum is e² + e¹ + e⁰ = 7.389 + 2.718 + 1 = 11.107. So the probabilities are cat 0.665, dog 0.245 and bird 0.090. Check: they add to 1.
- The hard target. With no smoothing, the target is (1, 0, 0). The loss is the negative natural log (written ln) of the probability given to the true class, which is −ln 0.665 = 0.41. Gradient descent keeps pushing the cat probability toward 1, and the training never finishes, because 1 is never quite reached.
- The smoothed target. Mix the hard target with an equal share for every class. That share is ε / 3 = 0.1 for each class, since there are three classes. The true class gets 0.7 × 1 + 0.1 = 0.8, and each other class gets 0.7 × 0 + 0.1 = 0.1. The target is (0.8, 0.1, 0.1). Check: 0.8 + 0.1 + 0.1 = 1.
- The loss with the smoothed target. Use the same probabilities and the new target: L = −(0.8 ln 0.665 + 0.1 ln 0.245 + 0.1 ln 0.090), which is about 0.71. Check: this is larger than 0.41 because the target is now 0.8 for cat, not 1, so the same probabilities are judged as less than right.
- The best answer is now finite. Cross-entropy is smallest when the model's probabilities equal the target. So the model is pulled toward (0.8, 0.1, 0.1), and it has no reason to push the cat probability past 0.8.
- target for the true class, K = 3
- target for each other class
The math
Let there be K classes, let y be the one-hot target vector (a 1 for the true class and 0 elsewhere), and let ε be the smoothing amount between 0 and 1. The smoothed target is
for each class k. The entries of y' still sum to 1.
Step 4 in symbols
With K = 3 and ε = 0.3, the true class gets y'_cat = 0.7 × 1 + 0.3 / 3 = 0.8, and each other class gets y'_dog = y'_bird = 0.7 × 0 + 0.1 = 0.1. The sum is 0.8 + 0.1 + 0.1 = 1.
Step 5 in symbols
The loss is the cross-entropy with the smoothed target:
With p = (0.665, 0.245, 0.090) this equals about 0.71, since ln 0.665 ≈ −0.408, ln 0.245 ≈ −1.406 and ln 0.090 ≈ −2.408.
Step 6 in symbols
Cross-entropy with target y' is smallest when p = y'. So the best predicted probabilities are (0.8, 0.1, 0.1), not (1, 0, 0). The true-class probability is capped at , which is 0.8 here.
Worked examples
- Two classes, dog and cat. The true class is dog, so y = (0, 1).
- Choose ε = 0.2. Then y'_dog = 0.8 × 1 + 0.2 / 2 = 0.9 and y'_cat = 0.8 × 0 + 0.1 = 0.1.
- Check: 0.9 + 0.1 = 1.
- Interpretation: the target for the true class falls from 1 to 0.9, and the wrong class gets 0.1.
- Use the walkthrough model, p = (0.665, 0.245, 0.090), with true class cat.
- Hard-target loss: −ln 0.665 = 0.41.
- Smoothed-target loss: 0.8 × 0.408 + 0.1 × 1.406 + 0.1 × 2.408 = 0.326 + 0.141 + 0.241 = 0.71.
- Interpretation: the smoothed loss is larger, because the model is judged against 0.8 rather than 1, so it stops being rewarded once it is confident.
An image model has K = 1000 classes and uses ε = 0.1.
- True-class target: y'_true = 0.9 × 1 + 0.1 / 1000 = 0.9 + 0.0001 = 0.9001.
- Each wrong class: y' = 0.9 × 0 + 0.0001 = 0.0001.
- Check: 0.9001 + 999 × 0.0001 = 0.9001 + 0.0999 = 1.
- Interpretation: the model is asked for about 90 percent confidence in the true class, with the remaining probability spread thinly over the other 999 classes.
Try it: a ten-class model uses ε = 0.2. Find the true-class target and the target for each wrong class, then check that they sum to 1.
Answer: the true class gets 0.8 × 1 + 0.2 / 10 = 0.82, and each wrong class gets 0.2 / 10 = 0.02. Check: 0.82 + 9 × 0.02 = 0.82 + 0.18 = 1.
Common mistakes and tradeoffs
It is tempting to think label smoothing makes a model more accurate on every task. In fact it is a regulariser, like Dropout, and its gain depends on the task and the data. It often helps with image classification and translation, but it can hurt when a model's softened outputs are used as teacher signals for another model in distillation, because the teacher then carries less information about which wrong classes are close to the truth.
It is tempting to think the smoothed probabilities are the true odds of each class. In fact they are a training target, not a measurement of uncertainty. A model trained with label smoothing can still be miscalibrated in either direction, so if you need well-calibrated probabilities, check them or use a separate calibration step such as temperature scaling.
It is tempting to think a bigger ε is always safer. In fact as ε approaches 1 every target approaches uniform, and the model learns almost nothing about which class is right. Typical values are small.
When to use it: for a classifier trained with a cross-entropy loss, when the model is overconfident on its training data or the labels are noisy, and when extra compute is not available, since the change costs nothing at run time. When not to use it: when the outputs will serve as teacher targets in distillation, or when calibrated probabilities are the product itself. Alternatives include mixup, which blends inputs and labels, and confidence penalties, which add a term that rewards high Entropy in the predicted distribution.
History
The idea of training on softened targets became central with knowledge distillation, where a large model's soft outputs teach a smaller one; Hinton, Vinyals and Dean described that approach in 2015. Label smoothing as a named regulariser for classifiers was introduced in the 2015 arXiv version of the Inception-v3 paper, by Szegedy and colleagues, and it spread quickly once it appeared in strong image models. Its use in the 2017 Transformer translation models made it a default in many sequence models.
Recap
- A hard one-hot target asks the model for probability 1, which can never be reached and encourages overconfidence.
- Smoothing mixes the target with a uniform spread: y' = (1 − ε) y + ε / K.
- Cross-entropy against y' is smallest when the predicted probabilities equal y', so the true class is capped at 1 − ε + ε / K.
- The gain depends on the task, and the change can hurt when outputs serve as teacher targets.
Read next: Softmax Temperature for how a single scale parameter changes how sharp the outputs are, and Overfitting for the problem this regulariser is meant to reduce.
Check yourself
QuestionWhy does a hard one-hot target encourage overconfidence?Show answer
Its true-class probability is 1, so training keeps pushing the predicted probability toward 1 and never stops rewarding more confidence.
QuestionWith K = 4 classes and ε = 0.2, what is the target for the true class, and what is the target for each wrong class?Show answer
True class: 0.8 × 1 + 0.2 / 4 = 0.85. Each wrong class: 0.2 / 4 = 0.05. Check: 0.85 + 3 × 0.05 = 1.
QuestionWhy can label smoothing hurt when a model's outputs are used as teacher targets?Show answer
The softened outputs spread probability over wrong classes in a fixed way, so the teacher carries less information about which wrong classes are close to the true one. The student then learns less from the teacher's relative judgments.
QuestionA team wants a classifier whose 0.9 scores mean that about 90 percent of such predictions are correct. Is label smoothing alone enough to guarantee that?Show answer
No. Smoothing changes the training target, but it does not guarantee calibrated outputs. The team should check calibration on held-out data and apply a calibration step if needed.