arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.08696cs.CLcs.LG
收藏

变废为宝:通过令牌回收加速大型语言模型推理

Turning Trash into Treasure: Accelerating Inference of Large Language Models with Token Recycling

Harbin Institute of Technology(哈尔滨工业大学);Du Xiaoman (Beijing) Science Technology Co., Ltd.(杜小满(北京)科技有限公司)

Xianzhen Luo, Yixuan Wang, Qingfu Zhu, Zhiming Zhang, Xuanyu Zhang, Qing Yang, Dongliang Xu

AI总结:

提出令牌回收方法,利用解码中候选令牌的重复性构建草稿树加速LLM推理,仅需不到2MB存储,实现约2倍加速,优于现有免训练方法30%。

摘要:

大型语言模型(LLMs)的庞大参数使得推理延迟成为根本瓶颈。投机解码(Speculative Decoding)是一种无损加速推理的方法,采用猜测-验证(guess-and-verify)范式。一些方法依赖额外架构来猜测草稿令牌,这需要在使用前进行额外训练。另一种基于检索的免训练技术则通过从现有语料库或n-gram生成来构建库。然而,这些方法面临存储需求大、检索耗时和适应性有限等挑战。我们观察到,解码过程中生成的候选令牌很可能在未来的序列中再次出现,因此提出了令牌回收(Token Recycling)方法。它将候选令牌存储在邻接矩阵中,并采用类似广度优先搜索(BFS)的算法构建草稿树,然后通过树注意力(tree attention)进行验证。解码过程中的新候选令牌随后用于更新矩阵。令牌回收仅需不到2MB的额外存储,并在各种规模的LLM上实现了约2倍的加速。它显著优于现有免训练方法30%,甚至比一种广泛认可的训练方法高出25%。

英文摘要:

Massive parameters of LLMs have made inference latency a fundamental bottleneck. Speculative decoding represents a lossless approach to accelerate inference through a guess-and-verify paradigm. Some methods rely on additional architectures to guess draft tokens, which need extra training before use. Alternatively, retrieval-based training-free techniques build libraries from pre-existing corpora or by n-gram generation. However, they face challenges like large storage requirements, time-consuming retrieval, and limited adaptability. Observing that candidate tokens generated during the decoding process are likely to reoccur in future sequences, we propose Token Recycling. It stores candidate tokens in an adjacency matrix and employs a breadth-first-search (BFS)-like algorithm to construct a draft tree, which is then validated through tree attention. New candidate tokens from the decoding process are then used to update the matrix. Token Recycling requires \textless2MB of additional storage and achieves approximately 2x speedup across all sizes of LLMs. It significantly outperforms existing train-free methods by 30\% and even a widely recognized training method by 25\%.

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

↑