arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.00085cs.CL
收藏

基于Trie解码的高效大语言模型束搜索

Efficient Beam Search for Large Language Models Using Trie-Based Decoding

Department of Computer Science, National Chengchi University(国立成功大学计算机科学系);Department of Computer Science, Cornell University(康奈尔大学计算机科学系);Institute of Information Science, Academia Sinica(中华科学研究院资讯研究所)

Brian J Chan, MaoXun Huang, Jui-Hung Cheng, Chao-Ting Chen, Hen-Hsen Huang

AI总结:

本文提出基于trie的并行解码方法,通过在共同前缀束间共享KV缓存,显著降低束搜索内存占用并提升解码速度,在多种注意力架构上验证有效。

摘要:

本文提出了一种新颖的基于trie(前缀树)的并行解码方法,以解决基于批处理的束搜索中内存效率低下的问题。通过在具有共同前缀的束之间共享单个KV缓存,我们的方法大幅降低了内存使用量,并实现了高效解码。我们在三种注意力架构上评估了该方法:多头注意力(Phi-3.5-mini-instruct)、分组查询注意力(Llama-3.1-8B-Instruct)和滑动窗口注意力(Mistral-Small-24B-Instruct-2501),使用CNN/DailyMail进行抽象式摘要生成,并使用HumanEval进行代码生成。实验结果表明,在不牺牲生成质量的前提下,内存节省显著(4--8倍),解码速度提升最高达2.4倍。这些结果凸显了我们的方法适用于内存受限环境和大规模部署。

英文摘要:

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-mini-instruct), Grouped Query Attention (Llama-3.1-8B-Instruct), and Sliding Window Attention (Mistral-Small-24B-Instruct-2501), using CNN/DailyMail for abstractive summarization and HumanEval for code generation. Our experiments demonstrate substantial memory savings (4--8$\times$) and up to 2.4$\times$ faster decoding, without compromising generation quality. These results highlight our method's suitability for memory-constrained environments and large-scale deployments.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑