Reward Augmented Maximum Likelihood for Neural Structured Prediction

Mohammad Norouzi, Samy Bengio, Zhifeng Chen, Navdeep Jaitly, Mike Schuster, Yonghui Wu, Dale Schuurmans

Structured prediction tasks, such as speech recognition and machine translation, require models to output complex sequences like sentences or audio transcripts. Traditionally, these models are trained using Maximum Likelihood (ML), which strictly penalizes any deviation from the exact ground-truth sequence. However, at test time, we evaluate these models using nuanced reward metrics—like BLEU scores or Edit Distance—that recognize degrees of correctness.

To bridge this gap, researchers at Google Brain introduced Reward Augmented Maximum Likelihood (RAML). This method elegantly combines the stability of standard supervised learning with the metric-awareness of reinforcement learning, leading to significant performance gains without the typical optimization headaches.

The Problem: Binary Penalties vs. Nuanced Rewards

In standard ML training, the objective is to make the model's output exactly match the ground truth. This creates a "binary" error landscape. If the target sentence is "The cat sat," the model is penalized equally for predicting "The cat stood" (a minor error) as it is for predicting "Banana phone" (a complete failure).

Reinforcement Learning (RL) offers a theoretical solution by directly optimizing the test-time rewards. However, RL is notoriously difficult to apply in structured prediction due to:

  1. High Variance: Gradients are noisy because the model must "guess" good outputs within a massive search space.
  2. Cold Start: RL often fails to learn unless it is first "warmed up" with standard ML.
  3. Computational Inefficiency: RL requires continuous sampling from the model's own distribution during training.

The RAML Approach

RAML integrates the task reward directly into the ML framework. Instead of maximizing the log-probability of only the exact ground truth $y^*$, RAML maximizes the expected log-probability over a payoff distribution $q$:

$$\mathcal{L}_{RAML} = -\sum_{(x, y^*) \in \mathcal{D}} \sum_{y \in \mathcal{Y}} q(y | y^*; \tau) \log p_\theta(y | x)$$

The Payoff Distribution

The distribution $q$ is designed so that the probability of picking an alternative output $y$ is proportional to its exponentiated reward: $q(y|y^*) \propto \exp(r(y, y^*) / \tau)$.

  • Reward ($r$): Typically a metric like negative edit distance or Hamming distance.
  • Temperature ($\tau$): A hyperparameter controlling the spread. As $\tau \to 0$, RAML collapses back to standard ML (only the ground truth has probability mass). As $\tau$ increases, the model is exposed to more "nearly correct" variations of the ground truth.

Efficient Sampling

To avoid the impossible task of enumerating every possible sentence to compute $q$, the authors derived a combinatorial formula to count the number of sequences at a specific edit distance from a target. This allows for efficient stratified sampling that can be pre-processed in parallel with training, making RAML just as fast as standard ML.

Key Insights

  • The KL Divergence Connection: The authors demonstrate that RL and RAML are mathematically complementary. RL minimizes the KL divergence between the model and the reward distribution in one direction ($KL(p || q)$), while RAML minimizes it in the reverse direction ($KL(q || p)$). The RAML direction is inherently more stable for optimization.
  • Principled Data Augmentation: RAML acts as a mathematically grounded form of data augmentation. Unlike injecting random noise, the "noise" in RAML is explicitly tied to the metric the model will be judged on at test time.
  • The "Imperfect" Teacher: Surprisingly, the best performance is often achieved at relatively high temperatures (e.g., $\tau = 0.9$).
Distribution of sampled edit distances at various temperatures.

As shown in the figure above, at $\tau = 0.9$, the model rarely sees the exact ground truth (0 edits, shown in dark red). Instead, the probability mass shifts, and the model mostly trains on sequences containing 5 to 9 edits. This "smoothing" effect forces the model to explore the space around the target, improving generalization.

Key Results

The authors evaluated RAML on two major benchmarks, demonstrating consistent improvements over strong baselines using standard Stochastic Gradient Descent (SGD)—without the complex tricks usually required for RL.

Speech Recognition (TIMIT)

On the TIMIT dataset for clean phone recognition, RAML achieved substantial gains using negative edit distance as the reward.

Phone Error Rate (PER) results on the TIMIT dataset.

As detailed in the table, RAML (denoted as RML) reduced the Test set Phone Error Rate (PER) from 22.18% (ML baseline) down to 19.89% at $\tau = 0.90$. This 2.3% absolute improvement was achieved using the exact same underlying model architecture.

Machine Translation (WMT'14)

On the massive WMT'14 English-to-French dataset (36 million sentence pairs), RAML improved the BLEU score from 36.50 to 36.91 (at $\tau = 0.85$). While the absolute numerical jump is smaller than in the speech task, it represents a highly significant gain on a competitive, state-of-the-art baseline.

Limitations and Future Work

While RAML is powerful, it has a few limitations:

  • Metric Complexity: The efficient sampling method relies on decomposable distances (like Hamming or Edit distance). Applying it to non-decomposable metrics like BLEU requires importance sampling, which is less efficient.
  • Vocabulary Constraints: The combinatorial counting formula makes simplifying assumptions (e.g., ignoring repetitive words in the target sequence), which could introduce slight biases in highly repetitive sequences.

Future work may explore extending RAML to other probabilistic models and adapting the sampling techniques for more complex, non-decomposable reward functions.

Summary updated

BibTeX
@inproceedings{norouzi2016reward,
  author = {Mohammad Norouzi and Samy Bengio and Zhifeng Chen and Navdeep Jaitly and Mike Schuster and Yonghui Wu and Dale Schuurmans},
  title = {{Reward Augmented Maximum Likelihood for Neural Structured Prediction}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
  url = {https://openreview.net/forum?id=iVuKLoDebdz},
}
Figure