On the path Attention paperTraining towards slightly softened targets: worse perplexity, better translations.
Targets that are too sharp
Trained with cross-entropy, a model is pushed to give the right answer probability 1. A softmax can only get there with scores that grow without end, so training keeps inflating them: the model becomes over-confident, and its probabilities stop meaning what they say. Label smoothing (Szegedy and colleagues, 2016) trains towards a softer target instead.
y is the right answer and V the number of possible answers; [j = y] is 1 for the right answer and 0 otherwise. A share ε of the target is taken from the right answer and spread evenly over all of them. The loss is the cross-entropy against q instead of against the one-hot target.
With six possible words and ε = 0.1 the right word’s target becomes 0.9 + 0.1/6 = 0.92 and every other word’s 0.017. The best the model can do is to match that, so its scores stay finite and its probabilities modest.
What it costs and gains
The model now always keeps some probability on wrong answers, so by the measure of plain likelihood it looks worse: its perplexity rises. But the right answer is still the most probable, and the gentler training often generalises better and gives better-calibrated probabilities. It acts as a regulariser on the output.
On the path Attention paper
In the paper. The Transformer used ε = 0.1 over its vocabulary of about 37,000 tokens (section 5.4). The paper says it plainly: this “hurts perplexity, as the model learns to be more unsure, but improves accuracy and BLEU score.” Table 3, row D, base model on the development set: without label smoothing perplexity 4.67 and 25.3 BLEU; with ε = 0.1, 4.92 and 25.8; with 0.2, 5.47 and 25.7.
Test yourself
With ε = 0.1 and four possible answers, what is the smoothed target?
0.9 + 0.1/4 = 0.925 for the right answer and 0.025 for each of the other three.
Why does a one-hot target keep inflating a softmax’s scores?
A softmax only gives probability 1 when the right score is infinitely far above the others, so the loss keeps rewarding larger gaps.
Why did label smoothing worsen the paper’s perplexity but improve its BLEU?
Perplexity rewards putting all probability on the right token, which smoothing forbids; BLEU only needs the right words chosen, and the softer training led to better choices.
Where it leads
Kept in this browser only, never sent.
Paths through it
- Attention paperstep 16 of 17Follow this path