Attention Forcing for Machine Translation

Qingyun Dou, Yiting Lu, Potsawee Manakul, Xixin Wu, Mark J. F. GalesarXiv 2021

Abstract

Auto-regressive sequence-to-sequence models with attention mechanisms have achieved state-of-the-art performance in various tasks including Text-To-Speech (TTS) and Neural Machine Translation (NMT). The standard training approach, teacher forcing, guides a model with the reference output history. At inference stage, the generated output history must be used. This mismatch can impact performance. However, it is highly challenging to train the model using the generated output. Several approaches have been proposed to address this problem, normally by selectively using the generated output history. To make training stable, these approaches often require a heuristic schedule or an auxiliary classifier. This paper introduces attention forcing for NMT. This approach guides the model with the generated output history and reference attention, and can reduce the training-inference mismatch without a schedule or a classifier. Attention forcing has been successful in TTS, but its application to NMT is more challenging, due to the discrete and multi-modal nature of the output space. To tackle this problem, this paper adds a selection scheme to vanilla attention forcing, which automatically selects a suitable training approach for each pair of training data. Experiments show that attention forcing can improve the overall translation quality and the diversity of the translations.

Introduction

Neural Machine Translation (NMT) has seen significant advancements through the use of sequence-to-sequence models equipped with attention mechanisms. Despite their success, these models face a fundamental challenge known as exposure bias. During training, models typically employ "Teacher Forcing," where the ground truth previous word is provided to predict the next. However, during inference, the model must rely on its own previously generated (and potentially erroneous) words. This discrepancy can lead to cascading errors, where a single mistake early in a sentence causes the entire output to diverge into gibberish.

Methodology: Automatic Attention Forcing (AAF)

To bridge the gap between training and inference, researchers have proposed Attention Forcing. Originally successful in Text-to-Speech (TTS), this technique uses the model's own generated output history during training but "forces" the model to use reference attention weights from a pre-trained teacher model. This decouples the act of aligning words from the act of generating them.

In NMT, however, Vanilla Attention Forcing (VAF) often fails. Because NMT is multi-modal—meaning there are multiple valid ways to translate a sentence—forcing a specific attention map on a model that has generated a valid but different word sequence creates a conflict. To address this, the authors introduce Automatic Attention Forcing (AAF). AAF utilizes a selection scheme where the model performs two forward passes for each training step:

  • Pass A: Uses the generated history (the "risky" path).
  • Pass B: Uses the reference history (the standard Teacher Forcing path).
The Automatic Attention Forcing (AAF) architecture, illustrating the dual-pass selection mechanism (Pass A and Pass B) to stabilize training.

The system calculates the KL-divergence between the predicted and reference attention. If the model's generated path remains well-aligned with the reference, it trains on Pass A. If it drifts too far, it reverts to the safety of Pass B. This data-driven selection replaces the need for complex manual schedules or auxiliary classifiers.

Experimental Results

The researchers evaluated AAF on the IWSLT 2015 dataset for English-to-French (EnFr) and English-to-Vietnamese (EnVi) tasks. AAF demonstrated consistent improvements over standard Teacher Forcing, achieving a 0.44 BLEU gain on EnFr and a 0.55 BLEU gain on EnVi.

Translation Quality and Diversity

Beyond raw quality, AAF significantly improved the diversity of translations. By learning from its own generated history, the model becomes more robust to different linguistic paths, resulting in higher entropy and lower pairwise BLEU scores in the EnVi task. This suggests the model is less rigid and better at exploring the multi-modal space of valid translations.

Comparison of attention heatmaps between a baseline model (left) and the AAF-trained model (right), showing more focused and accurate alignments.

Stability and Robustness

Unlike methods like Scheduled Sampling, which require carefully tuned decay schedules, AAF's selection mechanism is inherently stable. It automatically adapts to the difficulty of the training data, allowing the model to explore its own output space without falling into "garbage" states. This makes it a more robust choice for training complex NMT systems across different language pairs.

Conclusion

Automatic Attention Forcing provides a robust solution to exposure bias in NMT. By decoupling alignment from generation and using a dynamic selection scheme, AAF improves both the accuracy and the creative diversity of machine translation systems. Future work may involve reducing the dependency on a pre-trained teacher model and extending the technique to non-attention-based architectures.

Summary updated

BibTeX
@misc{dou2021attention,
  author = {Qingyun Dou and Yiting Lu and Potsawee Manakul and Xixin Wu and Mark J. F. Gales},
  title = {{Attention Forcing for Machine Translation}},
  year = {2021},
  eprint = {2104.01264},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.01264},
}
Figure