Context-Aware Neural Machine Translation Decoding

Eva Martínez Garcia, Carles Creus, Cristina España-BonetDiscoMT @ EMNLP 2019

Abstract

This paper introduces a "plug-and-play" architecture to enhance Neural Machine Translation (NMT) by making it context-aware during the decoding phase. By fusing a standard NMT model with a Semantic Space Language Model (SSLM) at inference time, the authors achieve more consistent translations across sentences without the need for expensive retraining or scarce document-level annotated data. The approach demonstrates significant improvements in lexical consistency and a notable reduction in unknown word generation.

Introduction

Standard Neural Machine Translation (NMT) systems typically translate documents sentence-by-sentence in isolation. This "context-blindness" often leads to errors in lexical consistency—for example, using different synonyms for the same technical term in a single document or failing to resolve pronouns correctly.

While researchers have tried to solve this by building "document-level" NMT models, these usually require modifying the core neural architecture and retraining the entire system on specialized datasets where document boundaries are labeled. Such datasets are rare, and the resulting models are significantly slower and more complex to train. This paper investigates how to inject document-level context into an existing NMT system without modifying its training process.

Methodology

The authors employ a technique called Shallow Fusion to combine two independent models during the decoding (translation) process:

  1. The Baseline NMT: A standard attentional encoder-decoder model (RNN-based) that provides initial translation probabilities for the next word.
  2. The SSLM (Semantic Space Language Model): A model based on Word2Vec (CBOW) embeddings. It maintains a "cache" of the last 30 translated words (including those from previous sentences) and calculates the semantic similarity of candidate words to that context.

Instead of re-scoring every possible word in the vocabulary, the system only evaluates the top $N$ candidates proposed by the NMT model. It then adjusts their scores based on the SSLM's semantic "fit," allowing the system to favor words that are topically relevant to the preceding context.

Integration of NMT and SSLM scores during beam search for the word 'mostrador'.

Experimental Setup

  • NMT Training: Trained on the Europarl-v7 English–Spanish parallel corpus.
  • SSLM Training: The Spanish semantic model was trained on 759 million words from sources including Europarl-v7, United Nations, and Subtitles-2012.
  • Evaluation: The NewsCommentary2011 test set was processed document-by-document to preserve context. Quality was measured using BLEU and METEOR, alongside human evaluation.

Key Results and Discussion

The fused system achieved statistically significant gains over the baseline, with improvements of up to +0.23 BLEU and +0.31 METEOR. A major qualitative success was the 25% reduction in unknown (UNK) words; by providing a semantic "nudge," the system helped the NMT model select a valid, known word when it might have otherwise defaulted to an UNK token.

In human evaluations, native Spanish speakers preferred the fused system's translations 49% of the time, compared to 32% for the baseline. However, the authors noted that performance is sensitive to hyperparameters. Increasing the number of candidates ($N$) too much can introduce "noise," where the SSLM might push the system toward a semantically related word that is grammatically incorrect for the specific sentence structure.

Effect of the interpolation weight λ and the number of candidates N on translation quality (BLEU).

Conclusion

This research demonstrates that modeling context as semantic consistency is an effective and efficient way to improve NMT. Because the SSLM only re-scores a few top candidates, the computational overhead is minimal compared to document-level retraining. Future work will involve testing this architecture-agnostic approach on Transformer models and investigating its interaction with subword-level units like Byte Pair Encoding (BPE).

Summary updated

BibTeX
@inproceedings{garcia2019context,
  author = {Eva Martínez Garcia and Carles Creus and Cristina España-Bonet},
  title = {{Context-Aware Neural Machine Translation Decoding}},
  booktitle = {DiscoMT @ EMNLP},
  year = {2019},
  doi = {10.18653/v1/d19-6502},
}
Figure