Label Smoothing
Telling a classifier its correct label is 100% certain pushes it toward extreme, overconfident logits; label smoothing quietly lowers the target to something like 90%, spreading a little probability onto the wrong classes on purpose.
Prerequisites: Cross-Entropy and Log Loss
A classifier trained with an ordinary one-hot label — 100% probability on the correct class, 0% on every other — has an incentive to push its raw scores toward plus and minus infinity, because softmax only reaches an output of exactly 1 in the limit of an infinitely large logit gap. Chasing that unreachable target makes the model's weights grow large and its confidence badly calibrated: it becomes extremely sure of itself, including on inputs it's actually getting wrong. Label smoothing removes the impossible target by replacing it with an achievable one.
The analogy: never promising 100% certainty
A trader who says "I am 100% certain this trade wins" is either lying or hasn't thought about tail risk — a well-calibrated trader hedges even a high-conviction view, saying "90% likely, with 10% spread across everything that could go wrong." Label smoothing forces a model into the same habit at training time: instead of telling it "this example is the eagle class with 100% certainty, 0% everything else," it says "90% eagle, and split the remaining 10% evenly across every other class" — a target the model can actually reach without its weights running off to infinity.
The formula
For classes and smoothing parameter (a small number like 0.1), the smoothed target for the true class becomes:
In words: instead of putting all probability mass on the true class, put of it there, and spread the remaining evenly across every class including the true one — so the true class ends up with a little more than , and every wrong class gets a small nonzero share instead of exactly zero.
Worked example 1: computing smoothed targets by hand
Suppose classes and . The true class gets . Each of the other 4 classes gets . Check it sums to 1: . Compare to the unsmoothed one-hot target of : the model is now being trained toward — still confidently pointing at the right answer, but never asked to reach an impossible logit gap.
Worked example 2: the effect on cross-entropy loss at convergence
Cross-entropy loss is where is the model's predicted probability. With a one-hot target, loss is minimized only as , requiring the pre-softmax logit for class to diverge to relative to the others — loss keeps shrinking without ever hitting zero, so the optimizer keeps pushing weights larger indefinitely. With the smoothed target from example 1, loss is minimized when the model's own output probabilities match exactly — a finite, achievable set of logits, at which point the gradient is exactly zero and training stops pushing weights further.
Label smoothing replaces a one-hot target with on the true class and spread over all classes, giving the model a finite, reachable optimum instead of an infinitely-confident one — which controls overconfidence and improves calibration at a small, fixed cost in training simplicity.
What this means in practice
Label smoothing is a one-line change (label_smoothing=0.1 in most framework loss functions) and is standard in image classification and machine translation training recipes; it tends to improve calibration — how well a model's stated confidence matches its actual accuracy — which matters whenever a model's output probability is used as a sizing signal rather than just a top-1 prediction. It costs a small amount of peak training accuracy in exchange for that calibration and for some resistance to noisy or mislabeled training data.
The common confusion is treating label smoothing as purely a regularizer that only affects overfitting. Its main effect is on calibration, not just generalization: it directly targets the mechanism by which the model becomes overconfident (the unreachable one-hot optimum), which is a distinct failure mode from high variance between train and test accuracy. A model can be well-regularized in the ordinary sense and still be badly overconfident, and label smoothing is aimed specifically at that second problem.
Related concepts
Practice in interviews
Further reading
- Szegedy et al., Rethinking the Inception Architecture for Computer Vision (2016)