Do AI Agents Really Need Long Context? A New Study Kept Them to Short Memories and Lost Little
A new preprint tested frontier models on 13 benchmarks with short working contexts and found accuracy mostly held, and sometimes jumped. We unpack the method, the results, where it broke and the catch in the cost numbers.
For the past two years, one of the headline numbers in every big model launch has been the context window: how many tokens a model can hold in view at once. Windows of 200,000 tokens are now routine, and several models advertise a million or more. A new preprint posted to arXiv this month, titled You don't need long context, asks a blunt question about that race: is any of it actually necessary?
The authors, Peter Belcak and eleven co-authors, argue that it mostly is not. Across 13 benchmarks covering software engineering, terminal work, web-style research, tool use and long-document question answering, they found that frontier models kept to short working contexts usually matched, and sometimes clearly beat, the same models given their full history or full documents. In this article we look at how they tested that claim, what the numbers show, where the approach broke down, and what it means for anyone building AI agents today.
Why long context costs more than it looks
The paper starts with economics. Every new token a model generates has to attend to every token already in its context, so the deeper into a long conversation a model is, the slower and more memory hungry each new token becomes. Retail API prices hide this, because providers usually charge a flat rate per million tokens whatever the context length.
To show the hidden cost, the authors served three open-weight models on rented NVIDIA H100 GPUs and measured peak decode throughput at different context window sizes. Converting that throughput into dollars at an on-demand price of $3.85 per GPU-hour, serving at a 256,000-token window rather than 16,000 cost 3.6 times more per generated token for GLM 5.2, 5.6 times more for Kimi K2.6 and 7 times more for Qwen 3 Coder Next.
They saw the same pattern on a desk-sized machine. On an NVIDIA DGX Spark running five locally deployable models, the time between generated tokens roughly doubled for several models as the input grew, and memory use climbed with it. The point is simple: a model that works in a 16,000-token window is cheaper and faster to run than one that drags 200,000 tokens around, on the cloud and on a laptop-class device alike.
Where long contexts come from
The authors split "long-context" work into two kinds:
- Long-horizon tasks, where an agent takes many steps and its conversation grows as every command, tool result and decision is appended. Fixing a bug across a large code repository is the classic example.
- Long-input tasks, where the question is short but the material is huge, such as answering a question about several full financial reports.
Their key move is to note that the second kind can be turned into the first. Instead of pasting a 500,000-token document into the prompt, you save it as a file and give the agent ordinary tools such as grep, head and sed to search and read small pieces of it. The long input becomes a series of short reading steps, and the problem becomes one of managing a long-horizon conversation.
Three ways to manage an agent's memory
The experiments used a deliberately minimal agent: a simple loop where the model issues one Bash command at a time, sees the result, and decides what to do next. For coding and terminal tasks this was the released mini-swe-agent harness; for everything else, a generalised version the authors call mini-agent. On top of that loop they compared three regimes:
- Full-History Accumulation, the normal default, where nothing is ever removed and the conversation grows until the task ends.
- End-of-Conversation Compaction, where the agent works normally until its context crosses a threshold, writes a short handoff note about its state, and then continues in a fresh conversation containing only the original task and that note. This repeats as often as needed.
- Single-Action Compaction, the extreme version, where every conversation contains just the task and a compact written state, the agent takes exactly one action, updates the state, and the conversation is thrown away.
The main experiments used two strong closed models, Claude Opus 4.5 and GPT 5.6 Sol, chosen because they come from independent developers. Compaction thresholds were pushed down in steps, with limits as tight as 16,000 tokens for the coding work and 8,000 tokens for one of the tool-use benchmarks.
Result one: long-horizon tasks held up
On six long-horizon benchmarks (SWE-bench Verified, SWE-bench Multilingual, Terminal-Bench 2.1, FRAMES, tau-squared-bench and BFCLv3), accuracy under compaction stayed broadly flat. Across all settings, Claude Opus 4.5 ranged from 3.7 points below its full-history baseline to 5.6 points above it, and GPT 5.6 Sol from 3.3 points below to 4.4 above. For each model, no more than 5 of the 22 configurations lost more than 2 points.
Some individual results stand out. On SWE-bench Verified, a set of 500 real GitHub issues, Opus 4.5 resolved 70.0% with full history and 74.8% when compacting at a 24,000-token limit. GPT 5.6 Sol went from 84.4% to 88.8% at a 48,000-token limit. Compaction did not win everywhere: on FRAMES, a multi-hop research benchmark built on Wikipedia, it cost Opus between 1.3 and 3.7 points and GPT between 1.5 and 3.3 points.
The authors also checked an obvious worry: that an agent with a short memory might keep redoing work it had forgotten, burning extra tokens and wiping out the savings. They report that this generally did not happen, although new input tokens and output tokens did tend to rise as compaction got more frequent.
Result two: long inputs did better when read selectively
The long-input results are the most striking in the paper. Here the baseline pasted the whole input into the model, while the compacting agent stored it as files and searched them. Across seven benchmarks, Opus 4.5 ranged from 0.4 points below to 40.0 points above its baseline, and GPT 5.6 Sol from 1.0 to 30.9 points above.
- On AA-LCR, which asks reasoning questions over sets of real documents averaging about 100,000 tokens, Opus 4.5 scored 84.0% with selective reading at a 16,000-token limit, against 65.0% when given everything. GPT 5.6 Sol moved from 82.0% to 83.0%.
- On RULER, a synthetic suite tested at 256,000 and 500,000 tokens, mean recall rose from 62.5% to 95.7% for Opus and from 65.5% to 96.4% for GPT.
- On BABILong, which hides small reasoning facts inside book text of up to a million tokens, accuracy rose by 24.9 points for Opus and 23.3 points for GPT.
- On LOONG, a multi-document benchmark of financial reports, legal cases and papers, every compaction setting improved both average score and perfect-answer rate for both models.
- On LongBench v2, the gains were small: GPT up 1.8 points, Opus within 0.4 points of its baseline.
Both models hit 100% on the classic needle-in-a-haystack test with selective reading. The authors are candid that this is partly because the hidden sentences share words with the questions, which makes them easy to find with a text search. They also show that, as documents grew by orders of magnitude, the agent's actual conversation length stayed in a broadly similar band. In their words, the size of a task's input "does not itself establish a need for long context."
Result three: one action per conversation still worked
The boldest test was Single-Action Compaction on the two coding benchmarks. With every step taken in a fresh conversation carrying only a written state, Opus 4.5 scored 70.2% on SWE-bench Verified, against 70.0% with full history, and 51.8% on Terminal-Bench, up 4.6 points. GPT 5.6 Sol lost a little: 82.4% on SWE-bench Verified (2.0 points down) and 84.3% on Terminal-Bench (3.3 points down).
The memory footprint changed dramatically. The median peak context under this regime was only 7,000 to 9,000 tokens, and the largest single context any task needed fell from between 130,000 and 200,000 tokens to between 15,000 and 37,000.
Where it broke
The open-weight results are a useful counterweight. The authors ran five quantised open models on the DGX Spark. Qwen 3.6 27B and MiniMax M2.7 held up well, but Gemma 4 31B, Step 3.7 Flash and especially Qwen 3 Coder Next lost more as the budget tightened. Qwen 3 Coder Next collapsed on SWE-bench Verified from 53.0% to 3.6% at the tightest setting, which the authors put down mainly to its verbose working style leaving too little room for progress between compactions. At that tightest setting, every open model lost some SWE-bench accuracy.
The lesson is that compaction is not free. It relies on a model that writes tight handoff notes and works economically, and models that were never trained for it can fall apart.
What makes a good handoff note
One of the most practical sections sits in an appendix. The authors found that treating compaction as ordinary summarisation works poorly, because summaries try to give every past event equal weight and over-represent things the agent did repeatedly. The notes that preserved accuracy best were not histories of what happened but briefs for what comes next. They contained:
- a verbatim or near-verbatim copy of the original task;
- what the agent is doing right now, what it intends and its next steps;
- everything directly relevant to future work, including a plan broken down from the task, a list of conditions for when the task counts as done, and pointers to any files holding useful information.
Their coding prompt also asks the model to list established facts, files changed, checks run and their outcomes, and dead ends that should not be repeated. The same structure worked across every type of task they tested.
The catch in the cost numbers
The headline savings deserve a careful read. The paper reports estimated cost reductions of 2.2 to 8.8 times for Opus and 2.4 to 5.0 times for GPT on long-horizon tasks, and up to 54.6 and 233.3 times respectively on long-input tasks. These figures use what the authors call an "estimated optimized retail cost": a model that assumes providers would charge less for short-context work, based on the throughput gains they measured on open models.
At today's flat retail prices the picture is mixed. The paper's own tables also report nominal costs, and on long-horizon tasks compaction sometimes cost more. On SWE-bench Verified, GPT 5.6 Sol's nominal cost rose from about $168 for the full-history run to about $186 at the 48,000-token setting, because it re-read more uncached input and wrote more output. On Terminal-Bench at the 24,000-token setting, GPT's nominal cost was roughly $90 against $49 for the baseline. Opus 4.5 on SWE-bench Verified, by contrast, got cheaper even at nominal prices, from $420 to about $296 at its best-accuracy setting.
For long inputs the nominal savings were real and large, because the baseline paid to read whole documents. On LOONG, for example, Opus 4.5's nominal cost fell from about $1,368 to about $534 at the largest compaction setting. So the strongest practical case today is for selective reading of big inputs; the case for aggressive compaction of agent history depends more on how you serve or pay for the model.
Limits the authors acknowledge
The paper is clear about what it does not show. Compaction is lossy, and the authors describe a simple task designed to defeat it: an agent records a long series of coin tosses and is later asked for a specific one. Any fixed-size note will eventually drop some results. Their answer is to keep a complete log of the conversation available as a file the agent can search, which turns the problem back into a long-input task. Information can live outside the context and be fetched on a need-to-know basis.
They also state that their evidence "does not rule out the existence of tasks for which long context is beneficial, nor does it prove that every possible task can be solved with short context." It shows that the usual arguments for long context, big inputs and long task horizons, were not enough in the settings they tested. The work is a preprint, the main experiments used two closed models and specific harnesses, and the results for other models and agent designs may differ.
A proposal: semantic state space models
The paper ends by proposing what it calls Semantic State Space Models. The idea is a model post-trained to read a plain-language description of where a task stands, decide and take the next action, record the outcome, and rewrite the description so a separate copy of the model can carry on. It borrows the name from state space models such as Mamba, which carry a hidden numerical state between tokens, but here the state is readable text carried between turns. The authors suggest such models could be cheaper to run and easier to train, and ask why anyone trains models to accumulate full histories at all. That is a hypothesis, not a result: no such model was built or tested in the paper.
What this means if you build with AI
You do not need a new model to use these ideas. If you build or configure AI agents, the paper points to a few concrete habits:
- Do not paste huge documents into a prompt by default. Store them as files and let the agent search and read the parts it needs. In these tests that was both more accurate and much cheaper.
- Write handoff notes as forward-looking briefs. Keep the original task word for word, the current plan, the definition of done, key facts and dead ends. Skip the narrative.
- Keep the full log somewhere searchable. Compaction loses detail; a searchable record lets the agent recover it when it matters.
- Test your model before tightening the budget. Strong closed models coped with very short contexts, but some open models degraded sharply. Measure on your own tasks.
- Check your bill, not just your accuracy. Under flat token pricing, frequent compaction can raise costs on long agent runs even when it helps accuracy.
The broader takeaway is that a bigger context window is a convenience, not a requirement. The authors close by pointing out that the classic definition of computation assumes a machine that only ever reads a bounded amount of input at a time and keeps a finite state of mind. Their experiments suggest today's best models can work much the same way, and that the industry may have been paying for memory it does not need.