Massive-scale Decoding for Text Generation using Lattices

Jiacheng Xu, Siddhartha Jonnalagadda, Greg Durrett

Abstract

Modern text generation models typically rely on Beam Search, which often produces redundant outputs and prunes high-quality candidates prematurely. This paper introduces a decoding framework using Best-First Search (BFS) and hypothesis recombination to generate dense lattices. By merging similar paths, the approach encodes thousands of diverse, high-quality hypotheses efficiently, significantly improving oracle performance on summarization and translation tasks. Our results on the XSum dataset show that this method can produce lattices encoding nearly 100,000 unique paths, dramatically expanding the search space for downstream reranking.

Introduction

When modern AI systems summarize news articles or translate sentences, they typically provide a single "best" answer. While users can request multiple variations using Beam Search (BS), these outputs are often frustratingly similar—frequently differing only by minor surface variations like changing an article from "the" to "a."

Researchers from UT Austin and Amazon Alexa AI argue in "Massive-scale Decoding for Text Generation using Lattices" that this linear approach to decoding is fundamentally limited. Instead of searching for a handful of isolated paths, they propose building massive, interconnected "lattices" that encode thousands of high-quality possibilities simultaneously. This shift moves text generation away from narrow guesses toward a dense representation of the model's entire belief space.

Beam Search vs. Search with Recombination: Traditional methods produce redundant linear paths, while lattices encode variations compactly.

Standard decoding algorithms like Beam Search suffer from two primary flaws that hinder diversity and quality:

  1. Redundancy: BS often explores paths that are nearly identical, wasting computational resources on minor variations that do not offer new perspectives or information.
  2. Efficiency and Pruning: BS prunes away many "good enough" paths early in the generation process. Analysis reveals that in standard beam search, over 50% of the computation is spent on nodes that are ultimately discarded and never appear in any final output.

While stochastic methods like Nucleus Sampling can provide diversity, they often sacrifice grammatical quality or redundantly rediscover the same hypotheses. The challenge lies in efficiently generating a massive, diverse set of high-quality candidates without a computational explosion.

Methodology: Best-First Search and Recombination

The proposed framework introduces two structural shifts to the decoding process:

Modified Best-First Search (BFS)

Unlike Beam Search, which expands a fixed number of candidates at each time step, BFS uses a priority queue to expand the most promising node regardless of its length. To prevent the search from stalling on short prefixes, the authors introduce Depth-First Path Completion. Every time a node is expanded, the algorithm immediately runs a greedy search to the end of the sentence (the EOS token). This ensures every explored node is part of at least one completed, valid sentence.

Hypothesis Recombination

This mechanism is the core innovation of the work. If two different sentence prefixes are likely to lead to the same future words, the algorithm merges them into a single node in a lattice. For example, prefixes like "A Cardiff recycling company..." and "A Cardiff waste management company..." can be merged if they share a common suffix and are likely to continue with the same phrase, such as "has gone into bankruptcy."

The algorithmic flow of hypothesis recombination, showing how nodes are popped from the search frontier and merged into a target path.

Two variants are introduced:

  • RCB (Recombination): Merges paths that share an n-gram suffix.
  • ZIP: A more aggressive version that propagates merges backwards through the lattice to create an even more compact structure.

Evaluation and Results

The researchers evaluated the approach on Abstractive Summarization (XSum dataset with BART-large) and Machine Translation (WMT14/19 with mBART). The results demonstrate a significant leap in decoding scale and potential quality:

  • Massive Scale: On the XSum task, the BFSZIP method produced lattices encoding an average of 95,744 unique paths, compared to just 20 for standard Beam Search.
  • Oracle Potential: The "Oracle" ROUGE-2 score—the best possible match found within the generated set—reached 35.8 for the lattice method, significantly outperforming Beam Search’s 26.3. This suggests that while the model "knows" the correct answer, standard decoding simply fails to find it.
  • Computational Efficiency: Even when restricted to 25% of the computational budget of standard baselines, BFSZIP outperformed beam search in both diversity and oracle quality.
  • Grammaticality: Despite aggressive merging, the generated paths remained highly grammatical, with error rates comparable to standard, less diverse methods.

Discussion and Future Directions

While the lattice approach offers a powerful new data structure for text generation, several hurdles remain for widespread adoption. Current deep learning frameworks are optimized for the structured, parallel nature of Beam Search; the irregular nature of BFS makes it harder to parallelize efficiently on GPUs. Additionally, at points of high model uncertainty (high entropy), the lattice may encode various factual errors, such as conflicting dates or names.

Ultimately, this work provides a foundational framework for "generate-then-rank" pipelines. By providing a massive search space of high-quality options, it paves the way for more sophisticated secondary models to select the ideal output for specific user contexts.

Summary updated

BibTeX
@inproceedings{xu2022massive,
  author = {Jiacheng Xu and Siddhartha Jonnalagadda and Greg Durrett},
  title = {{Massive-scale Decoding for Text Generation using Lattices}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.344},
}
Figure