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

DySpec:基于动态Token树结构的更快推测解码

DySpec: Faster Speculative Decoding with Dynamic Token Tree Structure

Peking University(北京大学);University of California, Berkeley(加州大学伯克利分校)

Yunfan Xiong, Ruoyu Zhang, Yanzeng Li, Tianhao Wu, Lei Zou

AI总结:

本文提出DySpec,一种基于动态Token树结构的推测解码算法,通过贪婪策略在运行时动态扩展Token树,在多种数据分布和模型规模下显著提升Token生成吞吐量并降低延迟,优于现有方法。

摘要:

尽管推测解码近期作为加速大型语言模型(LLMs)推理的有前景方向而出现,但其加速和可扩展性受到Token接受率的强烈限制。现有方法通常将预测的Token组织为独立链或固定的Token树,这无法泛化到多样的查询分布。在本文中,我们提出了DySpec,一种具有新颖动态Token树结构的更快推测解码算法。我们首先通过直观和经验线索将草稿分布与接受率联系起来,并成功表明这两个变量强相关。基于此,我们采用贪婪策略在运行时动态扩展Token树。在理论上,我们证明了在温和假设下该方法能取得最优结果。在实验上,DySpec比固定树产生更高的接受率和加速。DySpec能在各种数据分布和模型规模下大幅提升吞吐量并降低Token生成延迟,显著优于Specinfer和Sequoia等强劲竞争对手。在低温设置下,DySpec在Llama2-70B上可将吞吐量提升至9.1倍,延迟降低至9.4倍。在高温设置下,尽管草稿模型每步推测多个Token的难度增加,DySpec仍能将吞吐量提升至6.21倍。

英文摘要:

While speculative decoding has recently appeared as a promising direction for accelerating the inference of large language models (LLMs), the speedup and scalability are strongly bounded by the token acceptance rate. Prevalent methods usually organize predicted tokens as independent chains or fixed token trees, which fails to generalize to diverse query distributions. In this paper, we propose DySpec, a faster speculative decoding algorithm with a novel dynamic token tree structure. We begin by bridging the draft distribution and acceptance rate from intuitive and empirical clues, and successfully show that the two variables are strongly correlated. Based on this, we employ a greedy strategy to dynamically expand the token tree at run time. Theoretically, we show that our method can achieve optimal results under mild assumptions. Empirically, DySpec yields a higher acceptance rate and speedup than fixed trees. DySpec can drastically improve the throughput and reduce the latency of token generation across various data distribution and model sizes, which significantly outperforms strong competitors, including Specinfer and Sequoia. Under low temperature setting, DySpec can improve the throughput up to 9.1$\times$ and reduce the latency up to 9.4$\times$ on Llama2-70B. Under high temperature setting, DySpec can also improve the throughput up to 6.21$\times$, despite the increasing difficulty of speculating more than one token per step for draft model.

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

↑