On the Inference Calibration of Neural Machine Translation

Shuo Wang, Zhaopeng Tu, Shuming Shi, Yang Liu

Abstract

Neural Machine Translation (NMT) models typically demonstrate strong calibration during training when evaluated using teacher forcing. However, this paper identifies a significant "inference gap": models become severely miscalibrated during real-world autoregressive generation due to exposure bias. By analyzing the linguistic and architectural roots of this phenomenon, the authors propose Graduated Label Smoothing, a confidence-aware regularization technique that significantly improves both model reliability and translation quality.

The Calibration Challenge in NMT

In machine learning, calibration is the degree to which a model’s predicted probability (confidence) matches its actual success rate (accuracy). For NMT, calibration is vital for "human-in-the-loop" systems; a translator needs to know when to trust the machine and when to intervene.

Previous research suggested that standard NMT models are well-calibrated. However, this paper highlights a major oversight: those studies evaluated models using "teacher forcing," where the model is fed the correct previous word. In real-world inference, the model predicts words one by one based on its own previous, potentially incorrect outputs. This exposure bias leads to a massive calibration gap, where Expected Calibration Error (ECE) can jump from 1.39 during training to 15.83 during inference.

Reliability diagrams illustrating the stark contrast in calibration between the training phase (teacher forcing) and the inference phase (autoregressive generation).

Methodology: Quantifying Inference Errors

To measure calibration during inference, the researchers used the Translation Error Rate (TER) toolkit to align model outputs with reference translations. This allows for the categorization of generated tokens into four types: Correct (C), Substitution (S), Insertion (I), or Deletion (D). This granular labeling is essential for identifying where and why a model's confidence deviates from its actual performance.

The TER labeling process used to align system-generated tokens with ground-truth references for inference-time evaluation.

Linguistic and Architectural Insights

The study identifies several key factors driving miscalibration:

  • Syntactic Roles: Verbs are more likely to be over-estimated than other parts of speech.
  • Sentence Position: Under-estimation (under-confidence) happens more frequently at the beginning of a sentence, a phenomenon termed "Left Bias."
  • Granularity: Sub-words (BPE) are significantly more miscalibrated than full words, likely because they represent rarer or more complex morphological units.
  • Model Scaling: Increasing model depth or width improves BLEU scores but consistently worsens calibration. Interestingly, enlarging only the encoder improves performance without damaging calibration as much as enlarging the decoder.

Graduated Label Smoothing

Standard label smoothing applies a uniform penalty to the ground-truth label. The authors propose a "graduated" version where the penalty is adjusted based on confidence levels: a higher penalty (e.g., 0.3) for high-confidence predictions (>0.7) and a lower or zero penalty for low-confidence ones. This prevents the model from becoming overconfident in scenarios where it is likely to fail.

Key Results

  • Reliability Improvements: On the WMT14 En-De task, Graduated Label Smoothing reduced inference ECE from 14.26 to 5.07 (a ~64% improvement) while providing a slight boost in BLEU score.
  • Beam Search Robustness: Well-calibrated models are much more robust when using large beam sizes. While standard models often see translation quality drop with very large beams (the "beam search curse"), calibrated models maintain or improve their performance.
  • Error Correlation: Over-estimated predictions correlate strongly with over-translation (insertions) and mis-translation (substitutions), while under-estimated predictions correlate with under-translation (deletions).

Conclusion

The discovery of the inference calibration gap underscores the need for more realistic evaluation metrics in NMT. Graduated Label Smoothing offers a practical and effective way to bridge this gap, leading to translation systems that are both more accurate and more trustworthy for human collaborators.

Summary updated

BibTeX
@inproceedings{wang2020inference,
  author = {Shuo Wang and Zhaopeng Tu and Shuming Shi and Yang Liu},
  title = {{On the Inference Calibration of Neural Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.278},
}
Figure