Learning Confidence for Transformer-based Neural Machine Translation

Yu Lu, Jiali Zeng, Jiajun Zhang, Shuangzhi Wu, Mu Li

Introduction

Modern Neural Machine Translation (NMT) systems, particularly those based on the Transformer architecture, have achieved remarkable fluency. However, they frequently suffer from miscalibration: the model's predicted probability for a word often fails to reflect its actual likelihood of being correct. In practice, these models tend to be "over-confident" in their errors or "under-confident" in correct translations. This lack of reliable self-assessment is a significant barrier to deploying NMT in safety-critical or high-stakes environments where human-in-the-loop systems or automated quality estimation (QE) are required.

This paper addresses this challenge by introducing an unsupervised framework that allows NMT models to "know what they don't know." By training a secondary Confidence Network (ConNet) alongside the primary NMT model, the authors create a well-calibrated confidence metric that significantly outperforms standard softmax probabilities in error detection and domain adaptation.

Methodology: The "Ask for Hints" Framework

The authors propose a novel training paradigm inspired by human learning and computer vision. The core idea is that a model's confidence is inversely proportional to its reliance on external help.

The Confidence Network (ConNet)

ConNet is a lightweight auxiliary network integrated into the Transformer decoder. It takes hidden states from the lower layers (typically layers 1-3) and predicts a confidence scalar $c_t$ (ranging from 0 to 1) for each token. The authors found that lower layers provide more neutral assessments of uncertainty, whereas top layers are often too specialized for the final prediction to offer unbiased confidence estimates.

Interpolated Prediction and Penalty

During training, the model is allowed to "ask for hints" by looking at the ground-truth label $y_t$. The final prediction used for the loss function is an interpolation between the model's prediction $p_t$ and the ground truth:

$$p'_t = c_t \cdot p_t + (1 - c_t) \cdot y_t$$

To prevent the model from "cheating" by always relying on the ground truth ($c_t = 0$), a penalty term $-\log(c_t)$ is added to the loss function. Consequently, the model only "buys" a hint if the reduction in translation loss is worth the associated penalty. This forces the model to rely on its own predictions when it is capable, effectively learning to assign high $c_t$ values to tokens it can predict accurately.

Confidence-based Label Smoothing

Standard label smoothing applies a fixed amount of noise to labels to prevent over-fitting. The authors improve upon this with instance-specific label smoothing, where the amount of smoothing is dynamically adjusted based on the ConNet’s predicted confidence for each specific word. This allows the model to be more flexible with difficult or ambiguous tokens while remaining certain about clear-cut translations.

Experimental Evaluation

The researchers evaluated the ConNet framework across several diverse benchmarks, including WMT14 English-German, LDC Chinese-English, and IWSLT14 German-English. They also tested the model's performance on Quality Estimation (QE) tasks and Out-of-Domain (OOD) detection using datasets like Tico-19 (medical) and Tanzil (religious texts).

Key Results

  • Improved Translation Quality: By utilizing confidence-based label smoothing, the models achieved gains of up to +1.17 BLEU points on Chinese-English tasks compared to standard Transformers.
  • Superior Quality Estimation: The learned confidence metric showed a significantly higher Pearson correlation with human Direct Assessment (DA) scores than standard softmax probabilities, making it a more reliable tool for QE.
  • Robust Risk Assessment: ConNet proved highly effective at identifying "noisy" training samples and detecting when a test sentence belonged to an unfamiliar domain (OOD), outperforming traditional probability-based methods.
  • Computational Efficiency: Unlike Monte Carlo Dropout methods, which require multiple forward passes to estimate uncertainty, ConNet is a "light component" that adds negligible overhead during inference.

Conclusion and Future Work

The ConNet framework provides a scalable, unsupervised solution to the calibration problem in NMT. By enabling models to quantify their own uncertainty, this research paves the way for more reliable automated translation systems. Future research directions include using these confidence estimates to design curriculum learning strategies—where models focus on easier sentences first—and developing automated triggers for human post-editing when confidence scores fall below a certain threshold.

Summary updated

BibTeX
@inproceedings{lu2022learning,
  author = {Yu Lu and Jiali Zeng and Jiajun Zhang and Shuangzhi Wu and Mu Li},
  title = {{Learning Confidence for Transformer-based Neural Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.acl-long.167},
}
Figure