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

SAM 解码:通过后缀自动机进行推测解码

SAM Decoding: Speculative Decoding via Suffix Automaton

School of Information, Renmin University of China(中国人民大学信息学院);Key Laboratory of Data Engineering and Knowledge Engineering(数据工程与知识工程重点实验室);Knowledge Engineering Group, Tsinghua University(清华大学知识工程组);Engineering Research Center of Database and Business Intelligence(数据库与商业智能工程研究中心)

Yuxuan Hu, Ke Wang, Xiaokang Zhang, Fanjin Zhang, Cuiping Li, Hong Chen, Jing Zhang

AI总结:

本文提出 SAM-Decoding,一种基于后缀自动机的推测解码方法,实现高效草稿生成,在 Spec-Bench 上比其他检索式方法快 18% 以上,并能与 EAGLE-2 结合进一步加速。

摘要:

推测解码(SD)已被证明是一种有效的无损 LLM 推理加速技术。基于检索的 SD 方法,作为一种无模型方法,已展现出有前景的加速效果,但它们通常依赖于不完整的检索资源、低效的检索方法,并且局限于特定领域。本文提出了一种新颖的基于检索的推测解码方法,该方法利用后缀自动机(SAM)通过利用常见文本语料库和动态文本序列来实现高效且准确的草稿生成。与现有的 n-gram 匹配方法不同,SAM-Decoding 能够找到精确的最长后缀匹配,在 SAM 更新和后续检索的每个生成步骤中实现平均 O(1) 的时间复杂度。它还可以与现有方法集成,根据匹配长度自适应地选择草稿生成策略,以泛化到更广泛的领域。在 Spec-Bench 上的大量实验表明,我们的方法比其他基于检索的 SD 方法快 18% 以上。此外,当与先进的 EAGLE-2 结合时,它在不同规模的 LLM 骨干网络上提供了额外的 3.28% 至 11.13% 的加速。我们的代码可在我们的仓库中获取。

英文摘要:

Speculative decoding (SD) has been demonstrated as an effective technique for lossless LLM inference acceleration. Retrieval-based SD methods, one kind of model-free method, have yielded promising speedup, but they often rely on incomplete retrieval resources, inefficient retrieval methods, and are constrained to certain domains. This paper presents a novel retrieval-based speculative decoding method that adapts suffix automaton (SAM) for efficient and accurate draft generation by utilizing common text corpus and dynamic text sequence. Unlike existing $n$-gram matching methods, SAM-Decoding finds the exact longest suffix match, achieving an average time complexity of O(1) per generation step of SAM update and suffix retrieval. It can also integrate with existing methods, adaptively selecting a draft generation strategy based on match length to generalize to broader domains. Extensive experiments on Spec-Bench show that our method is $18\%+$ faster than other retrieval-based SD methods. Additionally, when combined with advanced EAGLE-2, it provides an additional speedup of $3.28\%$ -- $11.13\%$ across various-sized LLM backbones. Our code is available at our \href{https://github.com/hyx1999/SAM-Decoding}{repository}.

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

↑