Moment Matching Training for Neural Machine Translation: A Preliminary Study

Cong Duy Vu Hoang, Ioan Calapodescu, Marc DymetmanarXiv 2018

Abstract

In previous works, neural sequence models have been shown to improve significantly if external prior knowledge can be provided, for instance by allowing the model to access the embeddings of explicit features during both training and inference. In this work, we propose a different point of view on how to incorporate prior knowledge in a principled way, using a moment matching framework. In this approach, the standard local cross-entropy training of the sequential model is combined with a moment matching training mode that encourages the equality of the expectations of certain predefined features between the model distribution and the empirical distribution. In particular, we show how to derive unbiased estimates of some stochastic gradients that are central to the training, and compare our framework with a formally related one: policy gradient training in reinforcement learning, pointing out some important differences in terms of the kinds of prior assumptions in both approaches. Our initial results are promising, showing the effectiveness of our proposed framework.

Introduction

Standard Neural Machine Translation (NMT) models are typically trained using cross-entropy (CE) loss, which focuses on local token-level prediction. While effective, this approach often suffers from label bias and fails to capture global sequence properties, such as desired length or specific vocabulary constraints. Consequently, models may produce translations that are too short or repetitive despite high token-level accuracy.

To address these issues, researchers often employ Reinforcement Learning (RL) with rewards like BLEU. However, RL can be arbitrary, requiring the manual design of reward functions. This paper proposes a more principled alternative: Moment Matching (MM). Instead of inventing rewards, MM forces the model's output distribution to match the statistical "moments" (averages) of specific features found in the training data.

Methodology

The core of the proposed framework is the Moment Matching objective, which aims to minimize the squared distance between the model's expected feature values and the empirical averages from the data.

Feature Functions and Objectives

Users define feature functions $\Phi(y|x)$ representing properties of interest, such as source-to-target length ratios or the presence of specific bilingual dictionary terms. The goal is to align the model's expectation of these features with the empirical data.

Gradient Derivation and Comparison

A key contribution is the derivation of a stochastic gradient for the MM loss. As shown in Figure 1, the MM update rule shares structural similarities with the Policy Gradient (RL w/ PG) method, involving a "multiplicative score" that scales the standard gradient based on how far a sample's features are from the target average.

Comparison of training formulations for Cross-Entropy (CE), Reinforcement Learning (RL), and Moment Matching (MM).

Unlike RL, where rewards are often independent of the training data, MM is inherently data-driven. The "arbitrariness" is restricted to the selection of features, while the target values are derived directly from the empirical distribution.

Training Implementation

To ensure efficiency, the authors use a "Jackknife-style" sampling method to obtain unbiased estimates of the gradients. The MM loss is integrated with standard CE through either alternation (switching between steps) or interpolation (weighted sum of losses).

Experimental Results

The framework was evaluated on the IWSLT’15 English-to-Vietnamese dataset (133K pairs) using a Transformer architecture.

Method BLEU MM Loss (Length)
Baseline (Transformer) 28.53 0.00948
Base + MM (Length Ratio) 29.17 0.00687
Base + MM (Lexical Dict) 29.11 0.7128 (MM Loss Lexical)

The results demonstrate that incorporating MM for length ratio or lexical dictionary features leads to statistically significant improvements in BLEU scores over the baseline.

Conclusion and Future Work

Moment Matching acts as a sequence-level regularizer, encouraging the model to respect global constraints. This preliminary study shows that MM can effectively handle multiple objectives without manual weighting, provided they are included in the feature vector. Future work will explore scaling to larger datasets (e.g., WMT), utilizing more complex semantic features, and extending the framework via kernel methods like Maximum Mean Discrepancy (MMD).

Summary updated

Abstract

In previous works, neural sequence models have been shown to improve significantly if external prior knowledge can be provided, for instance by allowing the model to access the embeddings of explicit features during both training and inference. In this work, we propose a different point of view on how to incorporate prior knowledge in a principled way, using a moment matching framework. In this approach, the standard local cross-entropy training of the sequential model is combined with a moment matching training mode that encourages the equality of the expectations of certain predefined features between the model distribution and the empirical distribution. In particular, we show how to derive unbiased estimates of some stochastic gradients that are central to the training, and compare our framework with a formally related one: policy gradient training in reinforcement learning, pointing out some important differences in terms of the kinds of prior assumptions in both approaches. Our initial results are promising, showing the effectiveness of our proposed framework.
BibTeX
@misc{hoang2018moment,
  author = {Cong Duy Vu Hoang and Ioan Calapodescu and Marc Dymetman},
  title = {{Moment Matching Training for Neural Machine Translation: A Preliminary Study}},
  year = {2018},
  eprint = {1812.09836},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.09836},
}
Figure