arXiv:2410.11744cs.LG2024-10被引 25

动态构建令牌树,显著提升大模型推理速度和吞吐量。

DySpec: Faster Speculative Decoding with Dynamic Token Tree Structure

  • 运行时动态扩展令牌树结构,适应不同查询分布。
  • 在低温度下实现最高9.1倍吞吐提升,延迟降低9.4倍。
  • 适用于大模型高效推理,尤其适合高并发场景。

尽管推测解码是加速大语言模型推理的有前景方向,但其加速效果和可扩展性受令牌接受率限制。现有方法通常将预测令牌组织为独立链或固定树结构,难以适应多样化的查询分布。本文提出DySpec,一种基于新颖动态令牌树结构的更快推测解码算法。我们通过直观和经验线索建立草稿分布与接受率之间的关联,并证明二者强相关。基于此,采用贪心策略在运行时动态扩展令牌树。理论上,在温和假设下可达到最优结果。实验表明,相比固定树结构,DySpec具有更高的接受率和加速比。在多种数据分布和模型规模下,显著优于强基线(如Specinfer和Sequoia)。在低温度设置下,对Llama2-70B模型,吞吐量最高提升9.1倍,延迟降低9.4倍;在高温设置下,吞吐量仍可达6.21倍提升,尽管每步推测多个令牌难度增加。

原文摘要 · Abstract (English)

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.

推理加速推测解码动态结构大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。