EEL: Efficiently Encoding Lattices for Reranking

Prasann Singhal, Jiacheng Xu, Xi Ye, Greg Durrett

Introduction

In conditional text generation tasks such as machine translation or summarization, standard decoding strategies like beam search often prioritize high-probability sequences that may not align perfectly with human preferences. Reranking offers a solution by generating a pool of candidates and using a secondary, more sophisticated model to select the best one based on metrics like COMET or PARENT.

However, reranking is computationally expensive. Scoring hundreds of candidates typically requires hundreds of separate Transformer inference passes. While lattices (directed acyclic graphs) can compactly represent an exponential number of candidates, standard Transformers are designed for linear sequences and cannot natively process graph structures. EEL (Efficiently Encoding Lattices) addresses this bottleneck, enabling Transformers to rerank thousands of candidates in a single forward pass, achieving up to a 200x speedup.

Comparison of traditional reranking vs. token-factored reranking of lattices.

Methodology

The EEL framework consists of two primary innovations: Token-factored Rerankers and a specialized lattice encoding mechanism for Transformers.

Token-factored Rerankers (TFRs)

Traditional rerankers provide a global score for an entire sequence. In contrast, a TFR decomposes the total score into a sum of individual token-level scores. This factorization is essential because it enables the use of dynamic programming—specifically a Viterbi-like algorithm—to efficiently find the highest-scoring path through a complex lattice.

Efficient Lattice Encoding

To allow a Transformer to process a lattice in a single pass, EEL employs three key techniques:

  1. Linearization: All unique nodes within the lattice are laid out into a single sequence.
  2. Causal Reachability Mask: A custom attention mask is applied so that each token can only attend to tokens that precede it in a valid path within the lattice. This prevents information leakage between unrelated branches of the graph.
  3. Canonical Position Encodings: Position IDs are assigned based on a depth-first traversal of the lattice, ensuring the model understands the relative ordering of words as they would appear in a standard sentence.
The four-step process of EEL: from lattice input to best path extraction.

Experimental Evaluation

The authors evaluated EEL across several NLP tasks, including Machine Translation (WMT-2019), Table-to-Text (WebNLG 2017), and Document Summarization (XSum). TFRs were trained to approximate various metrics, such as COMET, PARENT, and Unique Noun Counts.

Key Results

  • Efficiency: EEL demonstrated massive speedups. For a lattice representing thousands of candidates, EEL required only 0.091 seconds for reranking, compared to 17.95 seconds for exhaustive search—a nearly 200x improvement.
  • Performance: EEL consistently outperformed standard beam search reranking on downstream metrics. Despite the "compressed" nature of the lattice encoding, the degradation in output quality compared to exhaustive scoring was negligible.
  • Factoring Accuracy: Token-level factorization did not significantly impact reranker performance, with TFRs losing only about 0.02 COMET points on average compared to non-factored models.

Discussion and Future Work

EEL demonstrates that lattices are highly effective "compressed" hypotheses. By encoding each unique token only once, EEL avoids the redundant computation inherent in scoring overlapping candidate sentences.

While the current implementation is optimized for causal (GPT-style) models, future work could extend this to bidirectional architectures. Additionally, the method shows promise for controlled generation tasks, where multiple rerankers could be combined to optimize for specific styles or constraints simultaneously.

Summary updated

BibTeX
@inproceedings{singhal2023eel,
  author = {Prasann Singhal and Jiacheng Xu and Xi Ye and Greg Durrett},
  title = {{EEL: Efficiently Encoding Lattices for Reranking}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.517},
}
Figure