With label smoothing ϵ on K classes, what is the target distribution, and what is the gradient of the cross-entropy loss with respect to the logits? For K=3, ϵ=0.1 and true class 2, what are the target vector and the logit gap the model is pushed towards?

Deep learning, Training and regularisation
Level L3 Intermediate. Length Short. Nature Mat Mathematical.

What's being asked

Whether you can write the smoothed target, and see that it gives the logits a finite optimum.

Key idea

Label smoothing moves a fraction ϵ of the target's mass from the true class to a uniform spread. With one-hot y, ykLS=(1−ϵ) yk+ϵK, and ∂L∂z=p−yLS, where z are the logits and p=softmax⁡(z). The loss is minimised at p=yLS, so the logits stay finite.

Steps

  1. Write the smoothed target: yLS=(1−ϵ) y+ϵ u, where u is uniform over the K classes.
  2. For K=3, ϵ=0.1 and true class 2: yLS=[0.0333, 0.9333, 0.0333].
  3. Gradient: the softmax cross-entropy gradient is still prediction minus target, ∂L/∂z=p−yLS.
  4. Optimum: p=yLS. Since p2/p1=ez2−z1, this gives z2−z1=ln⁡0.93330.0333=ln⁡28≈3.33. With hard labels the optimum needs z2−zk→∞, which drives over-confidence.
  5. Effects: better calibration (predicted probabilities closer to true frequencies) and often slightly better accuracy. It can hurt knowledge distillation, because it erases information in the wrong-class probabilities.

Common mistakes

How long your answer should be

4–5 lines; 2 minutes.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: How does the multiply-accumulate cost of a standard k×k convolution compare with that of a depthwise separable convolution (k×k depthwise followed by 1×1 pointwise), for an H×W output with Cin input and Cout output channels? What is the ratio for k=3 and Cout=256?
Next in Deep learning: How do you derive the Xavier (Glorot) and He initialisation variances from the requirement that activation variance stays constant from layer to layer?