测试时推测
Test-Time Speculation
AI总结:
本文研究了测试时推测方法,通过在线蒸馏技术提升长响应任务中推测器的接受长度,从而提高LLM推理效率。
摘要:
推测解码通过使用快速草稿模型生成token并用更准确的目标模型验证,从而加速LLM推理。其性能取决于接受长度,即目标模型接受的草稿token数量。我们的研究表明,即使是最先进的推测器,如DFlash、EAGLE-3和PARD,其接受长度也会随着生成长度的增加而下降,在仅几千个输出token后接近1(即无加速),这使推测器在长响应任务中变得无效。接受长度下降是因为大多数推测器在离线训练时仅在短序列上训练,但在推理时被迫匹配远长于训练分布的输出。为了解决这个问题,我们提出了测试时推测(TTS),一种在线蒸馏方法,可以在测试时连续调整推测器。TTS利用关键见解,即token验证步骤已经为每个草稿token调用了目标模型,从而提供所需的训练信号,以无额外成本地调整草稿。将草稿视为学生,目标模型视为教师,TTS在多个推测轮次中调整草稿,每次更新都提高草稿的准确性。我们的结果表明,在Qwen-3、Qwen-3.5和Llama3.1家族的多个模型上,TTS在最先进的推测器上将接受长度提高高达72%和41%,且随着生成长度的增加,收益呈比例增长。
英文摘要:
Speculative decoding accelerates LLM inference by using a fast draft model to generate tokens and a more accurate target model to verify them. Its performance depends on the $\textit{acceptance length}$, or number of draft tokens accepted by the target. Our studies show that the acceptance length of even state-of-the-art speculators, like DFlash, EAGLE-3, and PARD, degrades with generation length, reaching values close to 1 (i.e., no speedup) within a few thousand output tokens, making speculators ineffective for long-response tasks. Acceptance lengths decline because most speculators are trained offline on short sequences, but are forced to match the target on much longer outputs at inference, well beyond their training distribution. To address this issue, we propose $\textit{Test-Time Speculation (TTS)}$, an online distillation approach that continuously adapts the speculator at test time. TTS leverages the key insight that the token verification step already invokes the target model for each draft token, providing the training signal needed to adapt the draft at no additional cost. Treating the draft as the student and the target as the teacher, TTS adjusts the draft over several speculation rounds, with each update improving the draft's accuracy as generation proceeds. Our results across ten models from the Qwen-3, Qwen-3.5, DeepSeek-R1, GPT-OSS, MiniMax, and Llama3.1 families show that TTS improves acceptance lengths over state-of-the-art speculators by up to $72\%$ and $41\%$ on average, with the benefits scaling with generation lengths.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。