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

OPT-Tree:自适应草稿树结构的推测解码

OPT-Tree: Speculative Decoding with Adaptive Draft Tree Structure

Institute of Computer Science and Technology, Soochow University, China(苏州大学计算机科学与技术学院);Huawei Cloud(华为云)

Jikai Wang, Yi Su, Juntao Li, Qingrong Xia, Zi Ye, Xinyu Duan, Zhefeng Wang, Min Zhang

AI总结:

针对自回归模型推理慢的问题,提出OPT-Tree算法,通过动态构建最优草稿树结构,最大化推测解码的接受长度,实现最高3.2倍加速,并支持单步生成多令牌。

摘要:

自回归语言模型在各种场景中展现出优异的性能。然而,其推理效率受限于一步一词的生成模式,随着模型规模日益增大,这一问题变得尤为紧迫。推测解码采用“先草拟后验证”的机制,允许一步生成多个令牌,实现无损加速。现有方法主要采用固定的启发式草稿结构,无法适应不同情境以最大化验证阶段的接受长度。为缓解这一困境,我们提出了OPT-Tree,一种构建自适应且可扩展草稿树的算法。它在每一步解码中搜索最大化接受长度数学期望的最优树结构。实验结果表明,OPT-Tree优于现有草稿结构,相比自回归解码实现了最高3.2倍的加速比。若草稿模型足够强大且节点预算充足,它能在单步中生成超过十个令牌。我们的代码可在https://github.com/Jikai0Wang/OPT-Tree获取。

英文摘要:

Autoregressive language models demonstrate excellent performance in various scenarios. However, the inference efficiency is limited by its one-step-one-word generation mode, which has become a pressing problem recently as the models become increasingly larger. Speculative decoding employs a "draft and then verify" mechanism to allow multiple tokens to be generated in one step, realizing lossless acceleration. Existing methods mainly adopt fixed heuristic draft structures, which fail to adapt to different situations to maximize the acceptance length during verification. To alleviate this dilemma, we proposed OPT-Tree, an algorithm to construct adaptive and scalable draft trees. It searches the optimal tree structure that maximizes the mathematical expectation of the acceptance length in each decoding step. Experimental results reveal that OPT-Tree outperforms the existing draft structures and achieves a speed-up ratio of up to 3.2 compared with autoregressive decoding. If the draft model is powerful enough and the node budget is sufficient, it can generate more than ten tokens in a single step. Our code is available at https://github.com/Jikai0Wang/OPT-Tree.

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

↑