前缀滑动实现高效的测试时扩展
观点分析 · 2026/08/27
测试时扩展通过增加推理时的计算量来提升模型性能,但长推理轨迹会带来高昂的内存成本。本文发现推理过程中大部分中间token的重要性会逐渐降低,因此提出Prefix Sliding方法,在推理时丢弃非前缀和最近窗口之外的token,从而将内存需求限制在固定范围内,实现高效的长时测试时扩展。无需训练即可使现有模型速度提升3倍且性能不变;结合强化学习训练,可支持超过十万token的推理轨迹,并取得更好性能。消融实验表明Prefix Sliding优于摘要中间token或普通滑动窗口方法。
该论文针对测试时扩展中的内存瓶颈提出了一种简单有效的解决方案,无需训练即可显著加速,且通过训练可支持超长推理,对实际应用和后续研究具有重要价值。
Test-time scaling uses extra test-time compute to improve performance, such as letting language models reason longer when solving a problem. As models keep the entire reasoning trace in memory via full attention, hard tasks that need long thinking can be prohibitively expensive. However, we find most intermediate reasoning tokens lose importance as the model continues reasoning. This calls into question whether retaining them is worth the cost. Based on this insight, we propose Prefix Sliding, which discards tokens during reasoning that are not part of the prefix or the window of the last few thousand tokens. The prefix has key instructions and tools available to the model, while the most recent tokens are the current reasoning the model is working on. This caps the total memory requirement regardless of how long the model reasons, allowing for efficient long-horizon test-time scaling. Without training, Prefix Sliding can make existing models 3x faster while maintaining performance. Training with Prefix Sliding using reinforcement learning can achieve better performance by enabling scaling to reasoning traces beyond a hundred thousand tokens. Ablations show Prefix Sliding outperforms summarizing intermediate tokens or vanilla sliding window. Our code is at https://github.com/Muennighoff/prefix-sliding