Papers

研究揭示投机解码在长上下文失效的根源并提出 FreeLong 修复方法

Far, Not Just Long: What Limits Long-Context Speculative Decoding

Why we picked it

做长文本推理优化的开发者应该看看这篇。它把 drafter 掉速的原因定位成距离问题而非长度问题,还给出免训练方案 FreeLong,在 SGLang 里实测能比单独推理快最多 6.6 倍,不用重训 drafter 就能吃到长上下文加速。

一篇 arXiv 论文指出,投机解码的 drafter 在长输入上接受率骤降,主因不是输入长度本身,而是距离效应:当 drafter 需要参考的文本超出其有效范围(训练中遇到的最远距离或注意力窗口),接受率就会大幅下降。这一规律在 EAGLE-3、DFlash、DSpark 三类 drafter 上均被观察到,无论范围来自训练还是注意力窗口限制。

Body

论文据此提出 FreeLong,一种免训练、无损的方法:由目标模型用自身注意力挑选需要的句子,drafter 只读这些句子加最近的 token,组成 2K token 的工作集,把关键文本拉回有效范围内。

在 32K 和 128K 输入上测试十种 drafter,FreeLong 将接受率提升到原来的 1.8-2.6 倍(RULER)和 1.2-2.6 倍(AgentLongBench)。在 SGLang 中解码速度比目标模型单独推理快 1.6-6.6 倍,比原 drafter 快 1.2-2.3 倍。

Original · arXiv cs.AI

Far, Not Just Long: What Limits Long-Context Speculative Decoding

Speculative decoding speeds up large language models: a small drafter proposes several tokens, and the target model verifies them in one step. However, the acceptance of widely used drafters drops sharply on long inputs that the target handles well. We find that this drop comes mainly from distance: a drafter keeps its acceptance while the text it needs lies well within its effective range, the farthest distance it met in training and can attend to, and loses much of it once this text lies farther back. A longer input also lowers acceptance, but less. We observe this proximity law in EAGLE-3, DFlash and DSpark drafters of several targets, whether training or an attention window sets the range. It leads to a placement principle: a method restores much of the lost acceptance when it places the needed text within the effective range. As one way to apply this principle, we propose FreeLong, a training-free and lossless method that moves the needed text into the drafter's effective range. The target picks the needed sentences with its own attention, and the drafter reads only these sentences and the most recent tokens, in a 2K token working set. Across ten released drafters at 32K and 128K tokens, FreeLong raises acceptance to 1.8-2.6 times that of the original drafters on RULER and 1.2-2.6 times on AgentLongBench. In SGLang, it decodes 1.6-6.6 times faster than the target alone and 1.2-2.3 times faster than the original drafters.

Industry Coordinates & Source Verification

This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include speculative decoding, EAGLE-3, SGLang, long context.

Source attribution: curated from arXiv cs.AI (@Xiaolin Lin, Kai-Chiang Wu, Freddy Gabbay, Shaoyi Huang, Bing Li, Grace Li Zhang).

Spotted an error in the summary or translation? Tell us