You Don't Need Long Context
Read first: Lost in the Middle: How Language Models Use Long Contexts · Efficient Memory Management for Large Language Model Serving with PagedAttention · Effective context engineering for AI agents
TL;DR. Later tokens cost more to generate than earlier ones. On H100s with vLLM, serving a 256K window instead of 16K costs 3.6× (GLM 5.2), 5.6× (Kimi K2.6) and 7× (Qwen 3 Coder Next) more per output token. The authors then keep the context short in three ways: (1) compacting the agent’s history whenever it crosses a threshold; (2) storing long inputs as files that the agent greps instead of reads in full; (3) taking one action per fresh context. With Claude Opus 4.5 and GPT 5.6 Sol, long-horizon accuracy stays within about −3.7 to +5.6 points of full history. Long-input accuracy stays level or rises sharply, by up to +40 points. They propose semantic state space models (SSSMs): models post-trained to carry a natural-language state instead of a growing history.
Why it matters now. Context windows have grown to 1M tokens (GLM 5.2) and beyond (GPT 5.6 Sol, 1.05M), while agent methods such as ReSum and context folding already compress history to work around them. This paper asks the blunt question: is the window needed at all? Its answer is an IR argument. Turning a long input into a file plus a search tool makes a long-input task a retrieval-driven long-horizon task. In the tested benchmarks, the information actually needed stayed small even as documents grew by orders of magnitude.
Key idea
Section titled “Key idea”Why long windows cost more. During decoding, every generated token reads the KV cache of all earlier tokens. KV memory per sequence grows with the window , so fewer sequences fit in GPU memory at once, and aggregate throughput falls. At a fixed hourly GPU price on GPUs, the cost per million output tokens is
The authors measure peak sustained decode throughput with request lengths drawn uniformly up to . The cloud throughput workload uses nested prefixes of one token sequence, prefills the longest prefix once, enables prefix caching, generates 1,024 output tokens per request and sweeps concurrency without KV preemption. It is a controlled cached-prefix decode experiment, not an arbitrary production workload. They report for the three open models (8 H100s for Qwen, 16 for the others, at $3.85 per GPU-hour). On a single-request DGX Spark, inter-token latency roughly doubles across the measured lengths for several local models.
Three context regimes. Write the task as , actions and observations . The context the model sees at step is
EoCC is written as “total limit / threshold” (e.g. 48K/36K down to 16K/12K, and down to 8K/6K on τ²-bench). The gap between the two numbers reserves room for the compaction turn. SAC throws away each conversation after one Bash action, so the semantic state is the only memory. The paper separates peak length (the largest single conversation, which sets the window you must serve) from total length (the sum over all conversations, which summarises accumulated conversation size; billed tokens additionally depend on repeated inputs, outputs and cache hits).
What a good compaction contains. Appendix A reports that summarisation is the wrong frame. The best compactions are “not narratives of the execution history but carefully cherry-picked briefs for further execution”. They contain a near-verbatim copy of the task, the agent’s current intent and next steps, a decomposed plan, completion criteria, and pointers to artifacts. One structure was used for every benchmark.
Long input → long horizon. The harness (mini-swe-agent, or its generalisation mini-agent) is a ReAct loop with Bash only. Long documents become files. The agent uses grep, sed and a bounded doc-read capped at 8,000 characters. Only matched excerpts enter the context, so reading becomes a sequence of retrieval actions.
What the numbers say
Section titled “What the numbers say”Three anchor cases carry the argument: the cost decomposition (SWE-V at 16K/12K, where most of the saving is the assumed window discount), retrieval without compaction (NIAH, solved by grep with zero compactions), and a compaction failure (FRAMES, Qwen 3 Coder Next, and the coin-toss example). The grids below are reference material.
Long-horizon (EoCC vs FHA), accuracy in %. The baseline is followed by the range over the tested thresholds (four for the first four benchmarks, three for the last two).
| Benchmark | Opus 4.5 FHA | Opus EoCC range | Sol FHA | Sol EoCC range |
|---|---|---|---|---|
| SWE-bench Verified | 70.0 | 68.8–74.8 | 84.4 | 84.6–88.8 |
| SWE-bench Multilingual | 66.3 | 64.3–68.0 | 79.3 | 77.7–80.0 |
| Terminal-Bench 2.1 | 47.2 | 48.3–52.8 | 87.6 | 85.4–88.8 |
| FRAMES | 81.0 | 77.3–79.7 | 90.2 | 86.9–88.7 |
| BFCLv3 (multi-turn) | 62.0 | 61.5–64.0 | 39.5 | 39.0–39.5 |
| τ²-bench | 79.3 | 78.2–79.3 | 73.9 | 73.9–77.2 |
Across all 22 configurations per model, Opus moves −3.7 to +5.6 points and Sol −3.3 to +4.4. No more than 5 of 22 lose over 2 points. FRAMES, which integrates evidence across 2–15 Wikipedia articles, is the one benchmark where both models lose at every threshold (by 1.3–3.7 points). Estimated savings are 2.2–8.8× (Opus) and 2.4–5.0× (Sol).
Long-input (selective reading + compaction vs full input).
| Benchmark | Opus: full → short | Sol: full → short | Setting |
|---|---|---|---|
| LongBench v2 | 68.0 → 67.6 | 70.8 → 72.6 | 16K/12K |
| LOONG (avg / perfect) | 70.1/38.9 → 80.2/53.7 | 79.3/44.4 → 84.6/53.0 | best of three |
| AA-LCR | 65.0 → 84.0 | 82.0 → 83.0 | 16K/12K |
| NIAH | 60.0 → 100.0 | 80.0 → 100.0 | 48K/36K |
| RULER (recall) | 62.5 → 95.7 | 65.5 → 96.4 | 16K/12K |
| Counting-Stars (exact) | 65.1 → 81.2 | 76.6 → 81.2 | 16K/12K |
| BABILong | 67.1 → 92.0 | 70.7 → 94.0 | 16K/12K |
Opus moves −0.4 to +40.0 and Sol +1.0 to +30.9, with estimated savings of 6.5–54.6× and 4.4–233.3×. Here the saving is mostly real token reduction, not the pricing model alone. RULER at nominal prices falls from $880 to $102.85 for Opus. Median compactions are zero on several benchmarks: reading selectively does almost all the work. For Opus on LongBench v2 and LOONG, total conversation length stays in a roughly constant band while document length grows over orders of magnitude.
One action per context (Table 2). Accuracy in %, peak context per task (median / max, K tokens).
| FHA | Best EoCC | SAC | Peak: FHA → EoCC → SAC | |
|---|---|---|---|---|
| Opus, SWE-V | 70.0 | 74.8 (24K/18K) | 70.2 | 32/200 → 19/22 → 8/16 |
| Opus, TB 2.1 | 47.2 | 52.8 (32K/24K) | 51.8 | 27/130 → 24/31 → 9/19 |
| Sol, SWE-V | 84.4 | 88.8 (48K/36K) | 82.4 | 18/173 → 22/35 → 7/15 |
| Sol, TB 2.1 | 87.6 | 88.8 (48K/36K) | 84.3 | 17/133 → 23/40 → 8/37 |
Single-action compaction is tested on these two benchmarks only: Opus remains near baseline, while Sol loses 2.0–3.3 points. Maximum peak context falls from 130–200K to 15–37K, but SAC cost totals are not reported.
Open-weight models (Appendix D) are less robust. At 16K/12K every model loses SWE-V accuracy, and Qwen 3 Coder Next collapses from 53.0 to 3.6 because its verbose trajectories leave little room between compactions. Qwen 3.6 27B (68.6 → 65.0) and MiniMax M2.7 (72.6 → 67.8) degrade gently.
Caveats
Section titled “Caveats”- The cost model is an estimate. For Opus and Sol, “estimated optimized retail cost” anchors the standard price at the full window. It interpolates linearly down to times that price at 16K, using throughput ratios measured on three other (open) models. On SWE-V at 16K/12K, the nominal Opus cost falls only from $420 to $312.65, and Sol’s rises from $167.68 to $203.12. Most of the long-horizon saving is the assumed window discount.
- Two closed models carry the headline. The open-weight appendix shows the result depends on the model. There are no seeds or confidence intervals. Terminal-Bench has 89 tasks (marginal binomial SE ≈ 5 points near 50%), but judging significance would need paired per-task differences and the uncertainty from picking the best threshold on the test set.
- The baselines differ in more than context length. Full-input baselines paste the input in one pass, with no tools. The short-context agent searches files over many steps. The paper does not describe how baselines handle inputs beyond the window (Opus has 200K; some inputs reach 500K–1M tokens).
- Grep favours lexical hooks. The authors attribute the NIAH result to lexical overlap. Tasks whose evidence cannot be found by search terms, or that need every chunk at once, are under-tested.
- The claim is bounded by its own conclusion. The evidence “does not rule out the existence of tasks for which long context is beneficial”. The coin-toss example shows that compaction alone can fail; a retrievable log is the remedy. As the paper puts it, “there is a difference between information that needs to be a part of model context and information that could, in principle, be retrieved selectively.”
- SSSMs are a proposal. No SSSM is trained. Claims about data efficiency are explicitly a surmise.
Connections
Section titled “Connections”- Why short can be more accurate: Context Rot shows accuracy decays with input length at fixed difficulty. Lost in the middle shows that position matters. Both explain why a 16K brief can beat a 200K history.
- The benchmarks it turns into retrieval: RULER and NIAH are re-run here through grep, which tests the harness’s search rather than the model’s attention. NoLiMa is the natural stress test this paper skips: needles without lexical overlap would remove grep’s advantage.
- The opposite bet: YaRN extends windows cheaply. This paper argues the extended window is rarely needed and costly to serve.
- Agent memory methods: EoCC is ReSum’s summarise-and-restart without RL. SAC is the per-step extreme of context folding / AgentFold. The retrievable-history fix is MemGPT’s external memory. Recursive language models similarly keep the long input outside the window and query it with code.
- Harness practice: Effective context engineering and long-running harnesses describe the same compaction-and-handoff pattern. The harness here is a ReAct loop in the style of SWE-agent.
- SSSM vs SSM: Mamba keeps a fixed latent state updated per token, with input-dependent selection. An SSSM keeps a text state updated per action by the LM itself. Bounded latent state or bounded live text context can bound model-state cost per step; external-history retrieval and environment work need not have constant cost.
- Serving cost: PagedAttention and GQA explain why KV-cache memory, and therefore batch size, sets the per-token price that grows with the window.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Appendix B measures 16K-to-256K cost ratios r = 0.2772 (GLM 5.2), 0.1777 (Kimi K2.6) and 0.1439 (Qwen 3 Coder Next), pools them to r = 0.20, and prices Opus 4.5 at $25 per M output tokens at its 200K reference window, interpolating linearly down to r × $25 at 16K, with input = output / 5 and cached input = input / 10. (a) Turn each r into the “× more per token at 256K” figure. (b) Price the SWE-bench Verified run at 16K / 12K (28.3M new input, 127.3M cached, 4.3M output) and compare with the $420 baseline. (c) Recompute the same run at standard prices ($5 / $0.50 / $25) and split the saving into the part due to token counts and the part due to the assumed context discount.
What a strong answer covers
- (a) 1 / 0.2772 ≈ 3.6×, 1 / 0.1777 ≈ 5.6×, 1 / 0.1439 ≈ 6.95 ≈ 7×; the mean 0.1996 rounds to r = 0.20.
- (b) At W = 16K the prices are 0.20 × $25 = $5 output, $1 new input, $0.10 cached. Cost = 28.3 × 1 + 127.3 × 0.1 + 4.3 × 5 = 28.30 + 12.73 + 21.50 = $62.53, matching Table 3; 420 / 62.53 ≈ 6.7× saving.
- (c) Nominal = 28.3 × 5 + 127.3 × 0.5 + 4.3 × 25 = 141.50 + 63.65 + 107.50 = $312.65, so token counts alone give only 420 / 312.65 ≈ 1.34×; the remaining ≈ 5× (= 1 / r) is the assumed per-token discount for a short window.
- For GPT 5.6 Sol at 16K / 12K the nominal cost rises from $167.68 to $203.12 (more new input and output), so its ≈ 4.1× estimated saving comes entirely from the pricing model, not from spending fewer tokens.
- Why the discount is physically real for self-hosted serving: KV-cache memory per sequence grows with the window, so fewer sequences fit in a batch, aggregate decode throughput falls, and cost per token at fixed GPU-hours rises. Whether a closed-model provider would pass it on is an assumption, not a measurement.
- Mechanism
Selective reading lifts NIAH from 60 → 100 (Opus), without any compaction occurring in that experiment, and RULER recall from 62.5 → 95.7 (median zero compactions), yet on FRAMES compaction costs Opus 1.3–3.7 points and Qwen 3 Coder Next collapses from 53.0 to 3.6 on SWE-bench Verified at 16K / 12K. Explain the mechanisms that make a short context help in the first cases and hurt in the second, and say which of them the paper itself proposes.
What a strong answer covers
- Selective reading turns reading into retrieval: grep plus a bounded doc-read puts only matched excerpts in context, so attention is not spread over hundreds of thousands of distractor tokens (the context-rot effect). The paper attributes the NIAH result to lexical overlap between needles, their synonyms and the question.
- Compaction acts as a filter: Appendix A says the best compactions are task-oriented briefs (task copy, current intent, plan, completion criteria, pointers), not narrative summaries, so dead ends and stale tool output leave the context.
- FRAMES needs evidence from 2–15 articles to be integrated; a lossy compaction can drop a fact retrieved earlier, and the agent must refetch or guess, so short context costs a little accuracy there.
- Qwen 3 Coder Next fails because its verbose trajectories leave too little room for progress between compactions (paper's explanation): the per-stretch budget must exceed the tokens one useful step consumes, or the agent compacts in a loop.
- A confound the paper does not rule out: full-input baselines are given inputs (NIAH up to ≈500K, BABILong up to 1M tokens) that can exceed a 200K window, and the paper does not say how such inputs were handled, so part of the gain may be a handicapped baseline.
- Critique
The paper concludes that it found no evidence of inherently long-context tasks. Identify the weakest assumptions behind that claim (models, harness, baselines, cost model, task selection) and design one experiment that could find a task where short context genuinely loses.
What a strong answer covers
- Headline results use two frontier closed models; Appendix D shows open-weight models are less robust (every one loses SWE-V accuracy at 16K / 12K; Qwen 3 Coder Next drops to 3.6), so the claim is model-dependent, and the paper argues post-training could close the gap.
- The harness gives the agent grep, sed and bounded reads; benchmarks with lexical hooks (NIAH, RULER, Counting-Stars) suit grep. Accuracy is not compared at matched total compute or number of model calls, and runs report no variance.
- In the long-input experiments, single-pass full-input baselines are compared with tool-using selective readers, so “short context” is confounded with “agentic search over files”. This is not the long-horizon FHA comparison, where the agent keeps its tools. A same-agent, large-window, no-compaction control would isolate the long-input intervention.
- Cost savings rely on a hypothetical continuous short-context discount interpolated from three open-weight models on H100s, anchored at standard-price tiers (Sol's 272K standard-price ceiling); providers can charge long-context premiums. The throughput workload is a controlled cached-prefix decode test (nested prefixes, prefix caching, 1,024 output tokens per request), not an arbitrary production workload.
- Proposed test: tasks whose answer depends on every chunk with no lexical hook (e.g. global aggregation or consistency checking over a 500K-token corpus, judged with nuggets), comparing FHA, EoCC and SAC at equal total tokens across seeds; a persistent gap there would falsify the strong claim.