The Implicit Length Bias of Label Smoothing on Beam Search Decoding

Bowen Liang, Pidong Wang, Yuan Cao

Introduction

Label Smoothing (LS) is a ubiquitous technique in training Neural Machine Translation (NMT) models, known for improving generalization by preventing overconfidence. However, this paper identifies a significant side effect: LS implicitly introduces a "length penalty" that biases models toward shorter, lower-quality translations during beam search. This phenomenon explains the long-standing paradox where increasing the beam size—searching more exhaustively—often leads to degraded translation performance.

The Mechanics of Length Bias

The authors demonstrate mathematically that LS-trained models are subject to a theoretical maximum output length. For a standard configuration ($\alpha=0.1$, vocabulary size 32k), a model may prefer an empty translation over any sequence exceeding approximately 121 tokens.

This bias arises because LS redistributes probability mass from the ground-truth token to the entire vocabulary. During decoding, every generated token incurs a small "cost" from this redistributed mass. In log-probability space, this manifests as a constant penalty per token: $T \log(1-\alpha)$, where $T$ is the sequence length. Consequently, the model learns to minimize this penalty by terminating sequences prematurely.

Proposed Solution: Debiasing at Inference

To counteract this bias, the researchers propose a "rectification" or debiasing step during inference. Instead of using raw probabilities, they apply a simple transformation to "undo" the smoothing:

$$p^{db} = \frac{\text{ReLU}(\hat{p} - \delta)}{\sum \text{ReLU}(\hat{p}_j - \delta)}$$

Here, $\delta$ serves as a "noise floor" hyperparameter. By subtracting $\delta$ and re-normalizing, the artificial background noise introduced by LS is filtered out, allowing the model to accurately evaluate longer sequences.

Impact of debiasing parameter $\delta$ on BLEU scores across different beam sizes $K$.

Experimental Evaluation

The method was tested on several WMT benchmarks, including English-German (EnDe), English-Czech (EnCs), English-Chinese (EnZh), and English-French (EnFr). All models utilized a 32k-entry SentencePiece vocabulary.

Key Results

The debiasing method consistently improved translation quality, measured by BLEU scores, across all tested languages and beam sizes. The gains were particularly pronounced for large beam sizes, where the length bias is typically most destructive.

BLEU scores for various translation tasks comparing standard Label Smoothing (LS) and the proposed debiasing method.
  • Large Beam Gains: For a beam size of 200, the method achieved improvements of up to +2.8 BLEU (EnZh).
  • Length Recovery: Debiased models produced translations with length ratios significantly closer to 1.0, effectively solving the "short-windedness" of standard LS models.
  • Superiority over No-LS: Models trained with LS and then debiased outperformed models trained without LS entirely, confirming that the benefits of LS during training can be preserved while mitigating its inference-time flaws.

Discussion and Future Work

While the theoretical "optimal" value for $\delta$ is $\alpha/V$, empirical results showed that larger values often performed better. This suggests that the rectification method addresses additional sources of model noise beyond just label smoothing.

One limitation is that $\delta$ requires tuning for specific tasks and beam sizes. Future research might explore training objectives that align the training distribution more closely with the desired inference distribution, potentially eliminating the need for post-hoc fixes. Additionally, investigating whether this bias affects other architectures like Large Language Models (LLMs) or different decoding strategies like nucleus sampling remains an open question.

Summary updated

Abstract

Label smoothing is ubiquitously applied in Neural Machine Translation (NMT) training. While label smoothing offers a desired regularization effect during model training, in this paper we demonstrate that it nevertheless introduces length biases in the beam search decoding procedure. Our analysis shows that label smoothing implicitly applies a length penalty term to output sequence, causing a bias towards shorter translations. We also show that for a model fully optimized with label smoothing, translation length is implicitly upper bounded by a fixed constant independent of input. We verify our theory by applying a simple rectification function at inference time to restore the unbiased distributions from the label-smoothed model predictions. This rectification method led to consistent quality improvements on WMT English-German, English-French, English-Czech and English-Chinese tasks, up to +0.3 BLEU at beam size 4 and +2.8 BLEU at beam size 200.
BibTeX
@misc{liang2022implicit,
  author = {Bowen Liang and Pidong Wang and Yuan Cao},
  title = {{The Implicit Length Bias of Label Smoothing on Beam Search Decoding}},
  year = {2022},
  eprint = {2205.00659},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.00659},
}
Figure