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

LogitSpec: 通过下下个token推测加速基于检索的推测解码

LogitSpec: Accelerating Retrieval-based Speculative Decoding via Next Next Token Speculation

University of Science and Technology of China(中国科学技术大学);Shanghai AI Laboratory(上海人工智能实验室)

Tianyu Liu, Qitan Lv, Hao Li, Xing Gao, Xiao Sun, Xiaoyan Sun

AI总结:

LogitSpec通过扩展检索范围和利用logit预测下下个token,提升检索基于解码的效率,实现2.61倍加速和3.28个接受token/解码步。

摘要:

推测解码(SD)通过小型草案模型提前生成草案token,然后目标模型并行验证,已成为LLM推理加速的有前途技术。许多改进SD的方法旨在消除草案模型的需要,通过检索方式生成草案token以进一步减轻草案开销并显著减少部署和应用难度。然而,基于检索的SD依赖于匹配范式检索最相关参考作为草案token,这些方法往往无法找到匹配且准确的草案token。为解决这一挑战,我们提出了LogitSpec,有效扩展检索范围并找到最相关参考作为草案。我们的LogitSpec受到观察的启发,即最后一个token的logit不仅能预测下一个token,还能推测下一个下一个token。具体而言,LogitSpec生成草案token分为两步:(1)利用最后一个logit推测下一个下一个token;(2)为下一个token和下一个下一个token检索相关参考。LogitSpec是无训练且即插即用的,可轻松集成到现有LLM推理框架中。在广泛文本生成基准上的大量实验表明,LogitSpec可实现高达2.61倍的加速和3.28个接受token/解码步。我们的代码可在https://github.com/smart-lty/LogitSpec上获得。

英文摘要:

Speculative decoding (SD), where a small draft model is employed to propose draft tokens in advance and then the target model validates them in parallel, has emerged as a promising technique for LLM inference acceleration. Many endeavors to improve SD are to eliminate the need for a draft model and generate draft tokens in a retrieval-based manner in order to further alleviate the drafting overhead and significantly reduce the difficulty in deployment and applications. However, retrieval-based SD relies on a matching paradigm to retrieval the most relevant reference as the draft tokens, where these methods often fail to find matched and accurate draft tokens. To address this challenge, we propose LogitSpec to effectively expand the retrieval range and find the most relevant reference as drafts. Our LogitSpec is motivated by the observation that the logit of the last token can not only predict the next token, but also speculate the next next token. Specifically, LogitSpec generates draft tokens in two steps: (1) utilizing the last logit to speculate the next next token; (2) retrieving relevant reference for both the next token and the next next token. LogitSpec is training-free and plug-and-play, which can be easily integrated into existing LLM inference frameworks. Extensive experiments on a wide range of text generation benchmarks demonstrate that LogitSpec can achieve up to 2.61 $\times$ speedup and 3.28 mean accepted tokens per decoding step. Our code is available at https://github.com/smart-lty/LogitSpec.

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

↑