Using Context in Neural Machine Translation Training Objectives

Danielle Saunders, Felix Stahlberg, Bill Byrne

Abstract

We present Neural Machine Translation (NMT) training using document-level metrics with batch-level documents. Previous sequence-objective approaches focus exclusively on sentence-level metrics like sentence BLEU, which do not correspond to the desired evaluation metric, typically document BLEU. We propose merging document-level context with training procedures by sampling pseudo-documents from sentence samples and approximating the expected document BLEU gradient with Monte Carlo sampling for Minimum Risk Training (MRT). This two-level sampling procedure gives NMT performance gains over sequence MRT and maximum-likelihood training. We demonstrate that training is more robust for document-level metrics and show improvements on NMT with TER and Grammatical Error Correction (GEC) using GLEU.

Introduction

In Neural Machine Translation (NMT), a persistent "objective-evaluation mismatch" exists. Models are typically trained using Maximum Likelihood Estimation (MLE) or sentence-level metrics like sentence-BLEU (sBLEU), yet they are evaluated using document-level metrics. Sentence-level metrics often fail to capture document-level quality; for example, a sentence might score zero in sBLEU due to lack of 4-gram matches while still contributing correctly to the overall document's n-gram precision. While architectural improvements have been explored, changing the training objective to account for document-wide context remains under-researched.

Methodology: Document-Level Minimum Risk Training

The proposed approach builds upon Minimum Risk Training (MRT), where the model minimizes the expected risk based on a specific metric. To scale this to documents, two innovations are introduced:

  1. Pseudo-documents and True Context: Batches are constructed either from sentences within the same document ("true context") or randomly grouped sentences ("pseudo-documents").
  2. Ordered Document Sampling: Calculating document-level metrics over all possible sample combinations is computationally prohibitive ($N^S$ combinations for $S$ sentences and $N$ samples). The authors propose sorting the $N$ samples for each sentence (e.g., by sBLEU) and concatenating the $n$-th sample of every sentence to form $N$ "ordered" documents.
Comparison of sampling strategies for MRT: Seq-MRT vs. Doc-MRT (ordered) vs. Doc-MRT (random).

This ordered strategy ensures a wide, discriminative range of document scores, providing a clearer gradient signal for optimization.

Experimental Setup

The method was evaluated on two primary tasks:

  • NMT (English-German): Initial training on 17.5M sentence pairs (WMT19), followed by fine-tuning on WMT news test sets (2008–2016). Evaluation was performed on newstest2018.
  • Grammatical Error Correction (GEC): Training on NUCLE and Lang-8 (660K sentences), with evaluation on JFLEG and CoNLL 2014.

Results and Discussion

Document-level metrics proved more robust than sentence-level ones. By aggregating statistics over more tokens, they mitigate the "zero-precision" problem common in sBLEU for short sentences.

Translation Performance

On English-German translation, Doc-MRT (ordered) achieved a peak score of 43.9 BLEU with $N=8$ samples, significantly outperforming the MLE baseline (41.0) and standard Seq-MRT (43.5).

BLEU scores for various models across random and document batches.

Notably, Doc-MRT is highly sample-efficient, showing gains with as few as 8 samples, whereas previous sequence-level MRT research often required 20 or more. Using Translation Edit Rate (TER) as an objective also yielded improvements, with Doc-TER reaching 38.9 (lower is better), while sequence-level TER degraded performance.

Grammatical Error Correction

In GEC tasks using the GLEU metric, Doc-MRT (ordered) showed significant gains. On the JFLEG dataset, it achieved a GLEU of 51.4, compared to 50.1 for the MLE baseline and 50.0 for Seq-MRT.

Conclusion

Doc-MRT effectively bridges the gap between training objectives and evaluation metrics. However, it is most effective as a fine-tuning step; training from scratch is difficult because initial samples are too poor to provide a meaningful signal. Future work includes exploring larger contexts beyond the mini-batch and applying this framework to other structured loss functions like reinforcement learning.

Summary updated

BibTeX
@inproceedings{saunders2020using,
  author = {Danielle Saunders and Felix Stahlberg and Bill Byrne},
  title = {{Using Context in Neural Machine Translation Training Objectives}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.693},
}
Figure