Efficient Beam Search for Large Language Models Using Trie-Based Decoding
Brian J. Chan, Mao Xun Huang, Jui-Hung Cheng, Chao-Ting Chen, Hen-Hsen Huang
Abstract
This work presents a novel trie (prefix-tree)based parallel decoding method that addresses the memory inefficiency of batch-based beam search. By sharing a single KV cache across beams with common prefixes, our approach dramatically reduces memory usage and enables efficient decoding. We evaluated our method across three attention architectures, Multi-Head Attention (Phi-3.5-miniinstruct), Grouped Query Attention (Llama-3.1-8B-Instruct), and Sliding Window Attention (Mistral-Small-24B-Instruct-2501), using CN-N/DailyMail for abstractive summarization and HumanEval for code generation. Our experiments demonstrate substantial memory savings (4-8×) and up to 2.4× faster decoding, without compromising generation quality. These results highlight our method's suitability for memory-constrained environments and largescale deployments.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 5b8c092b-08fa-4922-b78b-744cc8bab3e6Cited by top-tier papers2
- DocQAC: Adaptive Trie-Guided Decoding for Effective In-Document Query Auto-CompletionRahul Mehta, Kavin R. V, Indrajit Pal, Tushar Abhishek et al.SIGIR 2026
- BioCG: Constrained Generative Modeling for Biochemical Interaction PredictionAmitay Sicherman, Kira RadinskyNeurIPS 2025
Builds on7
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
- Let's Verify Step by StepHunter Lightman, Vineet Kosaraju, Yuri Burda, Harrison Edwards et al.ICLR 2024 · 3,045 citations
- FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 citations
- Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding HeadsTianle Cai, Yuhong Li, Zhengyang Geng, Hongwu Peng et al.ICML 2024 · 669 citations
- SpecInfer: Accelerating Large Language Model Serving with Tree-based Speculative Inference and VerificationXupeng Miao, Gabriele Oliaro, Zhihao Zhang, Xinhao Cheng et al.ASPLOS 2024 · 105 citations
Related papers
- CoDec: Prefix-Shared Decoding Kernel for LLMsZhibin Wang, Rui Ning, Chao Fang, Zhonghui Zhang et al.SIGMOD 2026 · 8 citations
- DeFT: Decoding with Flash Tree-attention for Efficient Tree-structured LLM InferenceJinwei Yao, Kaiqi Chen, Kexun Zhang, Jiaxuan You et al.ICLR 2025
- Lexico: Extreme KV Cache Compression via Sparse Coding over Universal DictionariesJunhyuck Kim, Jongho Park, Jaewoong Cho, Dimitris PapailiopoulosICML 2025
- HShare: Fast LLM Decoding by Hierarchical Key-Value SharingHuaijin Wu, Lianqiang Li, Hantao Huang, Tu Yi et al.ICLR 2025
- KV Cache Transform Coding for Compact Storage in LLM InferenceKonrad Staniszewski, Adrian LancuckiICLR 2026 · 9 citations
