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

基于早退机制与汤普森采样控制机制的推测解码用于加速大语言模型推理

Speculative Decoding via Early-exiting for Faster LLM Inference with Thompson Sampling Control Mechanism

Meituan(美团);Meta AI

Jiahao Liu, Qifan Wang, Jingang Wang, Xunliang Cai

AI总结:

本文提出早退推测解码(EESD),通过在LLM前N层后引入早退结构并结合自蒸馏生成草稿令牌,利用汤普森采样自动控制每轮草稿数量,在13B和70B模型上实现无损且显著加速的推理。

摘要:

近年来,大语言模型(LLMs)取得了非凡的进展,但其不断攀升的推理成本给实际应用带来了挑战。为应对这些挑战,我们提出了一种名为早退推测解码(EESD)的新方法,可实现无损加速。具体而言,EESD 利用大语言模型的一个片段来生成草稿令牌,并在前 N 层之后引入早退结构。为提升草稿令牌的质量,该方法整合了一种自蒸馏方法。这种早退设计不仅降低了部署和训练成本,还显著加快了令牌生成速度。此外,我们引入了一种新颖的采样机制,利用汤普森采样(Thompson Sampling)来调控生成过程,自动确定每一轮草稿令牌的数量。随后,原始大语言模型通过一次前向传播对这些草稿令牌进行验证,从而保证最终输出文本的分布与常规自回归解码保持一致。在 13B 和 70B 模型上的实验结果表明,与先前方法相比,我们的方法以显著更快的速率解码令牌,证明了该方法的有效性。

英文摘要:

The recent advancements in large language models (LLMs) have been extraordinary, yet the escalating inference costs associated with them present challenges in real-world applications. To address these challenges, we propose a novel approach called Early-exiting Speculative Decoding (EESD) with lossless acceleration. Specifically, EESD utilizes a segment of the LLM to generate draft tokens, incorporating Early-exiting structures after the first N layers. To enhance the quality of draft tokens, a self-distillation method is integrated. This early-exiting design not only reduces deployment and training costs but also significantly accelerates the token generation speed. Moreover, we introduce a novel sampling mechanism that leverages Thompson Sampling to regulate the generation processes, automatically determining the quantity of draft tokens in each round. The original LLM is then employed to validate these draft tokens through a single forward pass, and thus guarantees that the final output text maintains a distribution consistent with vanilla auto-regressive decoding. The experimental results on both 13B and 70B models demonstrate that our approach decodes tokens at a markedly accelerated rate compared to prior methods, showing the effectiveness of our approach.

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

↑