FlashTrie: A GPU-Accelerated Constrained Beam Search for Generative Retrieval

Dakshitha B Anandakumar, Anurag Mukkara, Wenxiang Hu, Akash Kumar Mohankumar, Jiusheng Chen, Qiang Lou, Jian Jiao, Ting Ye


Abstract
Constrained decoding is essential in generative retrieval, where document identifiers generated directly from a query must exactly match a predefined library of valid IDs. At scale, decoding is often constrained using a trie with beam search but most implementations run on CPU. Limited parallelism then makes trie traversal and candidate validation a serving bottleneck as beam width grows.

We present FlashTrie, which addresses this limitation by optimizing constrained beam search on GPUs. It introduces an integer-aware succinct trie layout that uses bit compression to reduce memory footprint while keeping the full index in GPU high-bandwidth memory reducing memory stalls, and a cooperative CUDA kernel that performs beam expansion, validation, and pruning entirely on-device without per-step host orchestration. GPU-native parallel primitives further replace CPU-style irregular lookup and heap maintenance, improving warp utilization and reducing divergence.

Together, these designs significantly reduce decoding latency and increase throughput while preserving retrieval quality. On a library of 800M keywords with beam widths up to 1000, FlashTrie reduces trie-search latency to under 2 ms mean latency, achieving up to 24× speedup over a highly optimized multi-threaded CPU baseline. These improvements enable FlashTrie to scale beam sizes by up to 5× in latency-critical applications such as sponsored search. In a large-scale online A/B experiment on a commercial search engine, it delivers a statistically significant +0.71% revenue lift, enabling real-time constrained decoding at a scale previously impractical within our production serving budget
Anthology ID:
2026.emnlp-industry.157
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing: Industry Track
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Pepa Atanasova, Gholamreza Haffari, Minghan Wang
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
2662–2683
Language:
URL:
https://aclanthology.org/2026.emnlp-industry.157/
DOI:
Bibkey:
Cite (ACL):
Dakshitha B Anandakumar, Anurag Mukkara, Wenxiang Hu, Akash Kumar Mohankumar, Jiusheng Chen, Qiang Lou, Jian Jiao, and Ting Ye. 2026. FlashTrie: A GPU-Accelerated Constrained Beam Search for Generative Retrieval. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing: Industry Track, pages 2662–2683, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
FlashTrie: A GPU-Accelerated Constrained Beam Search for Generative Retrieval (Anandakumar et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-industry.157.pdf