DLoop:循环推测解码

·

研究论文 · 2026/10/08

投机解码可加速大语言模型的自回归生成。在每个起草阶段,轻量级草稿模型提出词元,随后由目标模型验证。随着草稿模型能力增强,我们发现目标模型经常接受一个起草阶段中生成的所有词元。然而每个起草阶段后仍会进行验证,导致即使起草本可继续,也会产生不必要的目标模型前向传播。自适应草稿长度方法在解码时决定验证前有多少草稿词元,但它们仅对自回归草稿模型提高加速。对于并行草稿模型,进一步起草需要未验证草稿词元对应的目标模型隐藏状态。我们提出 DLoop,一种循环形式的投机解码,在验证前自适应地执行多个起草阶段。DLoop 在草稿模型保持自信时继续起草,并一起验证所有累积的草稿词元。循环感知训练通过让草稿模型接触其自身对未验证草稿词元的隐藏状态,使其在额外起草阶段保持可靠。通过花费额外的草稿模型前向传播,DLoop 减少了验证所需的目标模型前向传播次数。在包括 EAGLE-3、DFlash、Domino、DSpark 和多词元预测模块在内的多种投机解码方法中,DLoop 将实际加速提高 5% 至 41%,同时保持无损解码。代码将在 https://github.com/naver-ai/DLoop 提供。

该工作针对投机解码中因每轮起草后强制验证而造成的目标模型前向传播浪费问题,提出循环式多阶段起草与循环感知训练,在多种主流投机解码方法上实现显著加速且保持无损,具有较高的实用价值。

Speculative decoding accelerates autoregressive generation in large language models. In each drafting stage, a lightweight draft model proposes tokens that the target model subsequently verifies. With increasingly capable draft models, we find that the target model frequently accepts all tokens produced in a drafting stage. A verification nevertheless follows each drafting stage, resulting in unnecessary target-model forward passes even when drafting could have continued. Adaptive draft length methods decide during decoding how many draft tokens precede a verification, but they raise the speedup only for autoregressive draft models. For a parallel draft model, drafting further requires target-model hidden states for draft tokens that have not been verified. We propose DLoop, a looped form of speculative decoding that adaptively performs multiple drafting stages before verification. DLoop continues drafting while the draft model remains confident and verifies all accumulated draft tokens together. Loop-aware training keeps the draft model reliable in the additional drafting stages by exposing it to its own hidden states for unverified draft tokens. By spending additional draft-model forward passes, DLoop reduces the number of target-model forward passes required for verification. Across diverse speculative decoding methods including EAGLE-3, DFlash, Domino, DSpark, and multi-token prediction modules, DLoop improves the wall-clock speedup by 5 to 41 percent while preserving lossless decoding. Code will be available at https://github.com/naver-ai/DLoop.

阅读原文

参与讨论