@snwiki238337: NVIDIA的研究团队最近发了一篇很有冲击力的文章,题为You don't need long context,就是你不需要长上下文吗。 过去这两年,各家大模型厂商一直在卷 256K、1M 甚至更大的上下文窗口,仿佛只要能把整本小说或整个…

X AI KOLs Timeline 论文

摘要

NVIDIA的研究论文《You don't need long context》通过实验证明超长上下文窗口带来3.6到7倍的单token推理成本,而通过会话压缩、单步压缩和关键词检索等短上下文策略,Claude Opus 4.5等模型在SWE-bench Verified和Terminal-Bench上成绩不降反升,并提出语义状态空间模型(SSSM)的新设想。

NVIDIA的研究团队最近发了一篇很有冲击力的文章,题为You don't need long context,就是你不需要长上下文吗。 过去这两年,各家大模型厂商一直在卷 256K、1M 甚至更大的上下文窗口,仿佛只要能把整本小说或整个代码库一次性塞进对话里就能解决一切问题。 英伟达的研究人员直接用实验反驳了这个路线,超长上下文窗口在云端和本地端都很慢、极其费显存、且更容易出错,绝大多数情况下根本不需要它。 他们的逻辑是平时各大 API 平台对外统一按百万 Token 固定标价,这掩盖了一个底层的物理事实就是在自回归生成阶段,生成第 20 万个 Token 的计算和显存开销,远远高于生成第 1000 个 Token。 英伟达在 H100 集群和本地 DGX Spark 上实测了几款主流开源编程模型,发现在 256K 满窗口下跑推理,单 Token 的实际部署成本和延迟能达到 16K 短窗口时的 3.6 到 7 倍,而这种开销降幅甚至超过了很多量化或稀疏化剪枝优化。 为了验证到底能不能不用长窗口,他们把需要大上下文的场景拆成两类:一类是 Agent 跑多轮任务越积越长的历史记录,另一类是一开始就塞进来几万字的长文档,然后分别用极简的短上下文策略去替换。 针对长程智能体任务,他们做了两个实验。温和一点的做法叫会话末压缩,就是平时正常跑,只要上下文快撞到设定的短阈值,就让模型写一份简明扼要的交接笔记,然后直接把当前会话彻底销毁,拿原始任务和这份笔记重开一个全新的干净会话。 另一项极端的测试叫单步压缩,就是说每执行完一个环境动作,就立刻更新状态笔记、销毁当前对话,下一个动作永远从零开启新对话。 结果在 SWE-bench Verified 和 Terminal-Bench 2.1 这两个高难度编程基准上,Claude Opus 4.5 在每做一步就清空对话、峰值上下文中位数压到仅 8K的极限状态下,跑出了 70.2% 和 51.8% 的成绩,反而分别比保留全部历史记录的基线高出了 0.2 和 4.6 个百分点。 GPT-5.6 Sol 的表现也几乎持平。至于最核心的笔记怎么写才不丢指令,他们发现最好写成医院护士交接班时的那种交接单。就是你可以只写清楚原始目标是什么、当前查到了哪一步、已经试过哪些失败的方法、以及下一步打算干嘛,把无关的中间试错日志全去除。 针对长文档输入,思路同样直接。把长文档留在本地文件里,只给模型配几个像人按 `Ctrl+F` 一样的关键词搜索和分段读取工具。 在 RULER 和 BABILong 等长文本评测里,这种自己决策的短窗口方案,不仅在召回率上经常反超把整篇文章硬塞进内存的全量基线,推理成本更是直接砍掉了数倍甚至数十倍。 基于这组实证,论文在最后顺势提出了一个新的模型演进设想,叫语义状态空间模型,简称 SSSM。 传统架构里的状态空间模型SSM是把历史信息压进黑盒神经网络隐藏向量里,而英伟达提议通过后训练,专门教会语言模型在每一次交互结束时,把工作状态维护在一段人类可读、可审计的简短自然语言笔记里,让下一个新拉起的短窗口实例可以继续。 虽然这个设想目前还停留在概念阶段、也没能彻底替代需要把几十篇维基百科揉在一起做交叉综合的任务,而且开源小模型里也出现了像 Qwen3 Coder Next 因为话痨导致 16K 窗口下根本塞不下有效工作的反例。 但它的启示是很好的,与其维持一个臃肿、注意力不断被历史噪音稀释的百万级上下文窗口,不如把窗口缩回到几万 Token 以内,通过这种策略更好的利用模型的效果。 原文:https://arxiv.org/pdf/2611.05306
查看原文
查看缓存全文

缓存时间: 2026/11/24 11:21

NVIDIA的研究团队最近发了一篇很有冲击力的文章,题为You don’t need long context,就是你不需要长上下文吗。

过去这两年,各家大模型厂商一直在卷 256K、1M 甚至更大的上下文窗口,仿佛只要能把整本小说或整个代码库一次性塞进对话里就能解决一切问题。

英伟达的研究人员直接用实验反驳了这个路线,超长上下文窗口在云端和本地端都很慢、极其费显存、且更容易出错,绝大多数情况下根本不需要它。

他们的逻辑是平时各大 API 平台对外统一按百万 Token 固定标价,这掩盖了一个底层的物理事实就是在自回归生成阶段,生成第 20 万个 Token 的计算和显存开销,远远高于生成第 1000 个 Token。

英伟达在 H100 集群和本地 DGX Spark 上实测了几款主流开源编程模型,发现在 256K 满窗口下跑推理,单 Token 的实际部署成本和延迟能达到 16K 短窗口时的 3.6 到 7 倍,而这种开销降幅甚至超过了很多量化或稀疏化剪枝优化。

为了验证到底能不能不用长窗口,他们把需要大上下文的场景拆成两类:一类是 Agent 跑多轮任务越积越长的历史记录,另一类是一开始就塞进来几万字的长文档,然后分别用极简的短上下文策略去替换。

针对长程智能体任务,他们做了两个实验。温和一点的做法叫会话末压缩,就是平时正常跑,只要上下文快撞到设定的短阈值,就让模型写一份简明扼要的交接笔记,然后直接把当前会话彻底销毁,拿原始任务和这份笔记重开一个全新的干净会话。

另一项极端的测试叫单步压缩,就是说每执行完一个环境动作,就立刻更新状态笔记、销毁当前对话,下一个动作永远从零开启新对话。

结果在 SWE-bench Verified 和 Terminal-Bench 2.1 这两个高难度编程基准上,Claude Opus 4.5 在每做一步就清空对话、峰值上下文中位数压到仅 8K的极限状态下,跑出了 70.2% 和 51.8% 的成绩,反而分别比保留全部历史记录的基线高出了 0.2 和 4.6 个百分点。

GPT-5.6 Sol 的表现也几乎持平。至于最核心的笔记怎么写才不丢指令,他们发现最好写成医院护士交接班时的那种交接单。就是你可以只写清楚原始目标是什么、当前查到了哪一步、已经试过哪些失败的方法、以及下一步打算干嘛,把无关的中间试错日志全去除。

针对长文档输入,思路同样直接。把长文档留在本地文件里,只给模型配几个像人按 Ctrl+F 一样的关键词搜索和分段读取工具。

在 RULER 和 BABILong 等长文本评测里,这种自己决策的短窗口方案,不仅在召回率上经常反超把整篇文章硬塞进内存的全量基线,推理成本更是直接砍掉了数倍甚至数十倍。

基于这组实证,论文在最后顺势提出了一个新的模型演进设想,叫语义状态空间模型,简称 SSSM。

传统架构里的状态空间模型SSM是把历史信息压进黑盒神经网络隐藏向量里,而英伟达提议通过后训练,专门教会语言模型在每一次交互结束时,把工作状态维护在一段人类可读、可审计的简短自然语言笔记里,让下一个新拉起的短窗口实例可以继续。

虽然这个设想目前还停留在概念阶段、也没能彻底替代需要把几十篇维基百科揉在一起做交叉综合的任务,而且开源小模型里也出现了像 Qwen3 Coder Next 因为话痨导致 16K 窗口下根本塞不下有效工作的反例。

但它的启示是很好的,与其维持一个臃肿、注意力不断被历史噪音稀释的百万级上下文窗口,不如把窗口缩回到几万 Token 以内,通过这种策略更好的利用模型的效果。

原文:https://arxiv.org/pdf/2611.05306


You don’t need long context

Source: https://arxiv.org/html/2611.05306 Saurav MuralidharanJindong JiangYonggan FuWonmin ByeonHanrong YeRyan AngillyAli TaghibakhshiShih-Yang LiuSiru OuyangGreg HeinrichPavlo Molchanov

Abstract

Abstract.Later tokens are costlier to generate than earlier tokens. On frontier open weight models, the disparity in cost may rise to as much as 7x. Through frequent compaction, we show across a broad range of long-horizon and long-input tasks that frontier language models sacrifice little to no task accuracy when maintaining short contexts. We further demonstrate that LLM performance does not collapse on long-horizon software engineering tasks even when taking at most one action per context, and based on that we outline the concept of semantic state space models (SSSMs). Our findings question the need for long-context language models.

1Introduction

Figure 1:The cost of long context.Dollar cost of generating11M output tokens on an existing input KV cache as a function of the context window size, obtained by converting the measured peak decode throughput of each deployment at on-demand H100 prices (3\.85\\3.85per GPU-hour, Nebius, Sept. 2026). Input request lengths are drawn uniformly at random. GLM 5.2 and Kimi K2.6 are served with INT4 weights and BF16 activations, Qwen 3 Coder Next is served in BF16. Serving at a context window size of256256K rather than1616K costs3.6×3.6\timesmore per generated token for GLM,5.6×5.6\timesmore for Kimi, and7×7\timesmore for Qwen.Not all tokens are generated equal. Token generation latency and memory footprint both grow with the number of tokens in a language model’s context. This is due to the inherent linear111Model architectures with a constant cost of token generation with respect to context depth have been repeatedly proposed but have never been fully embraced – linear-cost attention-based mechanisms remain the backbone of all popular language models.relationship between the computational cost of generating a token and its depth within a context[25].Figure1shows the cloud token generation cost as a function of context window size for a selection of popular open-weight models. Observe that there is a considerable monetary benefit to serving models on cloud GPUs with consistently shorter contexts. This fact is often hidden from the end user since retail token prices are quoted at a fixed price per11M tokens regardless of the input context length. Note that the extent of cost reductions (3.6×3.6\timesto7×7\times) rivals or exceeds that of many other orthogonal optimization methods such as aggressive quantization or structured sparsification[5,14,8].

Monetary cost is not the only quality of LM workloads that suffers when inputs are long.

Figure2shows the token generation latency, throughput, and memory footprint of several popular locally-run coding models as a function of the input context length. Observe how the generation inter-token latency approximately doubles for several models across the measured context lengths, implying a doubling of the time required to generate a response at longer contexts.

Put simply, the longer the input context provided to the language model (LM), the slower, more memory hungry, and more expensive its output token generation.

Refer to captionFigure 2:The burden of long context.The token generation latency, token throughput, and memory footprint of several open-source models measured on an NVIDIA DGX Spark plotted as a function of input context length. For several models, later tokens take approximately 2x longer to generate than earlier tokens and require a larger memory footprint.Given the considerable benefits of keeping input context short in both cloud and edge LM use, one would assume that popular LMs would have naturally evolved to operate on contexts only as short as necessary to complete their tasks. This could not be farther from the truth. As seen inTable1, which compares the lengths of well-known works of writing with the context window sizes of representative proprietary and open-weight models, context window sizes have vastly outgrown many influential writings. It would seem that models have been evolving to accommodate the ever larger possible inputs rather than to maximize efficiency.

Literary worksModel context window sizesWorkWordsTokensModelWordsTokensThe Old Man and the Sea[21]∼27\sim 27K∼37\sim 37KMiniMax M2.7[31]∼150\sim 150K200200KThe Great Gatsby[15]∼48\sim 48K∼64\sim 64KClaude Opus 4.5[2]∼150\sim 150K200200KQur’an (Saheeh Int’l translation)[38]∼156\sim 156K∼207\sim 207KGemma 4 31B[16]∼192\sim 192K256256KKing James New Testament[26]∼181\sim 181K∼241\sim 241KKimi K2.6[32]∼192\sim 192K256256KGreat Expectations[12]∼184\sim 184K∼245\sim 245KQwen 3 Coder Next[9]∼197\sim 197K262262KThe Lord of the Rings[42]∼481\sim 481K∼640\sim 640KGemini 3.8 Flash[13]∼750\sim 750K11MWar and Peace[43]∼566\sim 566K∼753\sim 753KGLM 5.2[51]∼750\sim 750K11MKing James Old Testament[26]∼603\sim 603K∼802\sim 802KGPT 5.6 Sol[35]∼790\sim 790K1.051.05MTable 1:Lengths of literary works against model context window sizes.Word counts use the cited English editions. Word-token conversions use approximately1.331.33tokens per English word, while actual counts vary with text and tokenizer. Models and their context window sizes are detailed inSection2.3.The enormous context window sizes of contemporary LMs and the tangible cost advantages of keeping their contexts short thus appear to be at odds with each other. While operating with longer contexts might in some cases be thoughtbeneficialto model task accuracy, we must ask:

  1. RQ0Are long contextsnecessary?

If not, let’s do away with long contexts and long-context models. And, if there are currently any objective benefits of keeping long context models, we can likely preserve them by making the appropriate post-training adjustments to future models.

To answer0, look at where the so-called long contexts (and, correspondingly, large context windows) in language modeling come from. Broadly, there are two types of workloads that often result in long input contexts being passed to LMs:

  1. LCW1Workloads of long-horizon tasks – tasks that may require many actions in order to be completed and where the context builds up as the model makes its way towards the completion of the task[11,47,52].
  2. LCW2Workloads of long-input tasks – tasks that require operating across a large amount of input information[6,45,29].

Examining these two types of workloads more closely, it is not immediately clear whether operating on long contexts is necessary in order to complete them. In particular, the entire conversational history of1does not necessarily need to be considered at every step of a long-horizon operation in order to successfully complete the task. Likewise, the long inputs of2do not necessarily need to be ingested in their entirety at all times in order for the workload to conclude successfully. Moreover, observe that the tasks in2can always be reduced to1by storing the long input as a resource and equipping the LM with a tool for selective input reading.

Motivated by the advantages of keeping LM generation contexts short and the apparent lack of clear justification for the popular practice for ingesting long inputs all at once and maintaining long conversational histories as discussed above, we decompose0to pose the following research questions:

  1. RQ1Can long-horizon tasks be completed without long contexts?
  2. RQ2Can long-input tasks be completed without long contexts?
  3. RQ3Can long-horizon tasks be completed taking no more than a single action per context?

The rest of this paper is aimed at curtly answering these questions.

2Methodology

We use one methodology to answer all research questions posed inSection1.

2.1Definitions

The base term “context” is, unfortunately, considerably overloaded in language modelling. Below we outline our working definitions intended to fix the meaning of otherwise vaguely interpreted terms commonly used in the community and relied on throughout this paper. Their numerical boundaries are rough rules of thumb.

Inference step.

Aninference stepis one invocation of an LM to produce output. In agentic workflows, it typically coincides with one agent turn of a conversation.

Input context.

At a given inference step, theinput contextis the complete sequence of tokens made available to the LM to produce output. It may include system instructions, the task input, prior model outputs, tool results, and any other conversational history.

Output context.

At a given inference step, theoutput contextis the complete sequence of tokens generated by the LM in the inference step. It may include a thinking trace, tool calls, user-oriented outputs, or other model output artifacts.

Context.

At a given inference step, thecontextis the input context, the input context and an associated output context, or the input context and any token space reserved for a possible output context.

Context window and context window size.

Thecontext windowis the space of tokens an LM can comprehend at any given point, usually imposed by the model’s architecture or indirectly by its post-training data bias. Contexts exceeding context windows may cause system errors or unexpected behavior. Thecontext window sizeis the maximum number of tokens that an LM endpoint can process in one invocation, whether imposed by the model’s context window or narrowed by its serving configuration.

Long context.

We call a contextlongwhen its length approaches constituting a significant fraction of context window size of many contemporary frontier models, which tends to rest at approximately256256K tokens or more at the time of this study. We further call an execution regime or context-management strategylong-contextif it permits the context to grow toward that scale, even when an individual run terminates before reaching the context window size.

Short context.

We call a contextshortwhen its length is much closer to zero than to the context window size common to many contemporary frontier models. In the operating regimes emphasized in this work, short contexts are commonly limited to roughly1616K–5050K tokens. Note that we take “short” to mean short relative to common context window sizes; it does not mean that the context is small in an absolute linguistic sense. Even context window sizes of1616K–5050K tokens suffice to contain elaborate literary works (cf.Table1).

Long-input task.

Along input taskis a task which is accompanied by along input– i.e., input information that would constitute a long context if ingested directly. The termlong inputrefers to the size of the available task input, irrespective of whether a harness places all of it in the model context at once or exposes it through selective input reading.

Long-horizon task.

Along-horizon taskis a task whose completion requires many sequential model actions, with later actions depending on the observations, artifacts, or decisions produced by earlier ones. Absent context management, the resulting interaction history accumulates across the task and may grow toward a model’s context window size and form a long context.

2.2Benchmarks

We assess the merits of1,2and3by considering two groups of benchmarks corresponding to the sources of long context identified inSection1: long-horizon tasks (1), whose interaction histories grow as an agent acts, and long-input tasks (2), whose source material can itself fill or exceed a model’s context window size. Our ensemble of benchmarks covers realistic software-engineering, information-seeking, and tool-use workloads with controlled long-input diagnostics.

Long-horizon task benchmarks.

The long-horizon task benchmark group aims to represent real sequential workflows in which the model must repeatedly inspect an environment, select an action, observe its result, and use that result to decide what to do next. Without context management, every command, tool response, retrieved document, and intermediate decision is appended to an ever-growing history. The software-engineering benchmarks are particularly representative examples because repository exploration, implementation, and validation naturally form long sequences of interdependent actions. The remaining benchmarks broaden this group to information retrieval, user interaction, and cross-tool orchestration.

  • •SWE-bench Verified[23]is a human-validated set of 500 real GitHub issue-resolution tasks from popular repositories, where the agent must produce a patch that passes the repository’s held-out test suite.
  • •SWE-bench Multilingual[48]comprises 300 manually curated issue-resolution tasks from repositories across nine programming languages. It tests repository exploration, implementation, and validation across different language ecosystems.
  • •Terminal-Bench 2.1[30]is an agentic benchmark of 89 real command-line tasks executed in sandboxed containers and scored by per-task verifiers, measuring end-to-end terminal problem-solving beyond single-repository patching.
  • •FRAMES[27]contains 824 challenging multi-hop questions whose answers require combining information from two to fifteen Wikipedia articles. In our agentic formulation, the model searches a fixed Wikipedia corpus, opens relevant articles incrementally, and submits a free-form answer evaluated against the reference answer by an LM judge. The benchmark consequently tests iterative retrieval and evidence integration while allowing the retrieved evidence to accumulate in the interaction history.
  • •τ2\tau^{2}-bench[7]evaluates agents that converse with a simulated user while operating domain-specific tools under explicit policy constraints. We use the 184-task golden set spanning retail, airline, and telecommunications; success requires both satisfying the user’s request and bringing the environment to the correct final state. Its mixture of dialogue, reasoning, and state-changing tool calls tests whether information established early in an interaction remains usable by later actions.
  • •BFCLv3[36]evaluates multi-turn tool use in simulated environments. We use its 200 long-context episodes, which require agents to retain information across user turns and schedule state-changing tool calls.
Long-input task benchmarks.

The long-input task benchmark group holds the task question comparatively short while making the information needed to answer it large, at least in principle. It includes three broad, realistic long-document QA benchmarks and four needle-style benchmarks.

  • •LongBench v2[6]comprises 503 challenging multiple-choice questions with heterogeneous, predominantly natural inputs ranging from88K to approximately22M words. Its six task families cover single- and multi-document question answering, long in-context learning, long dialogue, code-repository understanding, and structured-data understanding.
  • •LOONG[45]is a 1,600-question multi-document benchmark in which a question typically depends on multiple complete financial reports, legal cases, or academic papers in either English or Chinese. Its locating, comparison, clustering, and chain-of-reasoning tasks are designed so that evidence is distributed across multiple load-bearing documents.
  • •Artificial Analysis Long Context Reasoning (AA-LCR)[4]comprises 100 human-crafted questions requiring reasoning across sets of real-world documents averaging approximately100100K input tokens. Its seven document categories include company and industry reports, government consultations, academic and legal documents, marketing materials, and survey reports. Answers require integrating evidence and performing multi-step reasoning across documents, rather than retrieving a directly stated fact.
  • •Needle in a Haystack (NIAH)[24]consists of target sentences inserted at controlled depths in long bodies of unrelated essay text and of asking for the fact expressed by that sentence. Our 125-instance grid varies both insertion depth and document length, with contexts extending from1616K to roughly500500K tokens.
  • •RULER[22]is a synthetic long-context suite containing thirteen tasks: eight needle-retrieval variants, variable tracking, common- and frequent-word extraction, and two multi-hop question-answering tasks. We evaluate all thirteen at256256K and500500K tokens and score the recall of the required answer set.
  • •Counting-Stars[39]scatters 32 marked numbers throughout a long text and asks the model to recover them all. We use the complete 192-question public set, spanning English and Chinese, acquisition and reasoning variants, and documents from44K to128128K tokens. The reasoning variant includes initially incorrect counts that are subsequently corrected, requiring the model to distinguish the final value from a nearby distractor rather than merely copy every marked number.
  • •BABILong[28]consists of short facts from the bAbI[46]reasoning tasks embedded into book text. Answering requires locating the relevant statements and then performing operations such as fact chaining, counting, negation, or set tracking. We evaluate 550 questions across all ten task types and five input lengths from6464K to11M tokens.

Note that even the needle-style benchmarks considered often do not feature a clear lexical overlap aiding easy retrieval. They do, however, require aggregation, variable tracking, or reasoning over multiple retrieved facts for the correct answer to be produced.

2.3Models

We perform our study on two groups of models. Large closed-weight models are used as the workers in our principal task-accuracy experiments, while large open-weight models support the cloud system throughput study and complementary local experiments.

Large closed-weight models.

Our principal benchmark experiments useClaude Opus 4.5andGPT 5.6 Sol. We select these models as representative of the strong general-purpose models used for coding, tool use, and other long-horizon workflows. Using independently developed model families also reduces the risk that an observed effect of compaction is specific to one provider or post-training recipe.

Large open-weight models.

We use large open-weight models for two additional parts of the experimentation. First, the cloud-throughput study inFigure1uses models large enough to require multi-GPU deployment and exposes the effect of context window size under saturated serving load:

  • •GLM 5.2[17,50], evaluated at context window sizes up to11M tokens;
  • •Kimi K2.6[32], evaluated at context window sizes up to256256K tokens; and
  • •Qwen 3 Coder Next[9], evaluated at context window sizes up to256256K tokens.

We fit the context-cost ratio from these throughput measurements and define the1optimized-retail-cost estimate inAppendixB.

Second, we use locally deployable open-weight models for the on-device systems measurements inFigure2and for complementary task-level experiments. We deploy them on an NVIDIA DGX Spark[33], whose 128GB of unified memory leaves about 109GB available for local LM serving.

Such deployments are relevant when source code or other task data must remain on-device for privacy or cost reasons. The two Qwen checkpoints are served in NVFP4[1]; the remaining three are served from GGUF weights throughllama.cppusing 3- to 4-bitk-/i-quantization. Together they cover hybrid linear/softmax attention, distinct interleaved sliding-window/global-attention stacks, gated grouped-query attention, and conventional full grouped-query softmax attention. This architectural diversity helps to test the sufficiency of short context claimed in1across models with different attention mechanisms and post-training characteristics.

  • •Qwen 3.6 27B[37]is a 27B-parameter dense model served in NVFP4. Its layers alternate in a 3:1 pattern between Gated DeltaNet and gated full attention. It has a context window size of256256K tokens.
  • •Qwen 3 Coder Next[9]is a sparse MoE model with 80B total and 3B active parameters, served in NVFP4. It uses the same hybrid Gated DeltaNet/full-attention pattern and has a context window size of256256K tokens.
  • •Gemma 4 31B[16]is a 31B-parameter dense model served from GGUFQ4_K_Mweights. It interleaves10241024-token local sliding-window attention with global-attention layers and has a context window size of256256K tokens.
  • •Step 3.7 Flash (198B A11B)[40]is a sparse MoE model with 198B total and 11B active parameters, served from GGUFQ3_K_Mweights. It interleaves512512-token sliding-window and full-attention layers in a 3:1 pattern, uses head-wise gated grouped-query attention, and has a context window size of256256K tokens.
  • •MiniMax M2.7[10]is a sparse MoE model with 230B total and 10B active parameters, served from GGUFIQ3_XXSweights. It uses full-softmax grouped-query attention throughout and has a context window size of200200K tokens[31].

2.4Harnesses

We use two closely related base harnesses. Both implement a minimal ReAct loop: the task is supplied in an initial user message, the model issues one Bash action at a time, and each action and its result are appended to the conversation[49]. When used, the Bash environment exposes the files, programs, and benchmark-specific utilities available to the agent. Each Bash invocation treats the related standard output, return code, and any execution error as action results.

mini-swe-agent.

For software-engineering and terminal tasks, we use the releasedmini-swe-agentharness[41], with only the environment integration required by each benchmark. Its system prompt describes the software-engineering workflow, and its Bash environment provides the task repository or container. When done, the agent submits its proposed pull request as a patch for evaluation.

mini-agent.

For the remaining benchmarks, we use ourmini-agentharness, which is a straightforward generalization ofmini-swe-agentaway from software engineering. It retains the same agent loop, model interface, and Bash interface, but uses benchmark-specific instructions, environments, and submission rules. The instructions specify the available commands, task procedure, and required answer format. Only the system instruction and task description are provided in the initial user message. Supporting inputs and tools are made available through the environment. When done, an evaluation benchmark adapter recognizes the designated submission command, extracts its payload, terminates the episode, and records the prediction in the benchmark evaluator’s required format.

2.4.1Accommodations for long conversational context

We compare three context-management regimes applied to the base harnesses described above. These regimes determine which interaction history is presented to the model. The regimes’ functioning is illustrated inFigure3.

Figure 3:Context-management regimes.The three context-management regimes considered in this work: Full-History Accumulation (FHA), End-of-Conversation Compaction (EoCC), and Single-Action Compaction (SAC).##### Full-History Accumulation (FHA).

The baseline full-history accumulation regime appends every model action and environment observation to a single conversation for the duration of the task. No history is removed or replaced during a run. This is the default mode of operation formini-swe-agentandmini-agent.

End-of-Conversation Compaction (EoCC).

This regime follows the full-history ReAct loop until the length of the conversational context crosses a pre-specified compaction threshold. The model is then instructed within the active conversation to produce a bounded, task-relevant compaction of its state (seeAppendixA). A higher total context limit reserves space for this compaction turn and terminates the conversation if compaction does not complete in time. The harness starts a fresh conversation containing the original task and the compacted state, and execution resumes under the same system prompt. This cycle repeats whenever the compaction threshold is crossed. We write these two values as “total context limit / compaction threshold” in tokens.

Single-Action Compaction (SAC).

This regime maintains a compact semantic state and essentially no conversational history. Each conversation receives the task and current semantic state, performs exactly one environment action, observes its result, and updates the semantic state. The harness then discards that conversation and starts a fresh one for the next action. For the experiments inSection5, we apply SAC as a context-management regime tomini-swe-agent; the underlying agent harness, model, and task environment otherwise remain unchanged. SAC therefore keeps the active conversational context shortest of the three regimes and operationalizes the single-action setting of3.

Context length measures.

We distinguishtotal lengthfrompeak length. For a full-history baseline, total length is the length of its execution’s conversation. For EoCC and SAC, total length is the sum of the final lengths of all conversations created during the execution. Peak length is the length of the largest conversation produced during the task. Both measures are expressed in thousands of tokens (K) and summarized across tasks as mean / median / maximum or median / maximum, as indicated in each table.

2.4.2Accommodations for long inputs

We enable selective input reading by storing each long input as one or more documents (e.g.,input01.txt,input02.txt) in the agent’s filesystem environment rather than placing their full contents in the initial conversation. The task message identifies the available documents, and the agent performs selective input reading using standard Bash tools (e.g.,sed,awk,head). This method of input presentation makes selective input reading an explicit environment action and thereby reduces a long-input workload to a long-horizon workload. We provide the agent instructions and examples of selective reading inAppendixE.

2.5Latency and throughput measurement

Cloud serving.

For each model, we use the smallest H100 node-deployment that can hold the served checkpoint and a KV cache at the maximum evaluated context window size: eight H100 GPUs for Qwen 3 Coder Next and sixteen for GLM 5.2 and Kimi K2.6. For each context window size, we draw request lengths uniformly from nested prefixes of a shared token sequence, with sufficient space reserved for generation. We prefill the longest prefix once, enable prefix caching, and require every subsequent prefix request to generate exactly1,0241,024tokens. After warm-up, we sweep request concurrency and measure sustained aggregate decode throughput as completed output tokens divided by elapsed time. We report the highest-throughput setting with no KV-cache preemption; repeated measurements varied by at most 2%. The results are inFigure4. The cost values inFigure1convert these throughput measurements to the cost of11M output tokens using the stated hourly GPU price.

Local serving.

On the DGX Spark, we evaluate one model instance and one request at a time. For each model, we construct a sequence at its maximum supported length and measure generation after prefixes of increasing length drawn from that sequence. At each length, we record the mean inter-token latency over the next1,0241,024generated tokens and the total device-memory consumption. The batch-one decode throughput inFigure2is the reciprocal of the mean inter-token latency.

Figure 4:Decode throughput collapses as the context window size grows.Peak sustained decode throughput (tokens/s, left axis) for open-weight coding models served under vLLM on NVIDIA H100 GPUs, as a function of the configured context window size. GLM 5.2 and Kimi K2.6 are served with INT4 experts and BF16 activations (Kimi additionally with an FP8 KV cache), Qwen 3 Coder Next in BF16. The right axis re-expresses the same curve as a speedup over the256256K operating point. Reducing the context window size from256256K to1616K buys3.6×3.6\times(GLM 5.2),5.6×5.6\times(Kimi K2.6), and7×7\times(Qwen 3 Coder Next) more decoded tokens per second on identical hardware.

3Long-horizon tasks don’t need long contexts

1.*Can long-horizon tasks be completed without long contexts?*Answer:Yes. Frequent compaction keeps the context short while broadly maintaining task accuracy.

Following the outline ofSection2, we evaluate EoCC on 6 benchmarks representing long-horizon workloads and measure the performance of EoCC-modified harnesses against their baseline FHA counterparts. For each benchmark and model, we sequentially decrease the total context token limit and the corresponding compaction threshold to fit the total context limit. This has the effect of lowering the maximum context window needed by the model and of triggering increasingly more frequent compactions while executing long-horizon tasks. We describe what these compactions are designed to preserve inAppendixA. For SWE-bench Verified, TerminalBench 2.1, SWE-bench Multilingual, and FRAMES, we evaluate the models at total context limits / compaction thresholds (cf.Section2.4.1) of4848K/3636K,3232K/2424K,2424K/1818K, and1616K/1212K. For BFCLv3, we consider2424K/1818K,1616K/1212K, and1212K/88K, while for Tau2Bench, we consider1616K/1212K,1212K/88K, and88K/66K.

Figure5plots the EoCC accuracies and estimated cost savings relative to FHA baselines against increasing levels of compaction.

Figure 5:Long-horizon results as a function of total context limit.Top: accuracy changes in percentage points relative to each model’s full-history baseline; zero indicates unchanged accuracy. Bottom: baseline estimated optimized retail cost divided by the compaction configuration’s estimated optimized retail cost;1×1\timesindicates unchanged cost. Orange/blue identify Claude Opus 4.5 and GPT 5.6 Sol, respectively, and stars mark the baselines. Cost estimates use the model inAppendixB.Skimming through the line plots, observe first that the performance broadly remains flat, sometimes falling a few points below, sometimes remaining elevated above the baseline. More specifically, across all benchmarks and compaction thresholds, the relative performance of Opus 4.5 ranges from -3.7 to +5.6ppts, while the relative performance of GPT 5.6 Sol ranges from -3.3 to +4.4. The ranges are somewhat deceiving when considered by themselves, however: for either model, no more than 5 out of 22 threshold configurations lose more than 2ppts of the baseline. Secondly, observe the multiples of cost savings across all benchmarks, ranging from 2.2x to 8.8x for Opus 4.5 and from 2.4x to 5.0x for GPT 5.6 Sol. These represent the estimated cost savings as a consequence of serving only shorter context window sizes, and are considerable.

One pathology that could occur due to frequent compaction is that while it may successfully enforce smaller context window size, the full workflow history might be becoming longer as a consequence of the model having to re-do previously done tasks or to revisit previously seen information. Such behavior could result in an increased total token spend per task, ultimately erasing some of the cost savings due to smaller context windows. In our experimentation, this was generally not the case. Detailed per-benchmark accuracy, token spend, total length, cost and their discussion are provided inAppendixC.

In sum, we observe that even the naive approach to keeping context short by compacting agent’s work history once its conversation reaches a certain restrictive threshold leads to, broadly-speaking, on-par performance in model performance on long-horizon tasks when using frontier closed-weight models. Complementary results for open-weight models are provided inAppendixD. It would seem that the benefits of maintaining long contexts manifest themselves inconsistently and are not drastic so as to discourage efforts to keep the working context short in autonomous agentic workloads. Hence our answer to1: yes.

3.1Long-horizon tasks may sometimes need the history

Long-horizon tasks may sometimes need the history, but that does not mean that they require long contexts.

Compaction is a lossy context compression method. Information will be lost as a consequence of compacting a conversational history. Even more information will be lost if the conversational history being compacted already contains a result of an earlier compaction.

It is not too difficult to construct a task whose accuracy is guaranteed to suffer when a compaction is performed. Consider, for example, an agent that has access to a tool that generates coin tosses and reports the outcome of each coin toss in its tool result. With a compaction budget fixed, the agent is guaranteed to eventually start losing information about the outcomes of some of the coin tosses. If, at some point, the agent needs to inspect the sequence of coin toss outcomes (e.g., access theiith outcome), it is guaranteed to eventually fail as a consequence of some compaction necessarily eliminating some of its toss outcome records, with the compaction being the cause.

Observe, however, that any such example can be eliminated by creating a harness that keeps a record of every message of any agentic conversation, and makes it readily accessible to the agent by the means of a selective reading tool. The querying of the agent’s conversational history then becomes a long-input task, which we tackle in2.

In other words, there is a difference between information that needs to be a part of model context and information that could, in principle, be retrieved selectively on a “need-to-know basis”.

Note that the findings of our experimentation above are not that “you don’t ever need to access conversational history”, but roughly that “you don’t need to keep the entire conversational history in the context in order to complete long-horizon tasks”.

4Long-input tasks don’t need long contexts

2.*Can long-input tasks be completed without long contexts?*Answer:Yes. Selective input reading and compaction keep contexts short, maintaining task accuracy.

We evaluate EoCC on 7 benchmarks representing long-input workloads and measure the performance of EoCC-modified harnesses against their baseline full-input counterparts. For each benchmark and model, the full-input baseline receives the entirety of the input as prescribed by the benchmark while the compacting harness uses Bash tools to perform selective reading of inputs from environment filesystem (seeAppendixE). Where appropriate in EoCC runs, we further sequentially decrease the total context token limit and the corresponding compaction threshold to fit the total context limit. For many long-input tasks (especially the needle-based tasks), one restrictive total token limit is enough to showcase on-par or better performance.

Figure6plots the EoCC accuracies and estimated cost savings relative to FHA baselines against one or multiple levels of compaction.

Figure 6:Long-input results as a function of total context limit.Top: accuracy changes relative to each model’s full-input baseline. Bottom: optimized retail cost savings, using the model inAppendixB.Looking through the line plots, observe first that the performance broadly remains flat, sometimes falling a few points below, sometimes remaining elevated above the baseline. More specifically, across all benchmarks and compaction thresholds, the relative performance of Opus 4.5 ranges from -0.4 to +40.0ppts, while the relative performance of GPT 5.6 Sol ranges from +1.0 to +30.9 (!). Observe also the multiples of cost savings across all benchmarks, ranging from 6.5x to 54.6x for Opus 4.5 and from 4.4x to 233.3x for GPT 5.6 Sol. These represent the estimated cost savings as a consequence of both selective input reading and serving only shorter context window sizes, and warrant serious consideration.

Figures7and8plot total conversation length, summed across stretches, against document length. On logarithmic document-length axes spanning orders of magnitude, conversation lengths on the linear vertical axes remain concentrated in broadly similar bands for most tasks, with some longer outliers. The dashed equal-length referencey=xy=xrises exponentially in these plotting coordinates, whereas most conversations do not grow proportionally with document length. This shows that even as document length increases, the conversation length remains broadly bounded.

Figure 7:LongBench v2: conversation length versus document length.Claude Opus 4.5, compaction at1616K /1212K. The document-length axis is logarithmic and the conversation-length axis is linear. The dashed curve marksy=xy=x.Figure 8:LOONG: conversation length versus document length.Claude Opus 4.5, compaction at4848K /4040K (1,600 questions). The document-length axis is logarithmic and the conversation-length axis is linear. The dashed curve marksy=xy=x.Detailed per-benchmark accuracy, token spend, cost, compactions and their discussion are provided inAppendixF.

In summary, we observe that selective input reading, with compaction available as a fallback, matches or improves long input baseline performance across almost all long-input benchmarks and remains close to baseline in the remaining case, while keeping peak live context far below baseline conversation lengths. The near-zero median number of compactions and the roughly constant conversation lengths as document size grows support the intuition that despite the long inputs provided to tasks, the actual amount of information required to solve those tasks remains low. Thus, the size of a task’s input does not itself establish a need for long context. Hence our answer to2: yes.

5Compaction can be performed after every action

3.*Can long-horizon tasks be completed taking no more than a single action per context?*Answer:Yes. Single-action compaction maintains an effective compact semantic state.

The combined comparison inTable2shows that, for Claude Opus 4.5, SAC preserves themini-swe-agentbaseline accuracy on SWE-bench Verified and improves it by 4.6 percentage points on Terminal-Bench. For GPT 5.6 Sol, SAC reaches 82.4% on SWE-bench Verified and 84.3% on Terminal-Bench (75 of 89 tasks solved), below its mini baseline by 2.0 and 3.3 percentage points, respectively. Meanwhile, across both models and benchmarks, median peak live context under SAC is only77–99K tokens, and the maximum falls from130130–200200K to1515–3737K tokens.

Accuracy (%)Peak context length (K)BenchmarkminiBest EoCCSACminiBest EoCCSACbaseline(median / max)(median / max)(median / max)Claude Opus 4.5SWE-bench Verified70.074.8 (2424K /1818K)70.232 / 20019 / 228 / 16Terminal-Bench (2.1)47.252.8 (3232K /2424K)51.827 / 13024 / 319 / 19GPT 5.6 SolSWE-bench Verified84.488.8 (4848K /3636K)82.418 / 17322 / 357 / 15Terminal-Bench (2.1)87.688.8 (4848K /3636K)84.317 / 13323 / 408 / 37

Table 2:SAC versus FHA and EoCC.Themini baselineis the full-history accumulation regime. TheBest EoCCaccuracy is accompanied by its total context limit / compaction threshold in parentheses. TheBest EoCCandSACcolumns underPeak context lengthreport the largest single-call contexts under the best EoCC configuration and SAC, respectively; all context statistics are per task in K tokens and reported as median / maximum.Thus, SAC preserves or improves baseline accuracy for Claude Opus 4.5, while GPT 5.6 Sol incurs small accuracy reductions. This is somewhat remarkable, considering that both models reduce each interaction to a single action and carry only a compact semantic state between contexts. The resulting live contexts are far shorter than the full-history conversations, showing that compaction frequency can be pushed to relative extremes without catastrophic consequences for task accuracy. Hence our answer to3: yes.

5.1Semantic State Space Models (SSSMs).

The above observations ofSection5and earlier observations ofSections3and4force a reflection: If powerful models can broadly maintain performance by compacting often or even compacting after taking a single action, cannot all long-context workflows be coerced into becoming single-action workflows through compaction? In other words, could not all models potentially be performing single-action compaction (SAC) by default? To do so would roughly correspond to maintaining asemantic stateacross long-context workflows.

We propose the notion of a Semantic State Space Model (SSSM). A SSSM is a model post-trained to (1) comprehend an input language description of a state of a conversation, (2) reason about the appropriate next action or about the task at hand, (3) take an action, (4) register its outcome, and (5) update the language description of the conversation’s state with the reasoning conclusions, action decisions, and action outcomes in a way that allows a separate inference instance of the SSSM to continue the conversation toward completion. The notion of a SSSM is closely related to that of a State-Space Model[20,19,18]. Unlike an SSM, which maintains a black-box neural state between token generations, an SSSM maintains an explainable natural language (hence “semantic”) state between turns of a continuing conversation.

The utility of SSSMs as opposed to existing conversational models trained for growing full-history conversations lies in their increased token efficiency – as shown inFigure1, there is a considerable cost benefit to maintaining short contexts. We further surmise that it is considerably more data-efficient to train semantic state-space models due to the lack of need to teach the model to pay attention to the suitable patches of earlier context. Ultimately, we see no reason why SSSMs could not match the performance of full-history-accumulating models, which begs the question: Why train full-history-accumulating models in the first place?

6Conclusion

Our experiments provide affirmative answers to all three research questions1,2and3. In particular, we found that on long-horizon tasks, even simple end-of-conversation compaction usually matches or slightly improves on full-history accuracy, with only modest losses in the remaining settings. We showed that on long-input tasks, selective input reading with compaction as a fallback matches or improves (sometimes considerably) the full-input baselines in almost every case while keeping live context short. Finally, single-action compaction nearly preserves or improves on the baseline accuracy while carrying only a compact semantic state between actions.

1,2and3were motivated by the root question0: “Are long contextsnecessary?” Based on the affirmative answers to all of the above, we conclude that long contexts are not necessary for the completion of “long-context” tasks. This is far from surprising. After all, the very motivation behind the definition of computability rests on the assumption that anything computable may be computed by comprehending only a bounded amount of input at a time and maintaining only a finite state of mind[44].

Our 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 does, however, show that the standard arguments in favor of long contexts stemming from long input and long conversational horizons are insufficient: disciplined state maintenance and selective access remove the presumed necessity in every setting we tested. We believe that with the appropriate adjustments made to the post-training of LMs, the context window size requirements currently imposed on these models by the standard arguments for long contexts could be removed, and model context window sizes could shrink drastically, significantly improving the cost of token generation on the cloud and the speed of token generation on local inference accelerators.

References

  • [1]E. Alvarez, O. Almog, E. Chung, S. Layton, D. Stosic, R. Krashinsky, and K. Aubrey(2025)Introducing NVFP4 for efficient and accurate low-precision inference.Note:NVIDIA Technical BlogExternal Links:LinkCited by:§2.3.
  • [2]Anthropic(2025)Introducing Claude Opus 4.5.Note:Official announcementExternal Links:LinkCited by:Table 1.
  • [3]Anthropic(2026)Claude Opus 4.5 model overview and pricing.Note:Claude Platform documentationAccessed September 29, 2026External Links:LinkCited by:Appendix B,Table 3.
  • [4]Artificial Analysis Team(2025)Artificial analysis long context reasoning benchmark (LCR).Artificial Analysis, Inc..Note:Hugging Face datasetExternal Links:LinkCited by:3rd item.
  • [5]S. Ashkboos, I. Markov, E. Frantar, T. Zhong, X. Wang, J. Ren, T. Hoefler, and D. Alistarh(2024)QUIK: towards end-to-end 4-bit inference on generative large language models.InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing,pp. 3355–3371.External Links:Document,LinkCited by:§1.
  • [6]Y. Bai, S. Tu, J. Zhang, H. Peng, X. Wang, X. Lv, S. Cao, J. Xu, L. Hou, Y. Dong, J. Tang, and J. Li(2025)LongBench v2: towards deeper understanding and reasoning on realistic long-context multitasks.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers),Vienna, Austria,pp. 3639–3664.External Links:Document,2412.15204,LinkCited by:2,1st item.
  • [7]V. Barres, H. Dong, S. Ray, X. Si, and K. Narasimhan(2025)τ2\tau^{2}-Bench: evaluating conversational agents in a dual-control environment.External Links:2506.07982,LinkCited by:5th item.
  • [8]F. Busato and J. Pool(2020)Exploiting NVIDIA ampere structured sparsity with cuSPARSELt.Note:NVIDIA Technical BlogExternal Links:LinkCited by:§1.
  • [9]R. Cao, M. Chen, J. Chen, Z. Cui, Y. Feng, B. Hui, Y. Jing, K. Li, M. Li, J. Lin, Z. Ma, K. Shum, X. Wang, J. Wei, J. Yang, J. Zhang, L. Zhang, Z. Zhang, W. Zhao, and F. Zhou(2026)Qwen3-Coder-Next technical report.External Links:2603.00729,LinkCited by:Table 1,3rd item,2nd item.
  • [10]A. Chenet al.(2026)The MiniMax-M2 series: mini activations unleashing max real-world intelligence.External Links:2605.26494,LinkCited by:5th item.
  • [11]X. Deng, J. Da, E. Pan, Y. Y. He, C. Ide, K. Garg, N. Lauffer, A. Park, N. Pasari, C. Rane, K. Sampath, M. Krishnan, S. Kundurthy, S. Hendryx, Z. Wang, V. Bharadwaj, J. Holm, R. Aluri, C. B. C. Zhang, N. Jacobson, B. Liu, and B. Kenstler(2025)SWE-Bench Pro: can AI agents solve long-horizon software engineering tasks?.External Links:2509.16941,LinkCited by:1.
  • [12]C. Dickens(1998)Great expectations.Note:Project GutenbergProject Gutenberg eBook no. 1400External Links:LinkCited by:Table 1.
  • [13]T. Doshi and R. A. Popa(2026)Introducing Gemini 3.8 Flash and 3.8 Flash Cyber.Note:Google official blogExternal Links:LinkCited by:Table 1.
  • [14]V. Egiazarian, A. Panferov, D. Kuznedelev, E. Frantar, A. Babenko, and D. Alistarh(2024)Extreme compression of large language models via additive quantization.InProceedings of the 41st International Conference on Machine Learning,Proceedings of Machine Learning Research, Vol.235,pp. 12284–12303.External Links:LinkCited by:§1.
  • [15]F. S. Fitzgerald(2021)The great gatsby.Note:Project GutenbergProject Gutenberg eBook no. 64317External Links:LinkCited by:Table 1.
  • [16]Gemma Teamet al.(2026)Gemma 4 technical report.External Links:2607.02770,LinkCited by:Table 1,3rd item.
  • [17]GLM-5 Teamet al.(2026)GLM-5: from vibe coding to agentic engineering.External Links:2602.15763,LinkCited by:1st item.
  • [18]A. Gu and T. Dao(2024)Mamba: linear-time sequence modeling with selective state spaces.External Links:2312.00752,LinkCited by:§5.1.
  • [19]A. Gu, K. Goel, and C. Ré(2022)Efficiently modeling long sequences with structured state spaces.External Links:2111.00396,LinkCited by:§5.1.
  • [20]A. Gu, I. Johnson, K. Goel, K. Saab, T. Dao, A. Rudra, and C. Ré(2021)Combining recurrent, convolutional, and continuous-time models with linear state space layers.InAdvances in Neural Information Processing Systems,M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. W. Vaughan (Eds.),Vol.34,pp. 572–585.External Links:LinkCited by:§5.1.
  • [21]E. Hemingway(1952)The old man and the sea.Charles Scribner’s Sons,New York.Cited by:Table 1.
  • [22]C. Hsieh, S. Sun, S. Kriman, S. Acharya, D. Rekesh, F. Jia, Y. Zhang, and B. Ginsburg(2024)RULER: what’s the real context size of your long-context language models?.External Links:2404.06654,LinkCited by:5th item.
  • [23]C. E. Jimenez, J. Yang, A. Wettig, S. Yao, K. Pei, O. Press, and K. Narasimhan(2024)SWE-bench: can language models resolve real-world GitHub issues?.InThe Twelfth International Conference on Learning Representations,External Links:2310.06770,LinkCited by:1st item.
  • [24]G. Kamradt(2023)Needle in a haystack: pressure testing LLMs.Note:GitHub repositoryCanonical benchmark implementation; no arXiv paperExternal Links:LinkCited by:4th item.
  • [25]F. D. Keles, P. M. Wijewardena, and C. Hegde(2023)On the computational complexity of self-attention.InInternational conference on algorithmic learning theory,pp. 597–619.Cited by:§1.
  • [26]King James Bible(1989)The king james version of the bible.Note:Project GutenbergProject Gutenberg eBook no. 10External Links:LinkCited by:Table 1,Table 1.
  • [27]S. Krishna, K. Krishna, A. Mohananey, S. Schwarcz, A. Stambler, S. Upadhyay, and M. Faruqui(2025)Fact, fetch, and reason: a unified evaluation of retrieval-augmented generation.InProceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers),Albuquerque, New Mexico,pp. 4745–4759.External Links:Document,2409.12941,LinkCited by:4th item.
  • [28]Y. Kuratov, A. Bulatov, P. Anokhin, I. Rodkin, D. Sorokin, A. Sorokin, and M. Burtsev(2024)BABILong: testing the limits of LLMs with long context reasoning-in-a-haystack.InAdvances in Neural Information Processing Systems,Vol.37,pp. 106519–106554.External Links:Document,2406.10149,LinkCited by:7th item.
  • [29]N. F. Liu, K. Lin, J. Hewitt, A. Paranjape, M. Bevilacqua, F. Petroni, and P. Liang(2024)Lost in the middle: how language models use long contexts.Transactions of the Association for Computational Linguistics12,pp. 157–173.External Links:Document,LinkCited by:2.
  • [30]M. A. Merrill, A. G. Shaw, N. Carlini, B. Li, H. Raj, I. Bercovich, L. Shi, J. Y. Shin, T. Walshe, E. K. Buchanan, J. Shen, G. Ye, H. Lin, J. Poulos, M. Wang, M. Nezhurina, J. Jitsev, D. Lu, O. M. Mastromichalakis, Z. Xu, Z. Chen, Y. Liu, R. Zhang, L. L. Chen, A. Kashyap, J. Uslu, J. Li, J. Wu, M. Yan, S. Bian, V. Sharma, K. Sun, S. Dillmann, A. Anand, A. Lanpouthakoun, B. Koopah, C. Hu, E. Guha, G. H. S. Dreiman, J. Zhu, K. Krauth, L. Zhong, N. Muennighoff, R. Amanfu, S. Tan, S. Pimpalgaonkar, T. Aggarwal, X. Lin, X. Lan, X. Zhao, Y. Liang, Y. Wang, Z. Wang, C. Zhou, D. Heineman, H. Liu, H. Trivedi, J. Yang, J. Lin, M. Shetty, M. Yang, N. Omi, N. Raoof, S. Li, T. Y. Zhuo, W. Lin, Y. Dai, Y. Wang, W. Chai, S. Zhou, D. Wahdany, Z. She, J. Hu, Z. Dong, Y. Zhu, S. Cui, A. Saiyed, A. Kolbeinsson, J. Hu, C. M. Rytting, R. Marten, Y. Wang, A. Dimakis, A. Konwinski, and L. Schmidt(2026)Terminal-Bench: benchmarking agents on hard, realistic tasks in command line interfaces.External Links:2601.11868,LinkCited by:3rd item.
  • [31]MiniMax(2026)MiniMax-M2.7 checkpoint configuration.Note:Official Hugging Face model repositoryAccessed October 27, 2026External Links:LinkCited by:Table 1,5th item.
  • [32]Moonshot AI(2026)Kimi K2.6: from code to creation, from one to many.Note:Official model releaseAccessed September 14, 2026External Links:LinkCited by:Table 1,2nd item.
  • [33]NVIDIA Corporation(2025)NVIDIA DGX spark arrives for world’s AI developers.Note:NVIDIA NewsroomExternal Links:LinkCited by:§2.3.
  • [34]OpenAI(2026)GPT-5.6 Sol model pricing.Note:OpenAI API documentationAccessed September 29, 2026External Links:LinkCited by:Appendix B,Table 3.
  • [35]OpenAI(2026)GPT-5.6 Sol model specifications.Note:OpenAI API documentationAccessed September 16, 2026External Links:LinkCited by:Table 1.
  • [36]S. G. Patil, H. Mao, F. Yan, C. C. Ji, V. Suresh, I. Stoica, and J. E. Gonzalez(2025)The berkeley function calling leaderboard (bfcl): from tool use to agentic evaluation of large language models.InForty-second International Conference on Machine Learning,Cited by:6th item.
  • [37]Qwen Team(2026)Qwen3.6-27B: flagship-level coding in a 27B dense model.External Links:LinkCited by:1st item.
  • [38]Saheeh International(1997)The qur’an: arabic text with corresponding english meanings.Abul-Qasim Publishing House,Jeddah, Saudi Arabia.Cited by:Table 1.
  • [39]M. Song, M. Zheng, and X. Luo(2025)Counting-Stars: a multi-evidence, position-aware, and scalable benchmark for evaluating long-context large language models.InProceedings of the 31st International Conference on Computational Linguistics,Abu Dhabi, UAE,pp. 3753–3763.External Links:2403.11802,LinkCited by:6th item.
  • [40]StepFun(2026)Step-3.7-Flash model card.Note:Hugging Face model cardAccessed September 14, 2026External Links:LinkCited by:4th item.
  • [41]SWE-agent Team(2025)mini-swe-agent: the minimal AI software engineering agent.External Links:LinkCited by:§G.1,§2.4.
  • [42]J. R. R. Tolkien(1954)The lord of the rings.George Allen & Unwin,London.Note:Three volumesCited by:Table 1.
  • [43]L. Tolstoy(2001)War and peace.Note:Project GutenbergProject Gutenberg eBook no. 2600External Links:LinkCited by:Table 1.
  • [44]A. M. Turing(1937)On computable numbers, with an application to the Entscheidungsproblem.Proceedings of the London Mathematical Societys2-42(1),pp. 230–265.External Links:Document,LinkCited by:§6.
  • [45]M. Wang, L. Chen, F. Cheng, S. Liao, X. Zhang, B. Wu, H. Yu, N. Xu, L. Zhang, R. Luo, Y. Li, M. Yang, F. Huang, and Y. Li(2024)Leave no document behind: benchmarking long-context LLMs with extended multi-doc QA.InProceedings of the 2024 Conference on Empirical Methods in Natural Language Processing,Miami, Florida, USA,pp. 5627–5646.External Links:Document,2406.17419,LinkCited by:2,2nd item.
  • [46]J. Weston, A. Bordes, S. Chopra, A. M. Rush, B. van Merriënboer, A. Joulin, and T. Mikolov(2015)Towards AI-complete question answering: a set of prerequisite toy tasks.External Links:1502.05698,LinkCited by:7th item.
  • [47]J. Yang, C. E. Jimenez, A. Wettig, K. Lieret, S. Yao, K. R. Narasimhan, and O. Press(2024)SWE-agent: agent-computer interfaces enable automated software engineering.InThe Thirty-eighth Annual Conference on Neural Information Processing Systems,External Links:LinkCited by:1.
  • [48]J. Yang, K. Lieret, C. E. Jimenez, A. Wettig, K. Khandpur, Y. Zhang, B. Hui, O. Press, L. Schmidt, and D. Yang(2025)SWE-smith: scaling data for software engineering agents.External Links:2504.21798,LinkCited by:2nd item.
  • [49]S. Yao, J. Zhao, D. Yu, N. Du, I. Shafran, K. Narasimhan, and Y. Cao(2023)ReAct: synergizing reasoning and acting in language models.InThe Eleventh International Conference on Learning Representations,External Links:2210.03629,LinkCited by:§2.4.
  • [50]Z.ai(2026)GLM-5.2 model card.Note:Hugging Face model cardAccessed September 14, 2026External Links:LinkCited by:1st item.
  • [51]Z.ai(2026)GLM-5.2.Note:Official model release blogExternal Links:LinkCited by:Table 1.
  • [52]S. Zhou, F. F. Xu, H. Zhu, X. Zhou, R. Lo, A. Sridhar, X. Cheng, T. Ou, Y. Bisk, D. Fried, U. Alon, and G. Neubig(2023)WebArena: a realistic web environment for building autonomous agents.arXiv preprint arXiv:2307.13854.External Links:LinkCited by:1.

Appendix AWhat characterizes a good compaction?

It is a common experience of human-in-the-loop agent-aided SWE workflows that after a compaction is performed, certain crucial information disappears from the context and has to be obtained again, slowing down the SWE process or perhaps even confusing the model and losing crucial user preferences included in previous instructions. Note that human-in-the-loop agent-aided SWE workflows consist of two parts: autonomous SWE work performed by the agent, and reception and comprehension of the human’s steering feedback. Because of this, compactions produced for such workflows need to account for not only the information the agent needs to achieve its goals, but also for all potential information that might be relevant to follow-up autonomous work that might be triggered as a result of the human’s feedback.

In our experimentation, we initially set out to identify the cheapest, most useful method of compaction that can preserve as much task accuracy as possible on autonomous SWE work. We discovered that treating compaction as a mere special case of summarization is suboptimal for this purpose. LM summarizations generally attempt to give equal weight to all facts present in the input and are prone to overemphasize repeated segments of the agent trace regardless of their ultimate relevance to the tail of the trace being compacted. We explored the subject along two axes: the method (e.g., summarization or message pruning) and the information being pruned (e.g., the entire trace or only the trace segment since the last compaction plus the contents of the last compaction). We discovered that the best compactions are not those that faithfully capture the gist of the agentic trace, but those that best select facts relevant to the work yet to be performed – i.e., they are not narratives of the execution history but carefully cherry-picked briefs for further execution. In particular, we found that the most accuracy-preserving compactions, regardless of the frequency of compaction, are those that contain (1) a verbatim or near-verbatim copy of the input task, (2) a record of agent’s current occupation, intentions, and planned next steps, and (3) all the artifacts that are of direct relevance to future execution, including (3a) a decomposed plan made from the input task, (3b) a list of requirements detailing when to consider the task complete, and any pieces of information or pointers to artifacts containing information that is of relevance to the aforementioned two. Finally, we found that the above structure of compactions readily extends even to workflows that are not necessarily SWE-related in their nature. We used the same compaction structure for every type of workflow considered in this work.

Appendix BEstimated optimized retail cost

For modelMM, letCoutput,M​(W)C_{\text{output},M}(W)denote the USD per million output tokens at sizeWW. For measured models, letTM​(W)T_{M}(W)be the peak aggregate decode throughput (output tokens per second after input-context processing, assuming KV cached input). Fixed GPU allocation and hourly rate imply the1616K-to-256256K cost ratio

rM=Coutput,M​(16​K)Coutput,M​(256​K)=TM​(256​K)TM​(16​K)={0.2772GLM 5.2,0.1777Kimi K2.6,0.1439Qwen 3 Coder Next.r_{M}=\frac{C_{\text{output},M}(16\mathrm{K})}{C_{\text{output},M}(256\mathrm{K})}=\frac{T_{M}(256\mathrm{K})}{T_{M}(16\mathrm{K})}=\begin{cases}0.2772&\text{GLM 5.2},\\ 0.1777&\text{Kimi K2.6},\\ 0.1439&\text{Qwen 3 Coder Next}.\end{cases}(1) We take the rounded mean of the above measurements,r=0.20r=0.20.

For target frontier modelMM, letWMmaxW^{\text{max}}_{M}be the assumed reference context window size:200,000200,000tokens for Opus 4.5 and272272K for GPT 5.6 Sol[3,34]. The GPT’s272272K reference context window size is its standard-price ceiling (the model supports1,050,0001,050,000tokens, but our compactionWWnever exceeds the standard-price ceiling). For each compaction experiment, letW≤WMmaxW\leq W^{\text{max}}_{M}be the EoCC total context limit and letWMmaxW^{\text{max}}_{M}be the context window size for the FHA baseline (Section2.4.1). To estimate the cost of outputCoutput,Mestimate​(W)C^{\text{estimate}}_{\text{output},M}(W)of modelMM, we anchorCoutput,M​(WMmax)C_{\text{output},M}(W^{\text{max}}_{M})at the standard retail output price, $25 for Opus 4.5 or $20 for GPT 5.6 Sol, and then interpolate torr-times-the-standard-price at1616K, clamping smallerWWs:

Coutput,Mest.​(W)=Coutput,M​(WMmax)​[r+(1−r)​max⁡(W,16​K)−16​KWMmax−16​K].C^{\text{est.}}_{\text{output},M}(W)=C_{\text{output},M}(W^{\text{max}}_{M})\left[r+(1-r)\frac{\max(W,16\mathrm{K})-16\mathrm{K}}{W^{\text{max}}_{M}-16\mathrm{K}}\right].(2) LetCinput,M​(W)C_{\text{input},M}(W)andCcached,M​(W)C_{\text{cached},M}(W)be the est. USD per million uncached-input and cached-input tokens, respectively. These we deduce by preserving the original 5:1 output-to-uncached-input ratio and 10:1 uncached-input-to-cached-input ratio of the frontier models:

Cinput,M​(W)=Coutput,Mest.​(W)5,Ccached,M​(W)=Cinput,Mest.​(W)10.C_{\text{input},M}(W)=\frac{C^{\text{est.}}_{\text{output},M}(W)}{5},\qquad C_{\text{cached},M}(W)=\frac{C^{\text{est.}}_{\text{input},M}(W)}{10}.(3) For every experiment with modelMMmaintaining the EoCC total context limit atWW, letII,HH, andOObe aggregate millions of uncached input, cached input (cache hits), and generated output tokens, respectively. We compute the estimate of the finalestimated optimized retail costas reported in the paper as:

E​O​R​CM​(W)=I​Cinput,Mest.​(W)+H​Ccached,Mest.​(W)+O​Coutput,Mest.​(W).{EORC}_{M}(W)=IC^{\text{est.}}_{\text{input},M}(W)+HC^{\text{est.}}_{\text{cached},M}(W)+OC^{\text{est.}}_{\text{output},M}(W).(4)

Appendix CDetailed long-horizon results

The tables below report accuracy and cost profiles for Claude Opus 4.5 and GPT 5.6 Sol. Each table compares a baseline FHA agent (Section2.4) against an EoCC agent with different total context limits and compaction thresholds (Section2.4.1). Values are written as “total context limit / compaction threshold” in tokens: the agent compacts when the running context approaches the compaction threshold and never exceeds the total context limit.

Throughout the results, notice the following:

  • •In terms of accuracy, compactions tend to perform closely on-par with or slightly better than the corresponding baseline.
  • •In terms of total token spend, new input token counts generally increase with decreasing context window size while the re-used cached tokens generally decrease, consistently with the intuitive expectation. Output tokens are generally elevated when compacting.

InspectingTable3, we observe that every evaluated pair of total context limit and compaction threshold matches or improves on the baseline for GPT 5.6 Sol; Claude Opus 4.5 improves at every setting except the tightest (1616K /1212K), where accuracy decreases by 1.2 percentage points. The best results improve accuracy by 4.8 percentage points for Claude Opus 4.5 and 4.4 points for GPT 5.6 Sol.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsTotal length (K)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)70.084.420.0 / 420.0 / 4.416.4 / 100.2 / 3.1420\.00167.68420\.00167.680 / 0 / 00 / 0 / 048 / 32 / 20022 / 18 / 173Compaction,4848K /3636K73.688.820.0 / 334.7 / 4.517.6 / 94.2 / 3.9379\.85186.08130\.2055.820.3 / 0 / 60.4 / 0 / 530 / 25 / 22626 / 22 / 156Compaction,3232K /2424K72.085.023.0 / 255.9 / 4.717.2 / 73.4 / 4.3360\.45184.1697\.8246.040.8 / 1 / 130.9 / 1 / 932 / 28 / 33628 / 24 / 189Compaction,2424K /1818K74.885.022.0 / 166.5 / 4.117.7 / 60.4 / 4.7295\.75188.9669\.7142.521.0 / 1 / 181.5 / 1 / 1829 / 23 / 36232 / 24 / 287Compaction,1616K /1212K68.884.628.3 / 127.3 / 4.319.7 / 45.8 / 5.3312\.65203.1262\.5340.622.1 / 1 / 323.0 / 2 / 6134 / 24 / 41536 / 26 / 605

Table 3:SWE-bench Verified.Accuracyis the percentage of instancesresolved.Token spendlists new / cached input and output, expressed in M tokens, aggregated over the benchmark (newexcludes prompt-cache hits).Nominal retail costmultiplies these rounded totals by published standard API prices per million new input / cached input / output tokens: $5 / $0.50 / $25 for Opus 4.5 and $4 / $0.40 / $20 for GPT 5.6 Sol, as of September 29, 2026[3,34].Estimated optimized retail costapplies the context factor defined inAppendixBto the same token totals.CompactionsandTotal lengthare per task, given as mean / median / max;Total lengthis in K tokens and sums each sub-conversation’s final context across stretches.On SWE-bench Multilingual (Table4), the largest accuracy gains occur at4848K /3636K: 1.7 percentage points for Claude Opus 4.5 and 0.7 points for GPT 5.6 Sol. At the tightest setting (1616K /1212K), accuracy falls below the corresponding baselines by 2.0 and 1.6 percentage points, respectively.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsTotal length (K)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)66.379.311.9 / 384.1 / 3.07.4 / 66.2 / 1.6326\.5588.08326\.5588.080 / 0 / 00 / 0 / 035 / 31 / 9523 / 21 / 63Compaction,4848K /3636K68.080.012.8 / 245.5 / 2.98.8 / 65.6 / 1.9259\.2599.4487\.5629.480.4 / 0 / 30.3 / 0 / 538 / 33 / 15728 / 23 / 190Compaction,3232K /2424K67.078.714.0 / 147.0 / 2.810.0 / 49.1 / 2.3213\.50105.6457\.2326.161.1 / 1 / 81.1 / 1 / 1439 / 32 / 19233 / 27 / 312Compaction,2424K /1818K66.078.715.6 / 91.0 / 2.710.8 / 40.3 / 2.6191\.00111.3244\.5424.851.9 / 1 / 131.8 / 1 / 1841 / 31 / 23537 / 28 / 312Compaction,1616K /1212K64.377.717.0 / 65.4 / 2.712.4 / 31.5 / 3.1185\.20124.2037\.0424.842.7 / 2 / 263.4 / 2 / 4442 / 33 / 34043 / 30 / 472

Table 4:SWE-bench Multilingual.Results for Claude Opus 4.5 High and GPT 5.6 Sol Medium on 300 instances per model. Columns and quantities are as inTable3.The Terminal-Bench results inTable5show a similar pattern: compaction improves Claude Opus 4.5 at every evaluated pair of total context limit and compaction threshold. GPT 5.6 Sol improves by 1.2 percentage points at4848K /3636K and loses 1.1, 2.2, and 2.2 points at3232K /2424K,2424K /1818K, and1616K /1212K, respectively. The largest gain is 5.6 percentage points for Claude Opus 4.5 with a3232K total context limit and2424K compaction threshold.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsTotal length (K)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)47.287.63.9 / 81.6 / 1.13.6 / 30.4 / 1.187\.8048.5687\.8048.560 / 0 / 00 / 0 / 034 / 27 / 13028 / 17 / 133Compaction,4848K /3636K50.688.86.2 / 77.5 / 1.83.7 / 16.7 / 1.3114\.7547.4839\.3314.240.9 / 0 / 70.6 / 0 / 851 / 29 / 28833 / 18 / 281Compaction,3232K /2424K52.886.56.7 / 47.1 / 1.74.0 / 14.1 / 1.699\.5553.6427\.0213.411.7 / 1 / 131.4 / 0 / 1851 / 31 / 29637 / 18 / 359Compaction,2424K /1818K50.685.46.5 / 34.0 / 1.76.8 / 18.0 / 2.892\.0090.4021\.6820.342.1 / 1 / 144.0 / 2 / 2048 / 25 / 27172 / 44 / 331Compaction,1616K /1212K48.385.47.6 / 23.0 / 1.64.2 / 10.3 / 2.089\.5060.9217\.9012.183.5 / 1 / 253.8 / 2 / 2949 / 23 / 31243 / 23 / 297

Table 5:Terminal-Bench (TB-2.1).Columns and quantities are as inTable3;Accuracyis the percentage of tasks solved.As shown inTable6, on FRAMES, compaction reduces accuracy by 1.3–3.7 percentage points for Claude Opus 4.5 and 1.5–3.3 points for GPT 5.6 Sol relative to their updated baselines of 81.0% and 90.2%. At1616K /1212K, the reductions are 1.4 and 3.1 points, while estimated optimized costs fall by7.7×7.7\timesand3.8×3.8\times, respectively.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsTotal length (K)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)81.090.227.4 / 606.5 / 2.721.9 / 177.6 / 2.4507\.75206.64507\.75206.640 / 0 / 00 / 0 / 025 / 14 / 9217 / 10 / 140Compaction,4848K /3636K79.788.730.2 / 307.6 / 2.627.6 / 171.1 / 3.5369\.80248.84126\.7674.650.4 / 0 / 30.5 / 0 / 724 / 12 / 10326 / 10 / 206Compaction,3232K /2424K79.488.028.7 / 196.6 / 2.430.0 / 147.7 / 4.2301\.80263.0881\.9065.770.8 / 0 / 41.1 / 0 / 927 / 13 / 11130 / 10 / 177Compaction,2424K /1818K77.386.936.8 / 173.2 / 2.929.4 / 125.4 / 4.6343\.10259.7680\.8758.451.0 / 0 / 61.6 / 0 / 1126 / 12 / 11230 / 9 / 164Compaction,1616K /1212K79.687.139.2 / 108.2 / 3.128.9 / 105.2 / 5.7327\.60271.6865\.5254.341.6 / 1 / 92.6 / 1 / 1325 / 13 / 10431 / 11 / 137

Table 6:FRAMES.Columns and quantities are as inTable3;Accuracyis the percentage of questions answered correctly.On the 200 long-context multi-turn episodes of BFCLv3,Table7reports accuracy, token consumption, compaction frequency and accumulated total context.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsTotal length (K)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)62.039.53.6 / 18.9 / 0.31.8 / 15.0 / 0.134\.9515.2034\.9515.200.0 / 0 / 00.0 / 0 / 015.2 / 12.5 / 70.911.2 / 7.2 / 66.5Compaction,2424K /1818K64.039.04.6 / 12.6 / 0.32.2 / 9.5 / 0.236\.8016.608\.643.740.3 / 0 / 30.2 / 0 / 217.3 / 11.5 / 90.112.3 / 7.2 / 77.7Compaction,1616K /1212K61.539.04.5 / 8.9 / 0.32.0 / 8.1 / 0.234\.4515.246\.893.050.6 / 1 / 40.4 / 0 / 319.7 / 18.8 / 104.114.5 / 7.4 / 77.8Compaction,1212K /88K62.539.54.9 / 7.5 / 0.42.2 / 6.9 / 0.338\.2517.567\.653.511.1 / 1 / 50.6 / 1 / 422.2 / 18.6 / 89.615.2 / 11.5 / 84.0

Table 7:BFCLv3 (200 long-context multi-turn episodes).Columns and quantities are as inTable3;Accuracyis the percentage of episodes passed.Finally,Table8shows that compaction keeps Claude Opus 4.5 within 1.1 percentage points of its 79.3% baseline accuracy onτ2\tau^{2}-bench: accuracy is 78.2% with a1212K total context limit and88K compaction threshold, matches the baseline with1616K /1212K, and reaches 78.8% with88K /66K. GPT 5.6 Sol improves with a1212K total context limit and88K compaction threshold and remains near its baseline with the other total context limits and compaction thresholds.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)ConfigurationOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)79.373.914.5 / 0.311.4 / 0.280\.0049.6080\.0049.60Compaction,1616K /1212K79.374.515.1 / 0.315.3 / 0.283\.0065.2016\.6013.04Compaction,1212K /88K78.277.214.3 / 0.315.2 / 0.379\.0066.8015\.8013.36Compaction,88K /66K78.873.913.2 / 0.314.4 / 0.373\.5063.6014\.7012.72

Table 8:τ2\tau^{2}-bench.Columns and quantities are as inTable3.

Appendix DOpen-weight model results

We also evaluate the five quantized open-weight models described inSection2.3on SWE-bench Verified and Terminal-Bench 2.1 (Tables9and10). The compaction settings are4848K /4040K,3232K /2424K, and1616K /1212K, expressed as total context limit / compaction threshold.

Robustness to compaction varies across models. Qwen 3.6 27B and MiniMax M2.7 are comparatively robust, whereas Gemma 4 31B, Step 3.7 Flash, and especially Qwen 3 Coder Next show larger losses as the context budget tightens. Qwen 3 Coder Next catastrophically collapses on SWE-bench Verified from 53.0% to 3.6% at1616K /1212K, mostly because its verbose trajectories leave too little room for useful progress between compactions. At this tightest setting, every model loses SWE-bench accuracy relative to its baseline, although Qwen 3.6 27B and MiniMax M2.7 retain their Terminal-Bench baseline scores.

Observe that despite the gradual tightening of the compaction threshold, all models maintain their ability to complete a significant fraction of the benchmark workflows successfully. This goes on to show that even small- to medium-sized compact coding models with no explicit compaction post-training exhibit material utility while operating with shorter context window sizes.

ModelBaseline4848K /4040K3232K /2424K1616K /1212KQwen 3.6 27B68.669.468.265.0Qwen 3 Coder Next53.049.240.43.6Gemma 4 31B65.265.065.858.0Step 3.7 Flash70.066.864.656.6MiniMax M2.772.673.073.267.8

Table 9:Open-weight results on SWE-bench Verified.Scores are percentages of 500 instances resolved; patch-application failures count as unresolved.Baselineuses full-history accumulation without an agent context cap; the other columns report EoCC at the indicated total context limit / compaction threshold.ModelBaseline4848K /4040K3232K /2424K1616K /1212KQwen 3.6 27B43.848.349.443.8Qwen 3 Coder Next29.234.834.830.3Gemma 4 31B40.434.829.233.7Step 3.7 Flash41.632.634.828.1MiniMax M2.740.437.138.240.4

Table 10:Open-weight results on Terminal-Bench 2.1.Columns are as inTable9; scores are percentages of 89 tasks solved.

Appendix ESelective reading of long inputs

Our generalized adaptation ofmini-swe-agent,mini-agent, exposes long benchmark inputs as text files that the agent can inspect through a bash tool. LongBench v2 uses one document file, whereas LOONG and AA-LCR expose multiple source files. The operation ofmini-agentis straightforward. The model receives the question and file information and then chooses which text to retrieve in order to start answering the question. A succession of Bash-invoked searches then scan entire files, but only their returned matched excerpts enter the model’s context.

The basic process of a single search is to identify the entities, quantities, or claims needed for the answer, and then to read a small surrounding window to interpret the candidate evidence. Further related searches might then be used to retrieve more candidates looked up using broader sets of synonyms. Standard commands such asgrep,sed,head, andtailare the backbone of the search process. Convenience commands provide document sizes (doc-stats), file manifests (docs-list), bounded reads (doc-read), and search-term variants (doc-syn) allow for more surgical readouts from files and expanded search follow-ups.

E.1Instructions supplied to the agent.

The base system prompt gives the followingman-like tool description:

doc-read[--startCHAR][--charsN][--linesA:B]

ReadaBOUNDEDwindow(default6000chars,hard-cappedat8000).Givea

characteroffsetwindow,ora1-basedinclusivelinerange.Theheader

tellsyouthecommandtoreadthenextcontiguouswindow.Thisishowyou

readthedocumentsequentiallywithouteverexceedingyourbudget.

grep-n-i-E’<regex>’“$LONGBENCH_DOC”

Findwhereaname/number/phraseappears(with-nforlinenumbers).

Thendoc-readaroundthoselines.Thisisusuallyfarfasterthanreading

straightthrough--locatetherelevantpassages,thenreadonlythose.

...

The system prompt also makes the preference for selective reading explicit:

IMPORTANT---readonlywhatyouneed.

Keepeachreadsmall(<=~6000chars).

DoNOTtrytodumpthewholedocument.

Searchfortheentities/claimseachoptionhingeson,readthesurroundingpassages,andverify.

E.2Examples from recorded runs.

The following excerpts retain only commands and selected tool output. They are illustrative traces, not estimates of typical reading cost.

1. LongBench v2: locate a word, then read its grammatical context.In the question of the dataset’s first sample, the agent translates a Kalamang sentence using a grammar of roughly11M characters (1919K lines). It searches for a word from the sentence and uses the returned line number to select a 36-line passage.

grep\-n\-i\-E’\\bkademor\\b’"LONGBENCH_DOC“|head-20

3840:Twootherverbsewa’tospeak’andkademor’tobemad’introduceanobjecttothescenewhentheapplicativeisused.[...]

[...]

doc\-read\-\-lines3835:3870"LONGBENCH_DOC“

[lines3835:3870of18830]

[...]

Twootherverbsewa’tospeak’andkademor’tobemad’introduceanobjecttothescenewhentheapplicativeisused.[...]

menamaeciemaan=atko=ewa

otherwise3sgreturn3sg1sg=objappl=speak

’Otherwisewhenhecomesback,heismadatme.’*-0000-0000-0004-1BA3-3[conv100:15]

[...]

Through a follow-updoc-read, the agent retrieves surrounding grammar and examples, rather than relying solely on the lexical match retrieved with the earliergrep.

2. LOONG: search across papers, then verify a paper’s identity.The question of the dataset’s first sample asks for citation relationships among three supplied papers (roughly138138K characters in total). The agent searches two other papers for the target paper’s name. Later, it reads only the beginning of the matching paper to verify its title.

$grep-rn-i-E“OpenMoE“doc02.txtdoc03.txt

doc02.txt:279:FuzhaoXue,ZianZheng,YaoFu,JinjieNi,ZangweiZheng,WangchunshuZhou,andYangYou.OpenMoE:Anearlyeffortonopenmixture-of-expertslanguagemodels.arXivpreprintarXiv:2402.01739,2024.

[...interveningchecksomitted...]

$doc-readdoc02.txt--start0--chars1000

[doc02.txtchars0:1000of44964]next:doc-readdoc02.txt--start1000--chars1000

Lory:FullyDifferentiableMixture-of-ExpertsforAutoregressiveLanguageModelPre-training

[...]

This example combines agrepsearch across files with a surgical11K-character follow-up read.

3. AA-LCR: read the context needed to apply an exclusion.The question of the second sample asks for industries ranked by consumer-related infringements over three decades, explicitly excluding broadcasting. Four supplied documents contain roughly404404K characters. After narrowing the search to one report, themini-agentretrieves a short passage containing the industry names, counts, and time span.

$grep-n-i-E’consumerinfringements|consumer-related|infringementnotices|enforceableundertakings|Broadcasting’documents/doc02.txt

259:Therehavebeen12infringementnoticesandenforceableundertakingsissued

267:example,intheBroadcastingindustry,asinglefirmreceived10contraventions

[...]

[...interveningchecksomitted...]

$doc-readdocuments/doc02.txt--lines245:272;grep-n-i-E’Therehavebeen[0-9]+|only[0-9]+infringements|received[0-9]+contraventions’documents/doc02.txt

[documents/doc02.txtlines245:272of657]

[...]

Therehavebeen12infringementnoticesandenforceableundertakingsissued

over30yearsintheairlineindustry,whichisfamouslydominatedbyasmall

numberofcompanies.

Bycontrast,intheAccommodationindustry,whichislessconcentratedandhas

ahighernumberbusinesses,only4infringementswereissued.

Repeatoffencesinconcentratedindustriesareakeydriveroftheseresults.For

example,intheBroadcastingindustry,asinglefirmreceived10contraventions

overthe30yearperiod(seeFigureA11formoreinformation).

[...]

Here, a sequence ofgrepsearches anddoc-reads is executed until the key relevant passage has been identified.

Appendix FDetailed long-input results

To demonstrate2, we compare the performance of selectively-reading, compacting agents against the more straightforward benchmark baselines that involve pasting long inputs into the models’ work conversations. Following the long-input accommodations inSection2.4.2, the agents tested read only task-relevant portions of each document and use compaction when their working context reaches the compaction threshold. Compaction thresholds are reported as “total context limit / compaction threshold” in tokens.

LongBench v2 shows that selective input reading preserves baseline-level accuracy without placing the full documents in the models’ working context. InTable11, GPT 5.6 Sol improves by 1.8 percentage points and Claude Opus 4.5 remains within 0.4 points of its baseline. The1616K total context limit bounds peak live context, while compaction events remain infrequent.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)68.070.817.6 / 263.4 / 2.29.1 / 47.0 / 1.2274\.7079.20274\.7079.200 / 0 / 00 / 0 / 0Compaction,1616K /1212K67.672.620.4 / 61.4 / 2.19.6 / 49.5 / 1.6185\.2090.2037\.0418.041.4 / 1 / 90.1 / 0 / 3

Table 11:LongBench v2.Accuracyis the percentage answered correctly.Token spendlists new input / cached input / output, expressed in M tokens, aggregated over the benchmark (new inputexcludes prompt-cache hits).Compactionsare per task, given as mean / median / max.Nominal retail costuses the standard rates inTable3: per million new-input, cached-input, and output tokens, respectively, $5, $0.50, and $25 for Opus 4.5; and $4, $0.40, and $20 for GPT 5.6 Sol.Estimated optimized retail costapplies the context factor inAppendixBto the same token totals.LOONG provides the clearest realistic multi-document result in support of our answer to2: every setting inTable12improves both average score and perfect-answer rate for both models over the full-input baseline. Depending on the setting, peak live context is bounded at1616–4848K tokens. Compaction is correspondingly rare: both models have a median of zero compactions at the two larger settings, and even at1616K /1212K the medians are very low.

Accuracy (avg / perfect)Token spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)70.1 / 38.979.3 / 44.4272.0 / 0.0 / 0.3272.0 / 0.0 / 0.11367\.501090.001367\.501090.000 / 0 / 00 / 0 / 0Compaction,4848K /4040K79.8 / 52.684.6 / 53.057.6 / 232.1 / 5.223.7 / 85.1 / 6.2534\.05252.84181\.1175.850.5 / 0 / 110.2 / 0 / 10Compaction,3232K /2424K80.2 / 53.784.0 / 52.154.6 / 174.5 / 5.523.5 / 69.7 / 6.4497\.75249.88134\.1862.470.7 / 0 / 160.4 / 0 / 16Compaction,1616K /1212K79.3 / 53.482.7 / 51.955.4 / 115.2 / 6.731.1 / 61.0 / 13.7502\.10422.80100\.4284.561.4 / 1 / 462.0 / 0 / 61

Table 12:LOONG.Columns and quantities are as inTable11;*Accuracy (avg / perfect)*lists average score / perfect-answer rate.AA-LCR shows the same benefit on multi-document reasoning (Table13). At1616K /1212K, Claude Opus 4.5 reaches 84.0% accuracy versus 65.0% for the full-input baseline, while GPT 5.6 Sol reaches 83.0% versus 82.0%.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)65.082.010.4 / 0.0 / 0.09.4 / 0.0 / 0.052\.0037.6052\.0037.600.0 / 0 / 00.0 / 0 / 0Compaction,3232K /2424K80.083.02.7 / 17.2 / 0.30.9 / 3.0 / 0.329\.6010.807\.982.700.2 / 0 / 30.1 / 0 / 3Compaction,1616K /1212K84.083.02.9 / 9.0 / 0.31.1 / 3.0 / 0.326\.5011.605\.302.320.5 / 0 / 60.3 / 0 / 3

Table 13:AA-LCR.Columns and quantities are as inTable11.On NIAH, selective input reading raises both models to 100% accuracy (Table14). The agents find the relevant evidence so directly that neither model performs a single compaction. We attribute the stark success on this benchmark to existence of some more straightforward lexical overlap between the needles (and their known common synonyms) and the questions that are used to search for the needles. Here we take the opportunity to also note that the entire concept of needle-in-a-haystack benchmarks is based on the premise that there is such a thing as a long-context task. Starting from that premise, needle-in-a-haystack benchmarks are proposed as a proxy to evaluate model abilities to retrieve from such context as a part of operations the model under evaluation might have to perform in order to deal with the supposedly existing class of long-context tasks. Again, we highlight that we have found no evidence of existence of inherently long-context tasks and have so far been able to address all tasks that have previously been producing long contexts by the simple means of selective input reading and compaction.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)60.080.014.8 / 0.0 / 0.013.5 / 0.0 / 0.174\.0056.0074\.0056.000 / 0 / 00 / 0 / 0Compaction,4848K /3636K100.0100.00.8 / 0.0 / 0.00.2 / 0.0 / 0.04\.000.801\.360.240 / 0 / 00 / 0 / 0

Table 14:NIAH.Columns and quantities are as inTable11. The agent selectively reads from a filesystem, while the baseline processes the whole document.RULER further firmly supports our findings: mean recall rises from 62.5% to 95.7% for Claude Opus 4.5 and from 65.5% to 96.4% for GPT 5.6 Sol (Table15). Peak live context is bounded by a1616K total context limit. The median number of compactions is zero for both models, showing that selective input reading usually solves the tasks before any compactions are needed.

Accuracy (recall / exact)Token spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)62.5 / 51.365.5 / 54.9175.5 / 0.0 / 0.1176.9 / 0.0 / 0.9880\.00725.60880\.00725.600 / 0 / 00 / 0 / 0Compaction,1616K /1212K95.7 / 94.496.4 / 95.414.8 / 17.7 / 0.87.5 / 12.7 / 0.5102\.8545.0820\.579.020.0 / 0 / 70.0 / 0 / 2

Table 15:RULER.Columns and quantities are as inTable11;*Accuracy (recall / exact)*lists mean recall / exact-match rate.On Counting-Stars, selective input reading reaches a 99.7% mean score and 81.2% exact match for both models, improving the exact-match rate from 65.1% for Claude Opus 4.5 and 76.6% for GPT 5.6 Sol (Table16). Neither model performs any compaction, so the result comes entirely from reading only the relevant input portions.

Accuracy (mean / exact)Token spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)98.5 / 65.199.3 / 76.69.5 / 0.0 / 0.39.5 / 0.0 / 0.355\.0044.0055\.0044.000 / 0 / 00 / 0 / 0Compaction,1616K /1212K99.7 / 81.299.7 / 81.21.6 / 0.2 / 0.10.8 / 0.5 / 0.110\.605.402\.121.080 / 0 / 00 / 0 / 0

Table 16:Counting-Stars.Columns and quantities are as inTable11;*Accuracy (mean / exact)*lists mean score / exact-match rate.BABILong combines selective input reading with a large accuracy gain (Table17), where accuracy improves by 24.9 percentage points for Claude Opus 4.5 and 23.3 points for GPT 5.6 Sol. Peak live context is bounded at1616K tokens. GPT 5.6 Sol never compacts, and Claude Opus 4.5 performs at most one compaction per task, once again showing that selective input reading does nearly all of the context reduction.

AccuracyToken spend (M)Nominal retailcost (USD)Estimated optimizedretail cost (USD)CompactionsConfigurationOpusGPTOpusGPTOpusGPTOpusGPTOpusGPTBaseline (no compaction)67.170.772.1 / 0.0 / 0.069.4 / 0.0 / 0.3360\.50283.60360\.50283.600 / 0 / 00 / 0 / 0Compaction,1616K /1212K92.094.08.3 / 6.4 / 0.52.3 / 2.3 / 0.357\.2016.1211\.443.220.0 / 0 / 10 / 0 / 0

Table 17:BABILong.Columns and quantities are as inTable11.

Appendix GAgent outlines

The templates below give outlines of the structure of compaction prompts inmini-swe-agentandmini-agentused in this work.

G.1mini-swe-agent

We use the releasedmini-swe-agentharness[41]v2.4, with negligible changes for environment integration and context management. The underlying task-solving loop is fully retained.

To compact its earlier work, we use the following prompt passed as a user message once the compaction threshold is met.

Compaction prompt

Stopwork.Writeonlyaconcisehandoffrecap;donotruncommandsorcalltools.

Theconversationwillresettothesystemprompt,task,andthisrecap.

{persistence}

Record:

1.Objective-onelinedescribingtherequiredresult.

2.Establishedfacts-exactpaths,relevantsymbolsorcommands,observedvalues,

andimportanterrors/output.Separateobservationsfromunverifiedideas.

3.Appliedchanges-eachchanged/createdfile,whatchanged,andwhetherverified.

4.Verification-exactchecksrun,outcomes,failures,obstacles,andworkarounds.

5.Deadends-failedapproachesthatshouldnotberepeated.

6.Remainingplan-outstandingsubgoals,inexecutionorder;theimmediatenext

commandoredit;andtheconditionforcompletion.

{handoff_details}

Ifneededoutputwastruncated,giveanarrowcommandtoretrieveit.

{submission_reminder}

G.2mini-agent

As described inSection2, we generalize the base releasedmini-swe-agentharness into amini-agentharness by removing SWE-specific instructions and adding instructions enabling additional classes of agentic workflows.

System prompt

Yousolvethesuppliedtaskbyinteractingwithacomputerthroughbash.

Workstepbystep:inspectrelevantevidence,act,observetheresult,andverify

thatitmeetsthetask’srequirements.Keepcommandoutputfocused.

{command_rules}

{context_instructions}

User prompt

<task>

{task}

</task>

{input_details}

Availabletools:

{tools}

Howtowork:

{work_instructions}

Submission:

{submission_instructions}

{recap_section}

Compaction prompt

Stopwork.Writeonlyaconcisehandoffrecap;donotcalltools.

Theconversationwillreset,andthesystemprompt,task,andrecapwillbe

providedagain.{persistence}

Preservewhatyournextstretchneeds:

1.Currentprogressandbestanswer/result,separatingverifiedfactsfromassumptions.

2.Relevantevidencewithexactvaluesandsourcelocations;changesalreadymade,

ifany,withpathsandverificationstatus.

3.Whatwassolved,whatworked,whatremainsunresolved,whatfailed,andusefulcommandsalreadytried.

4.Remainingplan-outstandingsubgoals,inexecutionorder;theimmediatenext

commandoredit;andtheconditionforcompletion.

{handoff_details}

Ifimportantoutputwastruncated,nameanarrowcommandtoretrievethemissing

part.Donotinventobservationsorrepeatthefulltaskordocumentmanifest.

{submission_reminder}

VariableDescriptiontaskSupplied question or task, including answer options and output requirements.input_detailsSource filenames, document manifest, sizes, working directory, and other instance metadata.toolsAvailable commands, arguments, and limits on retrieved text.work_instructionsEvidence-gathering procedure, calculations, verification requirements, and permitted changes.command_rulesNumber of Bash calls required on work turns and shell execution behavior.submission_instructionsExact completion command and required answer or artifact format.context_instructionsInstructions for resuming execution from the compacted state and producing the next compaction before starting a fresh conversation; empty without compaction.recap_sectionInstructions for continuing execution, followed by the compacted state from the preceding conversation; empty without compaction.recapCompacted state inserted intorecap_sectionfor the next conversation; initially a brief statement that no prior work exists.persistenceWhich files and environment state remain available across conversations, and which information must be preserved in the compacted state.handoff_detailsAdditional instructions specifying evidence, input coverage, calculations, or implementation state to preserve in the compaction.submission_reminderChecks required before task completion and the completion protocol to preserve in the compacted state.

相似文章

@vintcessun: 其实大模型上下文窗口越做越大,但成本也跟着飞涨。这篇论文干脆把上下文管理当成了部署优化问题来解,搞了个统一框架叫 Efficiency Frontier。 说白了,他们不再单独看性能或成本,而是联合建模任务表现、token 开销和预处理复…

X AI KOLs Timeline

这篇论文提出了一个名为 Efficiency Frontier 的统一框架,将大模型上下文管理视为部署优化问题,联合建模任务表现、token 开销和预处理复用。在 5000 个 HotpotQA 实例上,部署优化可节省 25% 的 token 量,而记忆压缩在高精度场景下比全上下文便宜一半以上。

@rickawsb: 英伟达也认为存储是比gpu更大的瓶颈 — nvda最新文章解读 NVIDIA 最新发布的《AI Model Co-Design》是一篇介绍 TensorRT-LLM 和 Blackwell 的技术文章, 但也是一份未来几年大模型设计和 A…

X AI KOLs Following

本文深入解读NVIDIA最新发布的《AI Model Co-Design》文章,指出在AI推理场景中,存储(内存带宽、权重读取)已取代GPU算力成为主要瓶颈,并阐述了TensorRT-LLM和Blackwell架构围绕Roofline模型的设计策略,强调减少数据移动比提升计算能力更为关键。

长上下文草拟无需长上下文草拟模型

arXiv cs.LG

该论文论证冻结的短上下文草稿模型无需重新训练即可用于超长上下文的推测解码,通过限制注意力缓存和重置旋转位置编码两种推理时机制,使其速度优势在长达两百万 token 的上下文中保持稳定。