Long chain-of-thought reasoning wins benchmarks — and burns full attention over every intermediate token. A Stanford-led team (Niklas Muennighoff et al., posted August 26, 2026) asks a blunt question in Prefix Sliding for efficient test-time scaling: if middle reasoning tokens fade in importance, why pay to keep them in KV cache?
Prefix Sliding keeps:
- The prefix — system prompt, tools, task metadata.
- A sliding window — typically ~4,096 tokens of the latest reasoning.
Everything else drops out of attention. Result: about 3× faster decoding at matched accuracy on existing models, and a path to 100k+ token RL rollouts without linear memory blowups.
TL;DR
| Question | Answer |
|---|---|
| Paper | arXiv:2608.26070 (Aug 26, 2026) |
| Speed | ~3× vs full attention, no retraining |
| Window | ~4096 recent tokens + full prefix |
| Beats | Vanilla sliding window, CoT summarization (paper ablations) |
| Code | github.com/Muennighoff/prefix-sliding |
| Why you care | Test-time compute is billable; middle CoT is mostly waste |
The mechanism (without the math wall)
Standard reasoning models attend to every generated token forever. Prefix Sliding modifies the causal mask so token t only sees:
- All prefix tokens (fixed at start).
- Tokens in
[t − W, t − 1]for window size W.
Older reasoning steps simply fall out of memory — analogous to a human whiteboarding over earlier scratch work while keeping the problem statement pinned.
The paper reports this is not equivalent to naive sliding windows (which lose the prefix/tool context) or periodic summarization (which introduces compressor error). Prefix + window preserves instructions while trimming stale scratch work.
Empirical claims builders should verify
From the preprint (epoch-matched training, identical data):
- Inference-only: Match full-attention accuracy at ~3× lower decode cost.
- RL training: Enable rollouts beyond 100k tokens with bounded trainer memory; authors suggest trainer context ≈ 4× window size to limit log-prob mismatch.
- Efficiency range: 5.6–20.8× compute savings appear in related efficiency work cited in the same research thread — Prefix Sliding's headline is the 3× no-retrain figure on reasoning traces.
Porting note in the GitHub README: implementation targets specific torch / vLLM / flash-attn versions — expect integration lag before your hosted API vendor exposes a toggle.
What this changes for agents and harnesses
- Billing: If you pay per token on Claude Code, Codex, or OpenCode, long "thinking" traces are mostly middle tokens — Prefix Sliding is a vendor-side fix for the same waste encrypted CoT replay attacks exploit structurally.
- Local inference: Self-hosters running GLM / Qwen reasoning models hit RAM cliffs on 32k+ CoT; windowed attention is how you keep loop agents alive overnight (loop engineering).
- Eval honesty: Benchmarks that reward infinitely long CoT may overstate production value — efficiency-aware evals will matter once Prefix Sliding (or similar) ships default-on.
Honest limitations
- Assumption risk: If a task requires recalling a detail from 20k tokens ago, discarding it hurts — the paper assumes reasoning locality holds (true on many math/code sets, not universal).
- Stack lag: Until inference engines merge the mask, you get zero benefit — watch vLLM release notes.
- Not a replacement for good prompts: Shorter, structured context engineering still beats brute-force CoT.
Related on explainx.ai
- Context window pricing decoded
- Stealing reasoning traces — encrypted CoT vulnerability
- Loop engineering for coding agents
- Context engineering vs prompt engineering
- Claude Code vs Codex vs Gemini CLI
- How to run GLM-5.2 in agent harnesses
Primary source: arXiv:2608.26070 · GitHub: Muennighoff/prefix-sliding
Figures and speedups describe the August 26, 2026 preprint; production inference stacks may not implement Prefix Sliding yet.
