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

长上下文草稿生成无需长上下文草稿模型

Long-Context Drafting Does Not Require Long-Context Drafters

Advanced Micro Devices Inc. (AMD)(超威半导体);University of Waterloo(滑铁卢大学)

Aref Jafari, Vansh Bhatia, Matt Qin, Subhajit Dutta Chowdhury, Ben Lee, Vikram Appia, Ali Ghodsi, Mehdi Rezagholizadeh

AI总结:

本文提出无需构建长上下文草稿模型,通过冻结短上下文草稿模型并采用两种推理时机制,可使其在4k至200万令牌场景下保持加速效果,且成本仅为短长度下的0.16倍。

摘要:

投机解码将低成本草稿模型与针对目标模型的并行验证相结合。在超长上下文场景下,该方法不再具有成本优势,因为需对完整前缀进行注意力计算的草稿模型继承了目标模型的上下文相关成本,其原本应提供的加速效果会先被削弱,随后转为劣势。标准应对方案是通过训练、微调草稿模型,或使用目标模型检查点内集成的多令牌预测头来构建长上下文草稿模型。本文认为此举并无必要,因为当前使用的草稿模型以目标模型为条件,读取目标模型在整个前缀上计算得到的隐藏状态,因此远程上下文已能传递给草稿模型,无需其自身进行注意力计算,且验证过程可修正草稿模型遗漏的内容。因此,本文冻结已发布的短上下文草稿模型,并在两种推理时机制下使其运行远超其训练长度:一种是限制草稿模型可见的注意力缓存,以固定其成本;另一种是将其旋转位置索引重新基准化为训练范围内。本文未修改任何权重,唯一可调参数会早早就达到饱和状态,因此在vLLM框架下,一种配置即可覆盖4k至200万令牌的场景,在短长度下最多可获得0.16倍的加速比。本文证明了常见的索引偏移何时会使草稿模型的计算完全不变,并将接受率分解为两个具有严格边界的可测量差距。无论冻结草稿模型在短上下文下能提供多少加速比,其在200万令牌范围内均能保持该加速效果,且该结论在三组目标-草稿模型对和五个语料库上均成立。该结论关注的是加速比的平稳性而非其倍数,且移除任一机制都会消除该效果。该增益的前提是,投机解码中每生成一个令牌的成本需保持低于仅使用目标模型的成本。

英文摘要:

Speculative decoding pairs a cheap drafter with parallel verification against the target. At ultra-long context it stops paying, because a drafter that attends over the full prefix inherits the target's context-dependent cost, so the speedup it was meant to provide first erodes and then reverses. The standard response is to build a long-context drafter, by training or fine-tuning one, or by using a multi-token-prediction head shipped inside the target checkpoint. We argue this is unnecessary, because the drafters in use are target-conditioned, reading hidden states the target computed over the entire prefix, so distant context already reaches them without their own attention, and verification corrects what they miss. We therefore freeze released short-context drafters and run them far past their training length under two inference-time mechanisms, one bounding the attention cache they see, which fixes their cost, and one re-basing their rotary position indices into the trained range. No weight is touched and the only tunable saturates early, so one vLLM-side configuration spans 4k to two million tokens, costing at most 0.16x of speedup at short length. We prove when a common index shift leaves the drafter's computation exactly unchanged, and decompose acceptance into two measurable gaps with sharp bounds. Whatever speedup a frozen drafter delivers at short context, it retains out to two million tokens, across three target-drafter pairs and five corpora. The claim concerns the flatness rather than the multiple, and removing either mechanism eliminates it. The gain is conditional on the speculative cost per emitted token staying below the matched target-only cost.

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

↑