Uncertainty Determines the Adequacy of the Mode and the Tractability of Decoding in Sequence-to-Sequence Models

Felix Stahlberg, Ilia Kulikov, Shankar Kumar · DOI

In the field of Natural Language Processing, the Transformer architecture has become the standard for sequence-to-sequence (Seq2Seq) tasks. However, researchers have long observed a puzzling discrepancy: the same model architecture behaves fundamentally differently depending on the task. In Machine Translation (MT), the model often suffers from the "beam search curse"—where a more thorough search for the most likely output actually degrades quality. In contrast, tasks like Grammatical Error Correction (GEC) show no such pathology.

New research from Google and NYU suggests that these behaviors are not flaws of the Transformer itself, but are instead determined by the intrinsic uncertainty of the underlying task. By comparing high-uncertainty tasks (MT) with low-uncertainty tasks (GEC), the authors demonstrate how task ambiguity dictates the shape of the probability distribution and the feasibility of finding an optimal output.

The Problem: Decoding Pathologies

Standard Seq2Seq models use beam search to approximate the "mode"—the single most likely sequence according to the model's learned probability distribution. In Machine Translation, this process is often plagued by three specific issues:

  1. The Beam Search Curse: Increasing the beam size (searching more candidates) frequently leads to lower BLEU scores because the model begins to prefer unnaturally short, generic sequences.
  2. Inadequacy of the Mode: Even when the true most likely sequence is found, it is often a poor translation.
  3. Search Errors: Beam search frequently fails to find the actual mode of the distribution, even with relatively large beam sizes.

The authors hypothesized that these pathologies are tied to the nature of the task. MT is inherently ambiguous; a single sentence can have dozens of valid translations. GEC is much more constrained, as there are typically only a few ways to correct a specific grammatical error.

To investigate this, the researchers introduced two primary tools:

1. Measuring Intrinsic Uncertainty ($u$)

The authors quantified task uncertainty by calculating the average relative Levenshtein (edit) distance between multiple human-provided reference translations for the same input. A high $u$ value indicates that human experts disagree significantly on the "correct" output, signaling high task ambiguity.

2. Exact $n$-best Search (NbestDFS)

Because standard beam search is only an approximation, it is difficult to tell if a model's failure is due to a bad search or a bad probability distribution. The authors developed a novel exact search algorithm based on Depth-First Search (DFS). This algorithm is guaranteed to find the true top-$n$ most likely sequences, allowing for a precise measurement of the model's probability landscape.

Key Insights: Peaky vs. Flat Distributions

The study compared MT datasets (WMT19) against GEC datasets (CoNLL-2014, JFLEG) and revealed a stark contrast in how the model assigns probability:

  • Low-Uncertainty Tasks (GEC): These tasks result in "peaky" distributions. The model is highly confident; the single best hypothesis often carries as much as 40% of the total probability mass. In these cases, search errors are rare, and increasing the beam size never hurts performance—it simply saturates.
  • High-Uncertainty Tasks (MT): These tasks result in "flat" distributions. The model spreads its probability across a vast number of candidates. Even the top 1,000 translations combined might account for less than 20% of the total probability. In this environment, finding the true mode is computationally difficult and often yields a sequence that is mathematically likely but linguistically poor.

The Impact of Sentence Length

The research further found that uncertainty scales with sequence length. As sentences grow longer, the number of valid ways to translate them increases exponentially. This leads to higher search error rates and makes the "mode" an increasingly unreliable target for decoding. For MT, even with a massive beam size of 500, the search failed to find the true mode for over 20% of sentences. In GEC, search errors effectively vanished with a beam size of only 10.

Conclusion and Future Directions

This study proves that the "beam search curse" is a property of task uncertainty rather than a fundamental flaw in the Transformer architecture. When a task is highly ambiguous, the most likely sequence (the mode) is no longer a reliable representative of the model's knowledge.

For high-uncertainty tasks like MT, the authors suggest moving away from mode-seeking search algorithms. Instead, they advocate for decision rules like Minimum Bayes Risk (MBR) decoding. MBR looks for a consensus across many likely hypotheses rather than putting all its weight on a single, potentially pathological mode. This shift in perspective could lead to more robust decoding strategies for open-ended tasks like dialogue and creative writing, where uncertainty is a feature, not a bug.

Summary updated

BibTeX
@inproceedings{stahlberg2022uncertainty,
  author = {Felix Stahlberg and Ilia Kulikov and Shankar Kumar},
  title = {{Uncertainty Determines the Adequacy of the Mode and the Tractability of Decoding in Sequence-to-Sequence Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.acl-long.591},
}
Figure