StateComp: 学习在长时程智能体中何时压缩历史记录
摘要
StateComp是一个根据当前状态压缩长时程智能体历史交互的框架,可将令牌使用量减少52.27%,并在保持任务性能的同时,使表示提取速度提升12.67倍。
查看缓存全文
缓存时间: 2026/09/24 09:22
# StateComp: Learning When to Compress History in Long Horizon Agents
Source: [https://arxiv.org/html/2609.27298](https://arxiv.org/html/2609.27298)
Hongyue ChenAffiliation:TierFlow TeamYinglong GuoAffiliation:TierFlow TeamFei LuoAffiliation:TierFlow TeamChao NingAffiliation:TierFlow TeamBo WangAffiliation:TierFlow TeamGuorun YaoAffiliation:TierFlow TeamYanbiao MaAffiliation:Gaoling School of Artificial Intelligence, Renmin University of ChinaJungong HanAffiliation:Tsinghua University\*Corresponding authors\.
###### Abstract
Long\-horizon agents continuously accumulate interaction history during task execution, yet the importance of past interactions changes as the agent state evolves\. Existing context management methods largely compress history based on fixed windows, periodic schedules, or current relevance, overlooking a more fundamental question: when has a past interaction become safe to replace? Premature compression may remove information still needed for future actions, while overly conservative retention leads to substantial context overhead\. To address this, we proposeState Conditioned Compression \(StateComp\), a framework that determines when historical interactions can be safely compressed according to the current agent state\.StateCompconstructs KEEP and READY supervision through a two\-stage annotation procedure and trains an imbalance\-aware router on hidden representations from a frozen language model\. A bounded state representation further reduces the cost of evaluating long histories, while adjacent READY interactions are grouped into continuous spans and replaced with compact summaries during execution\. Experiments on WorkBuddyBench show thatStateCompreduces total agent and summarization tokens by52\.27%52\.27\\%while maintaining task performance, and achieves a12\.67×12\.67\\timesspeedup in representation extraction\.
## 1 Introduction
Long horizon agents continuously accumulate task instructions, intermediate reasoning, tool calls, environment observations, and unsuccessful attempts throughout execution[1](https://arxiv.org/html/2609.27298#bib.bib1),[2](https://arxiv.org/html/2609.27298#bib.bib2),[3](https://arxiv.org/html/2609.27298#bib.bib3),[4](https://arxiv.org/html/2609.27298#bib.bib4)\. As the trajectory grows, each new step may require the model to process an increasingly long interaction history[5](https://arxiv.org/html/2609.27298#bib.bib5),[6](https://arxiv.org/html/2609.27298#bib.bib6),[7](https://arxiv.org/html/2609.27298#bib.bib7), resulting in substantial token and inference costs[8](https://arxiv.org/html/2609.27298#bib.bib8),[9](https://arxiv.org/html/2609.27298#bib.bib9),[10](https://arxiv.org/html/2609.27298#bib.bib10)\. However, not every past interaction needs to remain in its original form throughout the entire task\. Some interactions continue to determine future actions[11](https://arxiv.org/html/2609.27298#bib.bib11),[12](https://arxiv.org/html/2609.27298#bib.bib12), while others have already served their purpose and their essential information has been absorbed by later observations or conclusions\. The central challenge is therefore not simply how to compress a long prompt, but rather which past interactions have become obsolete at the current agent state and can now be safely compressed during execution\.
This decision is inherently state dependent\. The same historical interaction may have very different retention requirements at different stages of execution\. For example, an error trace can be indispensable while the agent is diagnosing a failure, but its complete details may no longer be necessary once the cause has been identified and the relevant conclusion has been recorded\. In contrast, an early task constraint may remain important until the end of the trajectory\. Compression opportunities are therefore distributed nonuniformly throughout agent history and cannot be determined reliably from age, position, or a fixed context window alone\. At each current state, the agent must reconsider which earlier interactions still require their complete details and which have already become replaceable\.
This problem is also strongly asymmetric\. In our supervision data, most historical interaction and state pairs remain KEEP, while only a small fraction are labeled READY\. Keeping an interaction that could already be compressed mainly incurs additional context cost\. Compressing an interaction that is still needed, however, may permanently remove information required by subsequent actions\. This distinction is particularly important in our setting because removed raw interactions are not recovered through external retrieval\. We therefore construct compression supervision with a two stage annotation procedure and train the router with an imbalance aware objective, favoring precise identification of truly compressible history over aggressive compression coverage\.
Motivated by these observations, we introduceState Conditioned Compression \(StateComp\), a framework that determines when historical interactions can be safely compressed according to the current agent state during long\-horizon execution\. The key idea is to use the current agent state to repeatedly reassess previous interactions and to separate the prediction that some history has become compressible from the decision to execute an actual compression operation\. The main contributions of this work are as follows:
- •State dependent compression supervision\.We formulate history compression as a joint decision over a past interaction and the current agent state, and construct KEEP and READY supervision through a two stage annotation procedure that identifies supported compression boundaries\.
- •Dynamic compression routing from hidden states\.We train an imbalance aware router on hidden representations from a frozen language model to predict whether each historical interaction can be safely compressed during online inference\. A bounded state representation further reduces representation extraction cost\.
- •Stateful online compression execution\.We group adjacent READY interactions into continuous spans and summarize only sufficiently large candidates\. Committed summaries directly replace the corresponding raw history and become part of the effective context for subsequent agent actions and routing decisions throughout later execution\.
We evaluateStateCompon WorkBuddyBench[13](https://arxiv.org/html/2609.27298#bib.bib13)\. Across the full set of 260 tasks, total agent and summarization tokens decrease from 698\.17M to 333\.24M, a reduction of52\.27%52\.27\\%, while mean reward changes from0\.69870\.6987to0\.70260\.7026\. Additional experiments on Eval40, representation efficiency, and multiple acting models further examine the quality and context cost tradeoff ofStateCompacross different agent settings\.
## 2 Related Work
### 2\.1 Prompt Compression
LLMLingua\-2 formulates extractive prompt compression as token classification[14](https://arxiv.org/html/2609.27298#bib.bib14)\. This provides a way to shorten an input while retaining selected information[8](https://arxiv.org/html/2609.27298#bib.bib8),[9](https://arxiv.org/html/2609.27298#bib.bib9),[10](https://arxiv.org/html/2609.27298#bib.bib10),[15](https://arxiv.org/html/2609.27298#bib.bib15),[16](https://arxiv.org/html/2609.27298#bib.bib16)\. In an agent setting, prompt compression and compression timing address different parts of history management[17](https://arxiv.org/html/2609.27298#bib.bib17),[18](https://arxiv.org/html/2609.27298#bib.bib18),[19](https://arxiv.org/html/2609.27298#bib.bib19),[20](https://arxiv.org/html/2609.27298#bib.bib20)\. A representation of what should remain in a shortened input does not, by itself, specify the point in task execution at which the original details can be replaced\.StateCompfocuses on this temporal decision at the level of complete interactions\. Its router selects the history that is ready for compression, while a separate summarizer constructs the content that remains\. The selection target is defined jointly by a historical interaction and the current state rather than by the interaction alone\.
### 2\.2 Context Management for Long Horizon Agents
SelfCompact gives agents a compaction tool and guidance on when to use it, while ACON studies context compression for long horizon execution[21](https://arxiv.org/html/2609.27298#bib.bib21),[22](https://arxiv.org/html/2609.27298#bib.bib22)\. Self\-GC, LRE, CoMem, and SAM explore complementary approaches to context management and memory[23](https://arxiv.org/html/2609.27298#bib.bib23),[24](https://arxiv.org/html/2609.27298#bib.bib24),[25](https://arxiv.org/html/2609.27298#bib.bib25),[26](https://arxiv.org/html/2609.27298#bib.bib26),[27](https://arxiv.org/html/2609.27298#bib.bib27),[28](https://arxiv.org/html/2609.27298#bib.bib28),[29](https://arxiv.org/html/2609.27298#bib.bib29),[30](https://arxiv.org/html/2609.27298#bib.bib30),[31](https://arxiv.org/html/2609.27298#bib.bib31),[32](https://arxiv.org/html/2609.27298#bib.bib32),[33](https://arxiv.org/html/2609.27298#bib.bib33)\. These works place context management within the continuing execution of an agent rather than treating history only as a fixed input\.StateCompuses a separate router trained on supported compression boundaries\. Its prediction and execution decisions are distinct: a positive router prediction can contribute to a candidate span without immediately triggering summarization\. Once a summary is committed, later actions and routing use the updated effective history\. This makes the timing of replacement, the size of the selected region, and the information retained by the summary separate parts of the compression procedure\.
### 2\.3 Adaptive Selection of Historical Information
SWE\-Pruner selects useful context for coding agents, and PACE adapts historical context using next step relevance[34](https://arxiv.org/html/2609.27298#bib.bib34),[35](https://arxiv.org/html/2609.27298#bib.bib35)\. Sculptor equips agents with active context management tools, while ACM also studies context management over long horizon tasks[36](https://arxiv.org/html/2609.27298#bib.bib36),[37](https://arxiv.org/html/2609.27298#bib.bib37)\. These approaches are related to selecting information for ongoing decisions\. The target inStateCompis specifically whether an interaction still needs to remain in its original form at the current checkpoint\. The annotation checks evidence already available in the prefix and uses future dependencies only to reject unsafe candidates\. Selected raw spans are replaced by summaries that remain in the effective history\. The online controller does not subsequently retrieve the removed originals, so both the decision to compress and the content of each replacement matter to later execution\. This distinction separates replaceability from conventional relevance selection: an interaction may remain related to the current task while no longer requiring its original high\-detail representation during subsequent execution\.
## 3 Supervision for State Dependent Compression
A past interaction does not become unnecessary simply because it is old\. For example, an error trace may determine the next debugging action, but its full details may become replaceable once the failure has been diagnosed and the relevant conclusion has been recorded\. We define compression with respect to the information available at the current agent state\.
### 3\.1 Compression Depends on the Current State
We use a complete interaction as the basic unit,Si=\(Ri,Ai,Oi\)S\_\{i\}=\(R\_\{i\},A\_\{i\},O\_\{i\}\), containing reasoning, the assistant action, and its observation\. Compression respects complete interaction boundaries so that tool calls and their responses remain paired\. Before interactionkk, the completed history isPk=\(S1,…,Sk−1\)P\_\{k\}=\(S\_\{1\},\\ldots,S\_\{k\-1\}\)\. Fori<ki<k, the labelyi,k=0y\_\{i,k\}=0means thatSiS\_\{i\}should remain in full, whereasyi,k=1y\_\{i,k\}=1means that its original details can be replaced by an accurate summary at that state\. Importantly, this label is not an intrinsic property ofSiS\_\{i\}alone: the same interaction may transition from KEEP to READY as later observations resolve uncertainty, establish conclusions, or make its original details redundant\.
The label is a property of the interaction and the current state together\. Two interactions at similar positions can have different retention needs\. An early task constraint may remain necessary throughout execution, while an intermediate search result may be superseded by a confirmed finding\. The annotation therefore checks whether necessary information would remain available after removing the original details, rather than using age as a proxy for relevance\.
### 3\.2 The Earliest Safe Compression Point
For eachSiS\_\{i\}, we identify the earliest checkpointti∗t\_\{i\}^\{\*\}from which its full details are judged unnecessary along the annotated continuation\. The resulting labels are
yi,k=\{0,k<ti∗,1,k≥ti∗\.y\_\{i,k\}=\\begin\{cases\}0,&k<t\_\{i\}^\{\*\},\\\\ 1,&k\\geq t\_\{i\}^\{\*\}\.\\end\{cases\}\(1\)If no supported point is found, we setti∗=∞t\_\{i\}^\{\*\}=\\inftyand retain the interaction throughout the trajectory\. This boundary summarizes the annotation for an observed trajectory; it is not a guarantee for every possible future continuation\. Using the earliest supported boundary also avoids treating eventual compressibility as evidence that an interaction could have been removed earlier in the trajectory\.
This formulation treats compression as a state\-dependent transition rather than a static importance judgment\. An interaction becomes compressible only when the current prefix provides sufficient evidence to replace its raw form\.
A positive decision requires that information still needed later is already available elsewhere in the retained history, or that the original detail is no longer needed\. The final dataset contains 244,526 interaction and state pairs, of which 15,633 are positive\. In total, 1,832 historical interactions receive a supported compression point\. Complete statistics appear in Appendix[A](https://arxiv.org/html/2609.27298#A1)\.
### 3\.3 Two Stage Annotation with Supporting Evidence
Direct annotation from a complete trajectory can confuse eventual resolution with information already available at an earlier checkpoint\. We therefore require positive evidence to come fromPkP\_\{k\}\. Future interactions may reveal that deletingSiS\_\{i\}would remove a detail needed later, but future success or a later summary cannot establish that an earlier deletion was safe\.
Stage 1 independently annotates each checkpoint\. It records task progress, observation complexity, expected next subtask requirements, the remaining utility of the target interaction, and any supporting evidence already present in the prefix\. Each record includes a reason, evidence locations, an initial KEEP or READY judgment, and any future dependency that vetoes a positive judgment\. Decisions at one checkpoint are not inherited by another\.
Stage 2 uses these Stage 1 records as its input\. For a fixed historical interaction, it reviews the initial decisions across checkpoints together with the original evidence, checks proposed compression points again, and finds the earliest supported boundary\. This separates local evidence collection from final boundary determination\. It also exposes inconsistent initial judgments instead of propagating the first READY label through all later states\. Unresolved cases remain KEEP\. This decomposition is intended to make positive labels depend on explicit state\-local evidence rather than on a single holistic judgment over the full trajectory\.
The procedure treats the two errors differently\. Retaining a replaceable interaction mainly increases context cost\. Removing information that remains necessary can harm subsequent actions, especially when raw history cannot be retrieved later\. We therefore require stronger evidence for a positive label and favor precision when selecting a router operating point\.
## 4 StateComp Methodology
StateCompuses the current state to reconsider which historical interactions must remain in full\. It makes predictions at interaction granularity, summarizes eligible continuous spans, and updates the history used by later actions\. A central design choice is to separate readiness prediction from compression execution: identifying a replaceable interaction does not by itself imply that an immediate rewrite is worthwhile\. This separation allows the controller to accumulate local compression opportunities before committing a larger rewrite, reducing unnecessary summary calls and avoiding fragmented updates to the active history\. Figure[1](https://arxiv.org/html/2609.27298#S4.F1)connects labeling, router training, and online compression throughout the subsequent task execution\.
Figure 1:Overview ofStateComp\.Structured annotations and a second boundary review produce supervision\. A router learns from hidden states of a frozen representation model\. Online predictions are combined with span length and token gates before summaries replace raw interactions\. Historical and current state features are used jointly, as described in Section[4\.1](https://arxiv.org/html/2609.27298#S4.SS1)\.### 4\.1 Hidden\-State Representations and Router Training
The online agent cannot access future interactions or the annotated boundary\. We instead read representations from a frozen language model\. In the full context reference, one forward pass overPkP\_\{k\}provides a hidden vectorhih\_\{i\}at the final token of each historical interaction and a current state vectorqkq\_\{k\}at the final prompt position\. The router uses the historical vector together with the current state to predictyi,ky\_\{i,k\}at each checkpoint\.
This formulation does not require an earlier token to attend to later tokens\. With a causal attention mask, appending new interactions does not by itself change an earlier hidden vector\. State dependence is supplied byqkq\_\{k\}and its combination with the target interaction, or by a separately constructed input that contains both the target and current context\. Thus, the same historical interaction can receive different router scores as the current state changes\. Section[4](https://arxiv.org/html/2609.27298#S4)describes the bounded implementation used to reduce representation extraction cost\.
Full context extraction is a useful reference but becomes expensive as history grows[38](https://arxiv.org/html/2609.27298#bib.bib38),[39](https://arxiv.org/html/2609.27298#bib.bib39),[40](https://arxiv.org/html/2609.27298#bib.bib40),[41](https://arxiv.org/html/2609.27298#bib.bib41),[42](https://arxiv.org/html/2609.27298#bib.bib42)\. The recorded trajectories include inputs of approximately 128K tokens and a largest input of 203,675 tokens\. Repeatedly processing these histories can make the representation model itself a substantial source of overhead[43](https://arxiv.org/html/2609.27298#bib.bib43),[44](https://arxiv.org/html/2609.27298#bib.bib44),[45](https://arxiv.org/html/2609.27298#bib.bib45),[46](https://arxiv.org/html/2609.27298#bib.bib46)\.
The practical construction uses a separate bounded view for each historical interaction under evaluation\. It combines the target interaction with the current state and a limited amount of effective history\. The frozen model reads this view, and the final prompt position supplies a compact readout for the decision\. Every still present raw interaction remains eligible for assessment\. Bounded input construction changes the context used to compute the features, not the range of historical interactions considered by the router\. Thus, bounding the representation cost does not impose a recency\-based restriction on which surviving historical interactions may be reconsidered\.
The representation budget is at most5,1205\{,\}120tokens per view\. Recent4 is the reference recent context construction in the reported bounded ablation\. We distinguish its context windowKKfrom the compression span thresholdκ\\kappabelow\. WithNNhistorical targets, candidate specific construction involvesNNshort input sequences, which may be batched\. The per\-view token bound does not make the complete checkpoint cost independent ofNN\.
For each remaining historical interaction, the router combines the target representation, current state, and available historical features to produce a scorepi,kp\_\{i,k\}\. Features come only from the effective prefix\. Aggregating historical vectors within that prefix is a prediction operation and does not restore previously removed raw content\. The router is trained on the labels from Section[3](https://arxiv.org/html/2609.27298#S3)with the representation model frozen throughout all training\. Training variants and the grouped selection protocol are documented in Appendix[B](https://arxiv.org/html/2609.27298#A2)\.
### 4\.2 Interaction Routing and Span Execution Gates
A score at or aboveτ\\tauselects an interaction as a compression candidate\. The controller then merges adjacent selected interactions into continuous spans\. A KEEP interaction breaks a span; it is not included merely to connect two selected regions\. A positive router decision does not immediately trigger a summary call\. For a candidate spanB=\[s,e\]B=\[s,e\], the execution rule is
mini∈Bpi,k≥τ,\|B\|\>κ,Tokens\(B\)≥Bmin,\\min\_\{i\\in B\}p\_\{i,k\}\\geq\\tau,\\qquad\|B\|\>\\kappa,\\qquad\\operatorname\{Tokens\}\(B\)\\geq B\_\{\\min\},\(2\)withτ=0\.60\\tau=0\.60,κ=3\\kappa=3, andBmin=1,000B\_\{\\min\}=1\{,\}000\. Thus, an eligible span contains at least four complete interactions and at least 1,000 source tokens\. The token condition refers to the source length, not a guaranteed number of saved tokens\.
These gates address the cost of executing compression\. The score threshold controls prediction confidence, while the span\-length and source\-token conditions control whether a predicted opportunity is large enough to justify an actual summarization operation\. Summarizing tiny fragments can spend more tokens on the auxiliary call than it saves in the active history\. Combining adjacent interactions also gives the summarizer a more coherent source and avoids a succession of fragmented replacements\. The execution gates therefore convert local readiness predictions into larger operational decisions, separating semantic replaceability from the economic cost of performing a rewrite\. Importantly, rewriting earlier history can invalidate KV reuse from the first changed position onward\. Prefix caching depends on an unchanged prefix\. Deferring small rewrites is intended to reduce repeated cache invalidation and reconstruction\. It does not preserve the KV states of the rewritten suffix or guarantee a higher cache hit rate without measurement\.
Each eligible span produces one summary containing facts, constraints, locations, confirmed conclusions, failure causes, and unresolved items that remain useful\. The router determines which original details may leave the active context; the summarizer determines what the replacement retains\. The controller commits a replacement only when it preserves interaction structure and actually shortens the effective history\. Otherwise, it keeps the original span\. Appendix[E](https://arxiv.org/html/2609.27298#A5)specifies this procedure\.
### 4\.3 Updating the Effective Agent History
After a summary replaces a raw span, the resulting effective history becomes the context used for the next agent action\. Later state features and router predictions are computed from this updated history rather than from an untouched copy of the original trajectory\. Remaining interactions are therefore reconsidered at every checkpoint under the newly formed agent state\. Compression is therefore a closed\-loop process: each committed replacement changes the context on which subsequent routing decisions are made throughout later execution\.
Figure[2](https://arxiv.org/html/2609.27298#S4.F2)illustrates this process on one trajectory\. Early checkpoints retain most of the original history\. As execution proceeds, additional continuous regions become eligible for compression and are replaced, while interactions that still require their original details remain in the active history\.
Figure 2:Compression dynamics across checkpoints in an example trajectory\.This stateful update is important because a compression action changes the context available to all subsequent decisions\. A previously selected interaction is therefore not treated as a permanent authorization for future compression\. Instead, the router scores the remaining history again from the current effective state\.
The system retains the original trajectory separately for auditing, but this canonical record is not used as an external retrieval store by the online controller\. The effective history contains only retained raw interactions and committed summaries\. If routing or final validation fails, the controller returns the previous valid effective history\. A failed summarization proposal leaves its source span unchanged\.
## 5 Experiments
We evaluate task reward and model token consumption on complete agent tasks\. The full benchmark measures the overall effect, the fixed Eval40 comparison examines alternative context strategies, and cross\-model runs characterize how the quality and token tradeoff changes with the acting model\.
### 5\.1 Experimental Setup
We first examine how labeled compression opportunities evolve, then evaluate prediction on held out trajectories\. The strict router study uses frozen Qwen2\.5\-7B representations and five grouped folds\. Each rotation has 200 training, 50 validation, and 50 test trajectories\. All pairs from one trajectory stay in the same split\. Configuration and threshold selection use training and validation data rather than test labels in every fold\.
WorkBuddyBench contains 260 tasks: 80 Code, 50 Office, 60 Security, and 70 Web[13](https://arxiv.org/html/2609.27298#bib.bib13)\. The full comparison uses DeepSeek\-V4\-Flash[47](https://arxiv.org/html/2609.27298#bib.bib47)on the same 260 tasks\. Eval40 contains ten fixed tasks from each domain\. All method and cross\-model comparisons on Eval40 use this same 40\-task set\. We report mean reward multiplied by 100 in tables, with unscaled reward in the text\. Total tokens include recorded agent and summary input and output tokens\. Cached input and reasoning output are subsets of those totals and are not added again\. Local representation cost is reported separately in Table[1](https://arxiv.org/html/2609.27298#S5.T1)\.
The Full260 and Eval40 evaluations use the compression rule in Section[4\.2](https://arxiv.org/html/2609.27298#S4.SS2), withτ=0\.60\\tau=0\.60,κ=3\\kappa=3, andBmin=1,000B\_\{\\min\}=1\{,\}000tokens\. The additional published baselines use the same Eval40 token accounting\. Operating settings and the fixed Eval40 task identifiers are provided in Appendix[G](https://arxiv.org/html/2609.27298#A7)\.
Table 1:Efficiency and quality of bounded state representations\.Max\. tokens reports the largest recorded input; runtime and memory are measured on the same seven paired states\.MethodMax\. tokensWall clock \(s\)Peak GPU \(GiB\)Workspace \(GiB\)Test F1Full history203,67576\.4029\.42611\.8670\.7000Bounded5,120\(\-97\.49%\)6\.03\(12\.67×\\times\)18\.620\(\-36\.72%\)1\.062\(\-91\.05%\)0\.7818\(\+0\.08\)
### 5\.2 Hidden\-State Prediction and Representation Efficiency
Figure[3](https://arxiv.org/html/2609.27298#S5.F3)shows that compression opportunities emerge progressively during task execution\. Across all four domains, only a small fraction of past interactions are labeled READY near the beginning of a trajectory, while the fraction generally increases as execution proceeds\. This pattern indicates that historical interactions do not have a fixed retention requirement\. Instead, their compression status changes as the agent accumulates new evidence and completes intermediate subtasks\.
Figure 3:Compression opportunities over different trajectory stages\.The trend motivates state conditioned selection rather than compression based only on age or a fixed context window\. At the same time, the four domains follow different trajectories, suggesting that task progress alone is not a sufficient decision rule in practice\. This variation further supports conditioning on the observed agent state rather than applying a globally shared compression schedule across tasks\. The router therefore conditions each compression decision on the current agent state and the target historical interaction\. Additional analyses of compression delay, trajectory variation, and trajectory length are reported in Appendix[D](https://arxiv.org/html/2609.27298#A4)\.
We next test whether these state dependent compression decisions can be predicted from hidden representations\. Under grouped cross trajectory evaluation, a representative configuration obtains AUROC0\.70960\.7096and PR AUC0\.17360\.1736\. The result indicates that frozen hidden states contain predictive information about whether the full details of a historical interaction should still be retained\. The signal is therefore informative but not sufficient for unrestricted compression, motivating the conservative operating policy used in the online controller\.
Figure 4:Router score distributions\.The prediction problem is intentionally asymmetric\. Retaining an interaction that could already be compressed mainly increases context cost, whereas compressing an interaction too early can remove information needed by later actions\. We therefore use a precision oriented operating policy\. A highly selective configuration reaches72\.22%72\.22\\%external precision at0\.11%0\.11\\%recall\. Full precision coverage curves, calibration results, and threshold diagnostics are provided in Appendix[D](https://arxiv.org/html/2609.27298#A4)\.
Figure[4](https://arxiv.org/html/2609.27298#S5.F4)shows the learned score distributions for KEEP\_FULL and READY examples\. This is a visualization of the trained readout; the grouped evaluation above reports predictive performance\.
Table[1](https://arxiv.org/html/2609.27298#S5.T1)separates recorded context sizes from paired runtime measurements\. On seven states for which both implementations complete, total extraction time falls from 76\.40 to 6\.03 seconds\. Peak GPU memory decreases by36\.72%36\.72\\%and forward workspace by91\.05%91\.05\\%\. The largest full inputs do not complete in this microbenchmark and are not used as timed paired samples\. In the separate representation comparison, the best reported bounded configuration has F10\.78180\.7818, compared with0\.70000\.7000for the full context reference\. Thus, the measured efficiency gain is not accompanied by lower prediction quality in this comparison, although the bounded and full representations should not be interpreted as information\-equivalent\. Detailed configurations and measurements are in Appendix[C](https://arxiv.org/html/2609.27298#A3)\. Taken together, these results show that compression readiness is both state varying and partially predictable from compact representations, providing the basis for practical online routing\.
### 5\.3 Task Performance and Context Cost
Table[2](https://arxiv.org/html/2609.27298#S5.T2)reports the complete comparison\. Mean reward changes from0\.69870\.6987to0\.70260\.7026, while total agent and summary tokens fall from 698\.17M to 333\.24M, a reduction of52\.27%52\.27\\%\. Average tokens per task therefore fall from approximately 2\.69M to 1\.28M\. The observed result is a large reduction in transmitted and generated tokens with a small positive change in average task reward\. The main empirical benefit in this setting is therefore efficiency rather than a claim of systematic reward improvement: the method removes substantial context while keeping aggregate task quality close to the uncompressed execution\.
Token reductions occur in all four domains, ranging from38\.89%38\.89\\%in Code to55\.75%55\.75\\%in Office\. Code, Office, and Web have slightly higher reward, while Security changes from0\.47760\.4776to0\.47310\.4731\. These results show consistent token reductions across domains, with small domain\-dependent changes in task reward\. Detailed token components are provided in Appendix[F](https://arxiv.org/html/2609.27298#A6)\. The consistent token reductions across domains indicate that the observed efficiency gain is not concentrated in a single task category in this evaluation\.
Table 2:Full WorkBuddyBench comparison on 260 tasks\.Scores are mean reward multiplied by 100\. Tokens include the main agent and summary calls\. Colored changes show score differences relative to the baseline for all domains\.MethodCodeOfficeSec\.WebAvg\.Tokens \(M\)Baseline76\.9981\.8447\.7672\.1469\.87698\.17StateComp77\.12↑\\uparrow0\.1382\.77↑\\uparrow0\.9347\.31↓\\downarrow0\.4573\.14↑\\uparrow1\.0070\.26↑\\uparrow0\.39333\.24
Table 3:Context management results on Eval40\.Scores are reward multiplied by 100\. Small colored arrows show changes relative to the DeepSeek baseline\. Bold and underlined values indicate the best and second best results\.MethodCodeOfficeSec\.WebAvg\.Tokens \(M\)Baseline72\.9381\.6444\.5871\.0067\.5475\.50Sliding Window \(K=5K=5\)66\.81↓\\downarrow6\.1267\.43↓\\downarrow14\.2132\.32↓\\downarrow12\.2659\.00↓\\downarrow12\.0056\.39↓\\downarrow11\.15118\.08Sliding Window \(K=10K=10\)74\.37↑\\uparrow1\.4473\.05↓\\downarrow8\.5940\.07↓\\downarrow4\.5161\.00↓\\downarrow10\.0062\.12↓\\downarrow5\.4279\.39Sliding Window \(K=20K=20\)79\.31↑\\uparrow6\.3885\.11↑\\uparrow3\.4740\.28↓\\downarrow4\.3070\.00↓\\downarrow1\.0068\.67↑\\uparrow1\.1380\.82Periodic Summary \(n=3n=3\)65\.44↓\\downarrow7\.4967\.66↓\\downarrow13\.9826\.32↓\\downarrow18\.2682\.66↑\\uparrow11\.6660\.52↓\\downarrow7\.0288\.57Periodic Summary \(n=5n=5\)83\.60↑\\uparrow10\.6775\.74↓\\downarrow5\.9040\.03↓\\downarrow4\.5581\.32↑\\uparrow10\.3270\.17↑\\uparrow2\.6394\.85LLMLingua\-2[14](https://arxiv.org/html/2609.27298#bib.bib14)64\.64↓\\downarrow8\.2973\.31↓\\downarrow8\.3340\.10↓\\downarrow4\.4870\.00↓\\downarrow1\.0062\.01↓\\downarrow5\.5396\.18PACE[35](https://arxiv.org/html/2609.27298#bib.bib35)70\.38↓\\downarrow2\.5555\.75↓\\downarrow25\.8943\.53↓\\downarrow1\.0564\.02↓\\downarrow6\.9858\.42↓\\downarrow9\.1244\.12SelfCompact[21](https://arxiv.org/html/2609.27298#bib.bib21)76\.83↑\\uparrow3\.9079\.62↓\\downarrow2\.0236\.20↓\\downarrow8\.3871\.0065\.91↓\\downarrow1\.6362\.70ACON\-Core[22](https://arxiv.org/html/2609.27298#bib.bib22)71\.79↓\\downarrow1\.1468\.55↓\\downarrow13\.0947\.95↑\\uparrow3\.3765\.00↓\\downarrow6\.0063\.32↓\\downarrow4\.2256\.13Self\-GC[23](https://arxiv.org/html/2609.27298#bib.bib23)63\.45↓\\downarrow9\.4871\.67↓\\downarrow9\.9743\.71↓\\downarrow0\.8771\.0062\.46↓\\downarrow5\.0866\.21LRE[24](https://arxiv.org/html/2609.27298#bib.bib24)62\.62↓\\downarrow10\.3163\.44↓\\downarrow18\.2027\.14↓\\downarrow17\.4468\.00↓\\downarrow3\.0055\.30↓\\downarrow12\.2491\.64CoMem[25](https://arxiv.org/html/2609.27298#bib.bib25)56\.43↓\\downarrow16\.5059\.86↓\\downarrow21\.782\.50↓\\downarrow42\.0858\.00↓\\downarrow13\.0044\.20↓\\downarrow23\.3430\.64SAM[26](https://arxiv.org/html/2609.27298#bib.bib26)67\.62↓\\downarrow5\.3181\.63↓\\downarrow0\.0147\.24↑\\uparrow2\.6667\.00↓\\downarrow4\.0065\.87↓\\downarrow1\.6753\.85SWE\-Pruner[34](https://arxiv.org/html/2609.27298#bib.bib34)63\.45↓\\downarrow9\.4872\.60↓\\downarrow9\.0440\.87↓\\downarrow3\.7165\.00↓\\downarrow6\.0060\.48↓\\downarrow7\.0660\.07Sculptor[36](https://arxiv.org/html/2609.27298#bib.bib36)51\.19↓\\downarrow21\.7481\.62↓\\downarrow0\.0235\.25↓\\downarrow9\.3369\.00↓\\downarrow2\.0059\.26↓\\downarrow8\.2851\.75ACM[37](https://arxiv.org/html/2609.27298#bib.bib37)38\.69↓\\downarrow34\.2455\.93↓\\downarrow25\.716\.20↓\\downarrow38\.3834\.00↓\\downarrow37\.0033\.70↓\\downarrow33\.8494\.56StateComp\(Ours\)76\.03↑\\uparrow3\.1084\.12↑\\uparrow2\.4851\.01↑\\uparrow6\.4375\.00↑\\uparrow4\.0071\.54↑\\uparrow4\.0043\.76
On Eval40, the reported compression run obtains reward0\.71540\.7154with 43\.76M tokens, compared with0\.67540\.6754and 75\.50M for the baseline\. This corresponds to42\.04%42\.04\\%fewer tokens\. The token total includes 0\.077M summary tokens\.
Sliding windows withK=5,10,20K=5,10,20obtain rewards of0\.56390\.5639,0\.62120\.6212, and0\.68670\.6867\. The largest window still uses 80\.82M tokens\. Periodic summarization withn=5n=5reaches0\.70170\.7017reward but uses 94\.85M tokens, including 3\.01M summary tokens\. PACE uses 44\.12M tokens with reward0\.58420\.5842\. Within this comparison group,StateCompachieves the highest mean reward with 43\.76M total tokens\. This supports evaluating compression timing together with the cost of generating summaries, rather than reporting the length of a shortened prompt alone\. The comparison also illustrates that reducing visible history alone does not guarantee lower total consumption, since altered execution paths and repeated summary operations can offset prompt\-level savings\.
Table[3](https://arxiv.org/html/2609.27298#S5.T3)also reports additional published context\-management baselines evaluated on the same fixed Eval40 tasks\.
### 5\.4 Cross\-Model Evaluation
Table[4](https://arxiv.org/html/2609.27298#S5.T4)applies the same compression procedure to four acting models on the same fixed Eval40 tasks\. GLM\-5\.3\-Flash[48](https://arxiv.org/html/2609.27298#bib.bib48)improves from0\.61700\.6170to0\.64920\.6492reward while tokens fall from 47\.58M to 38\.49M\. MiMo\-V2\.5[49](https://arxiv.org/html/2609.27298#bib.bib49)changes from0\.51960\.5196to0\.52520\.5252with tokens falling from 53\.55M to 18\.91M\. Both runs improve the observed quality and token metrics together\.
Qwen3\.8\-Flash[50](https://arxiv.org/html/2609.27298#bib.bib50)improves reward from0\.72490\.7249to0\.77840\.7784, while tokens fall from 49\.75M to 38\.23M\. Hunyuan reduces tokens from 41\.00M to 12\.83M while reward increases from0\.60190\.6019to0\.63910\.6391\. Token usage decreases for all four reported backbones, while the magnitude and domain distribution of reward changes remain model dependent\. These results show that the procedure transfers across different acting models, although the magnitude of the efficiency gain and the associated reward changes remain backbone dependent\. In particular, token totals alone do not identify whether a change is caused by longer execution, additional retries, or larger requests\. Domain scores are given in Appendix[F](https://arxiv.org/html/2609.27298#A6)\.
Table 4:Cross\-model evaluation on Eval40\.Scores are reward multiplied by 100\. Colored arrows show changes relative to the same backbone without StateComp\. Tokens report the total model usage in millions\. Each domain contains ten tasks, so Avg\. is the mean of the four domain scores\.BackboneMethodCodeOfficeSec\.WebAvg\.Tokens \(M\)Base55\.3079\.2460\.2446\.0060\.1941\.00HunyuanStateComp64\.31↑\\uparrow9\.0182\.20↑\\uparrow2\.9660\.14↓\\downarrow0\.1049\.00↑\\uparrow3\.0063\.91↑\\uparrow3\.7212\.83Base75\.2583\.4245\.2886\.0072\.4949\.75Qwen3\.8\-FlashStateComp93\.46↑\\uparrow18\.2188\.71↑\\uparrow5\.2941\.20↓\\downarrow4\.0888\.00↑\\uparrow2\.0077\.84↑\\uparrow5\.3538\.23Base79\.4966\.1334\.6766\.5161\.7047\.58GLM\-5\.3\-FlashStateComp66\.15↓\\downarrow13\.3469\.90↑\\uparrow3\.7738\.64↑\\uparrow3\.9785\.00↑\\uparrow18\.4964\.92↑\\uparrow3\.2238\.49Base53\.7677\.0522\.0455\.0051\.9653\.55MiMo\-V2\.5StateComp57\.65↑\\uparrow3\.8971\.64↓\\downarrow5\.4122\.77↑\\uparrow0\.7358\.00↑\\uparrow3\.0052\.52↑\\uparrow0\.5618\.91
## 6 Conclusion
We introducedStateComp, which predicts whether past interactions still need their full details at the current agent state\. Two stage annotation supplies supported compression boundaries, hidden states provide prediction features, and span and token gates determine when selected history is summarized\. Committed summaries become part of the effective history without restoring removed raw interactions\. The reported full benchmark comparison reduces agent and summary tokens by approximately half while maintaining average reward\. These findings support separating the prediction of compression opportunities from the decision to rewrite a sufficiently large span\. The experiments measure complete\-task token usage; they do not isolate the effect of the span gates on cache reuse\.
### AI Use Statement
Generative AI tools were used for language editing and literature retrieval and discovery, including identifying potentially relevant papers, search keywords, and related work, as well as surveying the current state of research on relevant topics\. An LLM was also used in the annotation procedure to assist in constructing the compression supervision described in the paper and appendix\. The annotation procedure and resulting labels were reviewed by the authors\. The final selection, interpretation, and presentation of the literature and experimental results were determined by the authors\. All AI\-assisted content was reviewed by the authors, who take full responsibility for the final content of this work\.
### Reproducibility Statement
Appendices A–E describe the two\-stage annotation procedure, grouped training and evaluation splits, representation construction, router objectives, theoretical analysis, and online compression algorithm\. Appendices F and G provide the fixed benchmark protocols, supplementary results, operating settings, and the fixed Eval40 task identifiers\. Token\-accounting conventions and the compression configuration are specified alongside the corresponding experiments\.
## References
- 1Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao\.React: Synergizing reasoning and acting in language models\.*arXiv preprint arXiv:2210\.03629*, 2022\.
- 2Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao\.Reflexion: Language agents with verbal reinforcement learning\.*Advances in neural information processing systems*, 36:8634–8652, 2023\.
- 3Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar\.Voyager: An open\-ended embodied agent with large language models\.*arXiv preprint arXiv:2305\.16291*, 2023\.
- 4Xiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu, Xuanyu Lei, Hanyu Lai, Yu Gu, Hangliang Ding, Kaiwen Men, Kejuan Yang, et al\.Agentbench: Evaluating llms as agents\.In*International Conference on Learning Representations*, volume 2024, pages 52989–53046, 2024a\.
- 5Nelson F Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, and Percy Liang\.Lost in the middle: How language models use long contexts\.*Transactions of the association for computational linguistics*, 12:157–173, 2024b\.
- 6Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, et al\.Longbench: A bilingual, multitask benchmark for long context understanding\.In*Proceedings of the 62nd annual meeting of the association for computational linguistics \(volume 1: Long papers\)*, pages 3119–3137, 2024\.
- 7Yushi Bai, Shangqing Tu, Jiajie Zhang, Hao Peng, Xiaozhi Wang, Xin Lv, Shulin Cao, Jiazheng Xu, Lei Hou, Yuxiao Dong, et al\.Longbench v2: Towards deeper understanding and reasoning on realistic long\-context multitasks\.In*Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\)*, pages 3639–3664, 2025\.
- 8Huiqiang Jiang, Qianhui Wu, Chin\-Yew Lin, Yuqing Yang, and Lili Qiu\.Llmlingua: Compressing prompts for accelerated inference of large language models\.In*Proceedings of the 2023 conference on empirical methods in natural language processing*, pages 13358–13376, 2023\.
- 9Huiqiang Jiang, Qianhui Wu, Xufang Luo, Dongsheng Li, Chin\-Yew Lin, Yuqing Yang, and Lili Qiu\.Longllmlingua: Accelerating and enhancing llms in long context scenarios via prompt compression\.In*Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\)*, pages 1658–1677, 2024a\.
- 10Yucheng Li, Bo Dong, Frank Guerin, and Chenghua Lin\.Compressing context to enhance inference efficiency of large language models\.In*Proceedings of the 2023 conference on empirical methods in natural language processing*, pages 6342–6353, 2023\.
- 11Di Wu, Hongwei Wang, Wenhao Yu, Yuwei Zhang, Kai\-Wei Chang, and Dong Yu\.Longmemeval: Benchmarking chat assistants on long\-term interactive memory\.*arXiv preprint arXiv:2410\.10813*, 2024\.
- 12Adyasha Maharana, Dong\-Ho Lee, Sergey Tulyakov, Mohit Bansal, Francesco Barbieri, and Yuwei Fang\.Evaluating very long\-term conversational memory of llm agents\.In*Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\)*, pages 13851–13870, 2024\.
- 13Tencent WorkBuddy Bench Team, Siqi Cai, Shaopeng Chen, Xiang Fei, Yong Mao, Zihan Xu, Zhiheng Lyu, Zhijian Shao, Yuchen Shi, Shuwen Zhang, et al\.Tencent workbuddy bench: A multi\-domain coding\-agent benchmark with contamination\-resistant task construction\.*arXiv preprint arXiv:2607\.20911*, 2026\.
- 14Zhuoshi Pan, Qianhui Wu, Huiqiang Jiang, Menglin Xia, Xufang Luo, Jue Zhang, Qingwei Lin, Victor Rühle, Yuqing Yang, Chin\-Yew Lin, et al\.Llmlingua\-2: Data distillation for efficient and faithful task\-agnostic prompt compression\.In*Findings of the Association for Computational Linguistics: ACL 2024*, pages 963–981, 2024\.
- 15Alexis Chevalier, Alexander Wettig, Anirudh Ajith, and Danqi Chen\.Adapting language models to compress contexts\.In*Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing*, pages 3829–3846, 2023\.
- 16Jesse Mu, Xiang Li, and Noah Goodman\.Learning to compress prompts with gist tokens\.*Advances in Neural Information Processing Systems*, 36:19327–19352, 2023\.
- 17Tao Ge, Jing Hu, Lei Wang, Xun Wang, Si\-Qing Chen, and Furu Wei\.In\-context autoencoder for context compression in a large language model\.*arXiv preprint arXiv:2307\.06945*, 2023\.
- 18Fangyuan Xu, Weijia Shi, and Eunsol Choi\.Recomp: Improving retrieval\-augmented lms with context compression and selective augmentation\.In*International Conference on Learning Representations*, volume 2024, pages 43478–43502, 2024\.
- 19Xin Cheng, Xun Wang, Xingxing Zhang, Tao Ge, Si\-Qing Chen, Furu Wei, Huishuai Zhang, and Dongyan Zhao\.xrag: Extreme context compression for retrieval\-augmented generation with one token\.*Advances in Neural Information Processing Systems*, 37:109487–109516, 2024\.
- 20Peitian Zhang, Zheng Liu, Shitao Xiao, Ninglu Shao, Qiwei Ye, and Zhicheng Dou\.Long context compression with activation beacon\.In*International Conference on Learning Representations*, volume 2025, pages 101932–101948, 2025\.
- 21Tianjian Li, Jingyu Zhang, William Jurayj, Xi Wang, Chuanyang Jin, Mehrdad Farajtabar, Eric Nalisnick, and Daniel Khashabi\.Self\-compacting language model agents\.*arXiv preprint arXiv:2606\.23525*, 2026a\.
- 22Minki Kang, Wei\-Ning Chen, Dongge Han, Huseyin A Inan, Lukas Wutschitz, Yanzhi Chen, Robert Sim, and Saravan Rajmohan\.Acon: Optimizing context compression for long\-horizon llm agents\.*arXiv preprint arXiv:2510\.00615*, 2025a\.
- 23Xubin Hao, Hongjin Meng, Xin Yin, Jiawei Zhu, and Chenpeng Cao\.Self\-gc: Self\-governing context for long\-horizon llm agents\.*arXiv preprint arXiv:2607\.00692*, 2026\.
- 24Nusrat Jahan Lia and Aritra Mazumder\.Learning what not to forget: Long\-horizon agent memory from a few kilobytes of learning\.*arXiv e\-prints*, pages arXiv–2606, 2026\.
- 25Yuwei Zhang, Chengyu Dong, Shuowei Jin, Changlong Yu, Hejie Cui, Hongye Jin, Xinyang Zhang, Hamed Bonab, Colin Lockard, Jianshu Chen, et al\.Comem: Context management with a decoupled long\-context model\.*arXiv preprint arXiv:2605\.30842*, 2026\.
- 26Yuyang Hu, Hongjin Qian, Shuting Wang, Jiongnan Liu, Ziliang Zhao, Jiejun Tan, Zheng Liu, and Zhicheng Dou\.Sam: State\-adaptive memory for long\-horizon reasoning agent\.*arXiv preprint arXiv:2605\.24468*, 2026\.
- 27Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G Patil, Ion Stoica, and Joseph E Gonzalez\.Memgpt: Towards llms as operating systems\.*arXiv preprint arXiv:2310\.08560*, 2023\.
- 28Joon Sung Park, Joseph O’Brien, Carrie Jun Cai, Meredith Ringel Morris, Percy Liang, and Michael S Bernstein\.Generative agents: Interactive simulacra of human behavior\.In*Proceedings of the 36th annual acm symposium on user interface software and technology*, pages 1–22, 2023\.
- 29Wanjun Zhong, Lianghong Guo, Qiqi Gao, He Ye, and Yanlin Wang\.Memorybank: Enhancing large language models with long\-term memory\.In*Proceedings of the AAAI conference on artificial intelligence*, volume 38, pages 19724–19731, 2024\.
- 30Prateek Chhikara, Dev Khant, Saket Aryan, Taranjeet Singh, and Deshraj Yadav\.Mem0: Building production\-ready ai agents with scalable long\-term memory\.*arXiv preprint arXiv:2504\.19413*, 2025\.
- 31Jiazheng Kang, Mingming Ji, Zhe Zhao, and Ting Bai\.Memory os of ai agent\.In*Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing*, pages 25972–25981, 2025b\.
- 32Wujiang Xu, Zujie Liang, Kai Mei, Hang Gao, Juntao Tan, and Yongfeng Zhang\.A\-mem: Agentic memory for llm agents\.*Advances in Neural Information Processing Systems*, 38:17577–17604, 2026a\.
- 33Bernal J Gutiérrez, Yiheng Shu, Yu Gu, Michihiro Yasunaga, and Yu Su\.Hipporag: Neurobiologically inspired long\-term memory for large language models\.*Advances in neural information processing systems*, 37:59532–59569, 2024\.
- 34Yuhang Wang, Yuling Shi, Mo Yang, Rongrui Zhang, Shilin He, Heng Lian, Yuting Chen, Siyu Ye, Kai Cai, and Xiaodong Gu\.Swe\-pruner: Self\-adaptive context pruning for coding agents\.*arXiv preprint arXiv:2601\.16746*, 2026\.
- 35Lei Wei, Xiao Peng, Guannan Zhang, Chenhao Jiang, Hongyu Li, Lanbo Lin, Yuanwu Xu, Jiayao Liu, Kesu Wang, Bin Wang, et al\.Pace: Predictive adaptive context extraction for long\-horizon llm agents\.In*Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\)*, pages 27184–27199, 2026\.
- 36Mo Li, LH Xu, Qitai Tan, Long Ma, Hongyong Song, Ting Cao, and Yunxin Liu\.Sculptor: Empowering llms with cognitive agency via active context management\.In*International Conference on Learning Representations*, volume 2026, pages 153411–153440, 2026b\.
- 37Xiaochuan Li, Ryan Ming, Meng Chu, Shuai Shao, Rong Jin, and Chenyan Xiong\.Acm: Agentic context management for long horizon tasks\.*arXiv preprint arXiv:2607\.23809*, 2026c\.
- 38Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph Gonzalez, Hao Zhang, and Ion Stoica\.Efficient memory management for large language model serving with pagedattention\.In*Proceedings of the 29th symposium on operating systems principles*, pages 611–626, 2023\.
- 39Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, and Mike Lewis\.Efficient streaming language models with attention sinks\.In*International Conference on Learning Representations*, volume 2024, pages 21875–21895, 2024a\.
- 40Zhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen, Lianmin Zheng, Ruisi Cai, Zhao Song, Yuandong Tian, Christopher Ré, Clark Barrett, et al\.H2o: Heavy\-hitter oracle for efficient generative inference of large language models\.*Advances in neural information processing systems*, 36:34661–34710, 2023\.
- 41Huiqiang Jiang, Yucheng Li, Chengruidong Zhang, Qianhui Wu, Xufang Luo, Surin Ahn, Zhenhua Han, Amir H Abdi, Dongsheng Li, Chin\-Yew Lin, et al\.Minference 1\.0: Accelerating pre\-filling for long\-context llms via dynamic sparse attention\.*Advances in Neural Information Processing Systems*, 37:52481–52515, 2024b\.
- 42Chaojun Xiao, Pengle Zhang, Xu Han, Guangxuan Xiao, Yankai Lin, Zhengyan Zhang, Zhiyuan Liu, Song Han, and Maosong Sun\.Infllm: Unveiling the intrinsic capacity of llms for understanding extremely long sequences with training\-free memory\.*arXiv preprint arXiv:2402\.04617*, 3\(7\), 2024b\.
- 43Zichang Liu, Aditya Desai, Fangshuo Liao, Weitao Wang, Victor Xie, Zhaozhuo Xu, Anastasios Kyrillidis, and Anshumali Shrivastava\.Scissorhands: Exploiting the persistence of importance hypothesis for llm kv cache compression at test time\.*Advances in Neural Information Processing Systems*, 36:52342–52364, 2023\.
- 44Yuhong Li, Yingbing Huang, Bowen Yang, Bharat Venkitesh, Acyr Locatelli, Hanchen Ye, Tianle Cai, Patrick Lewis, and Deming Chen\.Snapkv: Llm knows what you are looking for before generation\.*Advances in Neural Information Processing Systems*, 37:22947–22970, 2024\.
- 45Zefan Cai, Yichi Zhang, Bofei Gao, Yuliang Liu, Yucheng Li, Tianyu Liu, Keming Lu, Wayne Xiong, Yue Dong, Junjie Hu, et al\.Pyramidkv: Dynamic kv cache compression based on pyramidal information funneling\.*arXiv preprint arXiv:2406\.02069*, 2024\.
- 46Jiaming Tang, Yilong Zhao, Kan Zhu, Guangxuan Xiao, Baris Kasikci, and Song Han\.Quest: Query\-aware sparsity for efficient long\-context llm inference\.*arXiv preprint arXiv:2406\.10774*, 2024\.
- 47Anyi Xu, Bangcai Lin, Bing Xue, Bingxuan Wang, Bingzheng Xu, Bochao Wu, Bowei Zhang, Chaofan Lin, Chen Dong, Chenchen Ling, et al\.Deepseek\-v4: Towards highly efficient million\-token context intelligence\.*arXiv preprint arXiv:2606\.19348*, 2026b\.
- 48Aohan Zeng, Xin Lv, Zhenyu Hou, Zhengxiao Du, Qinkai Zheng, Bin Chen, Da Yin, Chendi Ge, Chenghua Huang, Chengxing Xie, et al\.Glm\-5: from vibe coding to agentic engineering\.*arXiv preprint arXiv:2602\.15763*, 2026\.
- 49Mimo\-v2\.5\.[https://huggingface\.co/collections/XiaomiMiMo/mimo\-v25](https://huggingface.co/collections/XiaomiMiMo/mimo-v25), 2026\.
- 50Qwen Team\.Qwen3\.8\-Flash\-Next: A new architecture, towards ultimate cost\-efficiency, August 2026\.URL[https://qwen\.ai/blog?id=qwen3\.8\-flash\-next](https://qwen.ai/blog?id=qwen3.8-flash-next)\.
## Appendix ACompression Targets and Supervision
This appendix provides the supervision, training details, mathematical analysis, and supplementary experiments forStateComp\. The analytical results concern the stated prediction and execution rules; empirical compression quality is evaluated separately\.
### A\.1 Interactions and Effective History
An interactionSi=\(Ri,Ai,Oi\)S\_\{i\}=\(R\_\{i\},A\_\{i\},O\_\{i\}\)contains reasoning, an assistant action, and its observation\. Tool calls and their responses remain within complete interaction boundaries\. Before stepkk, letPk=\(S1,…,Sk−1\)P\_\{k\}=\(S\_\{1\},\\ldots,S\_\{k\-1\}\)denote the original prefix andHkH\_\{k\}the effective history after previously committed replacements\. Letℐk\\mathcal\{I\}\_\{k\}index the surviving raw interactions\. The agent and router useHkH\_\{k\}; stored original trajectories are not available as an online retrieval channel\.
The target is defined jointly by a historical interaction and the current state:
yi,k=\{0\(KEEP\),retain the original details,1\(READY\),replace the details by an accurate summary\.y\_\{i,k\}=\\begin\{cases\}0\\quad\(\\mathrm\{KEEP\}\),&\\text\{retain the original details\},\\\\ 1\\quad\(\\mathrm\{READY\}\),&\\text\{replace the details by an accurate summary\}\.\\end\{cases\}\(A\.1\)READY does not mean that every fact is irrelevant\. Facts still needed by the task must remain in the summary or elsewhere in the effective history\. The online router predicts
pi,k=pθ\(Si,Hk\),y^i,k=𝟏\{pi,k≥τ\},i∈ℐk\.p\_\{i,k\}=p\_\{\\theta\}\(S\_\{i\},H\_\{k\}\),\\qquad\\widehat\{y\}\_\{i,k\}=\\mathbf\{1\}\\\{p\_\{i,k\}\\geq\\tau\\\},\\qquad i\\in\\mathcal\{I\}\_\{k\}\.\(A\.2\)Selected interactions may occupy several disconnected regions; a recent window is not imposed on candidate eligibility\.
Table A1:Notation for supervision and online compression\.SymbolMeaningSiS\_\{i\}Complete historical interactionPkP\_\{k\}Uncompressed reference prefix before interactionkkHk,ℐkH\_\{k\},\\mathcal\{I\}\_\{k\}Effective history and identifiers of surviving raw interactionsyi,ky\_\{i,k\}Reference label: KEEP=0=0, READY=1=1ti∗t\_\{i\}^\{\*\}Earliest supported compression checkpointFϕ,gθF\_\{\\phi\},g\_\{\\theta\}Frozen representation model and trained routerhi,qk,ri,kh\_\{i\},q\_\{k\},r\_\{i,k\}Historical, current, and aggregated historical featureszi,k,pi,kz\_\{i,k\},p\_\{i,k\}Router logit and sigmoid scoreτ\\tauRouter selection thresholdKctx,Ksw,KhistK\_\{\\mathrm\{ctx\}\},K\_\{\\mathrm\{sw\}\},K\_\{\\mathrm\{hist\}\}Recent context size, sliding window size, and same\-prefix feature selection countB,κ,BminB,\\kappa,B\_\{\\min\}Continuous source span, interaction threshold, and source token thresholdM,Tok\(H\)M,\\operatorname\{Tok\}\(H\)Per\-view representation budget and serialized history length
### A\.2 Two\-Stage Annotation
Stage 1 independently annotates each checkpoint and produces a structured judgment for every historical interaction at that checkpoint\. Each record includes task progress, observation complexity, expected requirements of the next subtask, the remaining utility of the interaction, a KEEP/READY judgment, and the locations of supporting evidence\. Positive evidence must already occur inPkP\_\{k\}\. Future interactions can reveal a missing dependency and veto a proposed replacement, but cannot justify an earlier replacement using information that was not yet available\.
Writingei,ke\_\{i,k\}for supporting prefix evidence andvi,kv\_\{i,k\}for a future dependency veto, a positive local judgmentbi,kb\_\{i,k\}obeys
bi,k=1⟹ei,k=1andvi,k=0\.b\_\{i,k\}=1\\ \\Longrightarrow\\ e\_\{i,k\}=1\\ \\text\{and\}\\ v\_\{i,k\}=0\.\(A\.3\)Stage 2 reviews these records across checkpoints for the same interaction, checks proposed boundaries against their supporting evidence, and selects the earliest supported compression pointti∗t\_\{i\}^\{\*\}\. Unresolved cases remain KEEP\. The final labels are
yi,k=𝟏\{k≥ti∗\},ti∗∈\{i\+1,…,T\}∪\{∞\}\.y\_\{i,k\}=\\mathbf\{1\}\\\{k\\geq t\_\{i\}^\{\*\}\\\},\\qquad t\_\{i\}^\{\*\}\\in\\\{i\+1,\\ldots,T\\\}\\cup\\\{\\infty\\\}\.\(A\.4\)The value∞\\inftydenotes an interaction with no supported boundary\. Monotonicity is part of this encoding for the annotated continuation, not a guarantee for every possible future trajectory\. Online predictions are therefore recomputed after the effective history changes\.
### A\.3 Data and Grouped Evaluation
The supervision collection contains 300 trajectories and 244,526 interaction–state pairs\. READY accounts for 15,633 pairs, giving
π=15,633244,526≈0\.06393\.\\pi=\\frac\{15\{,\}633\}\{244\{,\}526\}\\approx 0\.06393\.\(A\.5\)An always\-KEEP classifier consequently reaches approximately93\.61%93\.61\\%accuracy without identifying a single compression opportunity\. We use ranking and precision–recall metrics rather than accuracy alone\.
Table A2:Compression supervision and evaluation partitions\.QuantityValueTrajectories300Recorded states7,931Checkpoint groups7,631Interaction–state pairs244,526KEEP pairs228,893READY pairs15,633Supported boundaries1,832Interactions without a supported boundary6,099Training / validation / test trajectories per rotation200 / 50 / 50Grouped folds5All pairs from the same trajectory remain in one partition\. Model configuration, training checkpoint, class weighting, and prediction threshold are selected using training and validation data\. The five rotations evaluate generalization across trajectories rather than across randomly separated pairs from the same trajectory\.
## Appendix BState Representations and Router Learning
### B\.1 Historical and Current\-State Features
The grouped router study uses a frozen Qwen2\.5\-7B representation model\. LetXk=Serialize\(Pk\)X\_\{k\}=\\operatorname\{Serialize\}\(P\_\{k\}\), and letℓi\\ell\_\{i\}be the last token ofSiS\_\{i\}\. A full\-context pass of the frozen representation modelFϕF\_\{\\phi\}provides
hi=Fϕ\(Xk\)ℓi,qk=Fϕ\(Xk\)\|Xk\|\.h\_\{i\}=F\_\{\\phi\}\(X\_\{k\}\)\_\{\\ell\_\{i\}\},\\qquad q\_\{k\}=F\_\{\\phi\}\(X\_\{k\}\)\_\{\|X\_\{k\}\|\}\.\(B\.1\)The first vector describes the historical interaction; the second describes the current state\. A notation covering the concatenation\-based variants is
ri,k=Agg\{hj:j∈𝒥i,k\},xi,k=\[hi;qk;ri,k\],pi,k=σ\(gθ\(xi,k\)\)\.r\_\{i,k\}=\\operatorname\{Agg\}\\\{h\_\{j\}:j\\in\\mathcal\{J\}\_\{i,k\}\\\},\\qquad x\_\{i,k\}=\[h\_\{i\};q\_\{k\};r\_\{i,k\}\],\\qquad p\_\{i,k\}=\\sigma\(g\_\{\\theta\}\(x\_\{i,k\}\)\)\.\(B\.2\)Here𝒥i,k\\mathcal\{J\}\_\{i,k\}lies within the available prefix\. The experiments compare features with and without recurrent aggregation and same\-prefix historical selection\. These operations construct prediction features; they do not restore removed raw interactions\.
Proposition B\.1 \(Causal prefix invariance\)\.Consider a deterministic causal Transformer with fixed parameters, unchanged prefix tokens and positional assignments, and no transformation of the prefix that depends on the length of an appended suffix\. In exact arithmetic, appending tokens leaves every existing prefix hidden state unchanged\.
Proof\.LetHj\(ℓ\)H\_\{j\}^\{\(\\ell\)\}be the representation at prefix positionjjand layerℓ\\ell\. The input statesHj\(0\)H\_\{j\}^\{\(0\)\}are identical\. For one attention head,
Aj\(ℓ\)=∑u≤jαju\(ℓ\)WV\(ℓ\)Hu\(ℓ\),αju\(ℓ\)=exp\(aju\(ℓ\)\)∑v≤jexp\(ajv\(ℓ\)\)\.A\_\{j\}^\{\(\\ell\)\}=\\sum\_\{u\\leq j\}\\alpha\_\{ju\}^\{\(\\ell\)\}W\_\{V\}^\{\(\\ell\)\}H\_\{u\}^\{\(\\ell\)\},\\qquad\\alpha\_\{ju\}^\{\(\\ell\)\}=\\frac\{\\exp\(a\_\{ju\}^\{\(\\ell\)\}\)\}\{\\sum\_\{v\\leq j\}\\exp\(a\_\{jv\}^\{\(\\ell\)\}\)\}\.\(B\.3\)Assume that the states at all prefix positions are unchanged at layerℓ\\ell\. Each query, permitted key, value, and positional contribution in Equation \([B\.3](https://arxiv.org/html/2609.27298#A2.E3)\) is then unchanged\. The normalization contains no suffix positions, so every attention output is unchanged\. Residual connections, tokenwise normalization, and feed\-forward layers preserve the equality\. Induction over layers proves the result\.□\\square
Thus, a historical vector cannot become state dependent merely because new tokens are appended\. The router obtains state dependence fromqkq\_\{k\}or from a freshly constructed input containing both the target interaction and current context\. The proposition also characterizes reusable prefix states after an online rewrite\.
### B\.2 Weighted Classification
With READY encoded as one, the router objective is
ℒ\(θ\)=−1N∑n=1N\[w1ynlogpn\+w0\(1−yn\)log\(1−pn\)\]\.\\mathcal\{L\}\(\\theta\)=\-\\frac\{1\}\{N\}\\sum\_\{n=1\}^\{N\}\\left\[w\_\{1\}y\_\{n\}\\log p\_\{n\}\+w\_\{0\}\(1\-y\_\{n\}\)\\log\(1\-p\_\{n\}\)\\right\]\.\(B\.4\)The weighted BCE experiments setw0=1w\_\{0\}=1and varyw1w\_\{1\}\. The representation model remains frozen\. Forp=σ\(z\)p=\\sigma\(z\)and a binary labelyy,
∂ℓ∂z\\displaystyle\\frac\{\\partial\\ell\}\{\\partial z\}=\(w1y\+w0\(1−y\)\)\(p−y\),\\displaystyle=\\bigl\(w\_\{1\}y\+w\_\{0\}\(1\-y\)\\bigr\)\(p\-y\),\(B\.5\)∂2ℓ∂z2\\displaystyle\\frac\{\\partial^\{2\}\\ell\}\{\\partial z^\{2\}\}=\(w1y\+w0\(1−y\)\)p\(1−p\)\.\\displaystyle=\\bigl\(w\_\{1\}y\+w\_\{0\}\(1\-y\)\\bigr\)p\(1\-p\)\.\(B\.6\)These derivatives describe the loss as a function of a logit, not convexity in the parameters of a nonlinear router\.
Proposition B\.2 \(Weighted score and underlying posterior\)\.Letη\(x\)=Pr\(Y=1∣x\)\\eta\(x\)=\\Pr\(Y=1\\mid x\)andw0,w1\>0w\_\{0\},w\_\{1\}\>0\. For0<η\(x\)<10<\\eta\(x\)<1, the unique minimizer of the conditional weighted BCE is
p∗\(x\)=w1η\(x\)w1η\(x\)\+w0\(1−η\(x\)\),logitp∗=logitη\+logw1w0\.p^\{\*\}\(x\)=\\frac\{w\_\{1\}\\eta\(x\)\}\{w\_\{1\}\\eta\(x\)\+w\_\{0\}\(1\-\\eta\(x\)\)\},\\qquad\\operatorname\{logit\}p^\{\*\}=\\operatorname\{logit\}\\eta\+\\log\\frac\{w\_\{1\}\}\{w\_\{0\}\}\.\(B\.7\)
Proof\.The conditional risk isR\(p\)=−w1ηlogp−w0\(1−η\)log\(1−p\)R\(p\)=\-w\_\{1\}\\eta\\log p\-w\_\{0\}\(1\-\\eta\)\\log\(1\-p\)\. Its derivative vanishes whenw1η\(1−p\)=w0\(1−η\)pw\_\{1\}\\eta\(1\-p\)=w\_\{0\}\(1\-\\eta\)p, giving the first expression\. Moreover,
R′′\(p\)=w1ηp2\+w0\(1−η\)\(1−p\)2\>0,R^\{\\prime\\prime\}\(p\)=\\frac\{w\_\{1\}\\eta\}\{p^\{2\}\}\+\\frac\{w\_\{0\}\(1\-\\eta\)\}\{\(1\-p\)^\{2\}\}\>0,\(B\.8\)which proves uniqueness\. Taking the ratiop∗/\(1−p∗\)p^\{\*\}/\(1\-p^\{\*\}\)proves the log\-odds identity\. Boundary cases follow by continuity\. IfD=w1η\+w0\(1−η\)D=w\_\{1\}\\eta\+w\_\{0\}\(1\-\\eta\), the excess risk also satisfies
R\(p\)−R\(p∗\)=DKL\(Bern\(p∗\)∥Bern\(p\)\),R\(p\)\-R\(p^\{\*\}\)=D\\,\\operatorname\{KL\}\\bigl\(\\operatorname\{Bern\}\(p^\{\*\}\)\\,\\\|\\,\\operatorname\{Bern\}\(p\)\\bigr\),\(B\.9\)obtained by collecting the two logarithmic terms\.□\\square
The corresponding inverse transformation is
η=w0p∗w1\(1−p∗\)\+w0p∗\.\\eta=\\frac\{w\_\{0\}p^\{\*\}\}\{w\_\{1\}\(1\-p^\{\*\}\)\+w\_\{0\}p^\{\*\}\}\.\(B\.10\)This population identity explains why class weighting changes score interpretation\. It does not establish calibration of the fitted router\.
### B\.3 Asymmetric Costs and Operating Thresholds
LetCunsafeC\_\{\\mathrm\{unsafe\}\}denote the cost of selecting a KEEP interaction andCmissC\_\{\\mathrm\{miss\}\}the cost of retaining a READY interaction\. Both are positive\. Correct label decisions have zero cost in this analysis; summary\-generation errors are considered separately in Appendix[E](https://arxiv.org/html/2609.27298#A5)\.
Proposition B\.3 \(Cost\-sensitive selection\)\.Ifη\(x\)\\eta\(x\)is known, the minimum conditional label risk is attained by selection whenever
η\(x\)≥η0:=CunsafeCunsafe\+Cmiss\.\\eta\(x\)\\geq\\eta\_\{0\}:=\\frac\{C\_\{\\mathrm\{unsafe\}\}\}\{C\_\{\\mathrm\{unsafe\}\}\+C\_\{\\mathrm\{miss\}\}\}\.\(B\.11\)For the ideal weighted score, the equivalent threshold is
τw=w1Cunsafew1Cunsafe\+w0Cmiss\.\\tau\_\{w\}=\\frac\{w\_\{1\}C\_\{\\mathrm\{unsafe\}\}\}\{w\_\{1\}C\_\{\\mathrm\{unsafe\}\}\+w\_\{0\}C\_\{\\mathrm\{miss\}\}\}\.\(B\.12\)
Proof\.The conditional costs of selection and retention areCunsafe\(1−η\)C\_\{\\mathrm\{unsafe\}\}\(1\-\\eta\)andCmissηC\_\{\\mathrm\{miss\}\}\\eta, respectively\. Comparing them gives Equation \([B\.11](https://arxiv.org/html/2609.27298#A2.E11)\)\. The mapη↦p∗\\eta\\mapsto p^\{\*\}in Equation \([B\.7](https://arxiv.org/html/2609.27298#A2.E7)\) is strictly increasing\. Substitution ofη0\\eta\_\{0\}therefore gives the equivalent weighted threshold\. More explicitly, a decision that disagrees with this cost\-optimal decision has excess conditional risk
\(Cunsafe\+Cmiss\)\|η−η0\|\.\(C\_\{\\mathrm\{unsafe\}\}\+C\_\{\\mathrm\{miss\}\}\)\|\\eta\-\\eta\_\{0\}\|\.\(B\.13\)This follows by subtracting the smaller of the two conditional costs from the larger one\.□\\square
Class weighting and conservative decision thresholds have different roles\. The former changes the training loss; the latter determines the operating tradeoff\. In the experiments, operating choices use validation data rather than a known posterior or an assumed numerical cost ratio\.
## Appendix CBounded Representation and Efficiency
### C\.1 Input Construction and Computational Cost
For each surviving historical target, the bounded construction forms
Vi,k=ℬM\(Si,Hk,Kctx\),\|Vi,k\|≤M,h~i,k=Fϕ\(Vi,k\)\|Vi,k\|\.V\_\{i,k\}=\\mathcal\{B\}\_\{M\}\(S\_\{i\},H\_\{k\};K\_\{\\mathrm\{ctx\}\}\),\\qquad\|V\_\{i,k\}\|\\leq M,\\qquad\\widetilde\{h\}\_\{i,k\}=F\_\{\\phi\}\(V\_\{i,k\}\)\_\{\|V\_\{i,k\}\|\}\.\(C\.1\)It combines the target with current context and a limited portion of the effective history\. The representation comparison uses a 4,096\-token base budget and up to 1,024 additional target tokens, forM=5,120M=5,120\. Recent4 specifies a context construction, not the minimum span length for an online compression operation\.
LetLkL\_\{k\}denote full\-context length,NkN\_\{k\}the number of surviving targets,ℱ\(n\)\\mathcal\{F\}\(n\)the cost of a length\-nnmodel pass, andcgc\_\{g\}the router cost per target\. Fresh full\-context extraction and target\-specific bounded extraction have workloads
Cfull\(k\)=ℱ\(Lk\)\+O\(Nkcg\),Cbounded\(k\)≤Nkℱ\(M\)\+O\(Nkcg\)\.C\_\{\\mathrm\{full\}\}\(k\)=\\mathcal\{F\}\(L\_\{k\}\)\+O\(N\_\{k\}c\_\{g\}\),\\qquad C\_\{\\mathrm\{bounded\}\}\(k\)\\leq N\_\{k\}\\mathcal\{F\}\(M\)\+O\(N\_\{k\}c\_\{g\}\)\.\(C\.2\)One full pass can supply all historical readouts\. Conversely, bounded extraction uses multiple short views, which may be batched; its total work still depends onNkN\_\{k\}\. For a dense\-attention model withLLlayers and widthdd, the usual arithmetic model isℱ\(n\)=O\(L\(nd2\+n2d\)\)\\mathcal\{F\}\(n\)=O\(L\(nd^\{2\}\+n^\{2\}d\)\)\. Across a trajectory,
Ctrajectory≤∑kNkℱ\(M\)\+∑kO\(Nkcg\)\.C\_\{\\mathrm\{trajectory\}\}\\leq\\sum\_\{k\}N\_\{k\}\\mathcal\{F\}\(M\)\+\\sum\_\{k\}O\(N\_\{k\}c\_\{g\}\)\.\(C\.3\)A bounded view therefore controls individual input size without implying constant cost per checkpoint\.
### C\.2 Stability of Decisions and Selected Spans
Proposition C\.1 \(Bounded perturbations preserve routing and spans\)\.Suppose full and bounded featuresxi,x~ix\_\{i\},\\widetilde\{x\}\_\{i\}are supplied to the same logit functiongg, with\|g\(xi\)−g\(x~i\)\|≤Lgϵi\|g\(x\_\{i\}\)\-g\(\\widetilde\{x\}\_\{i\}\)\|\\leq L\_\{g\}\\epsilon\_\{i\}\. Letaτ=log\(τ/\(1−τ\)\)a\_\{\\tau\}=\\log\(\\tau/\(1\-\\tau\)\),0<τ<10<\\tau<1\. The decision for targetiiis unchanged if
\|g\(xi\)−aτ\|\>Lgϵi\.\|g\(x\_\{i\}\)\-a\_\{\\tau\}\|\>L\_\{g\}\\epsilon\_\{i\}\.\(C\.4\)If this holds for every eligible interaction, and the source history and execution gates are unchanged, the two feature constructions produce the same maximal selected spans and the same gate\-eligible candidates\.
Proof\.A score more thanLgϵiL\_\{g\}\\epsilon\_\{i\}above the threshold remains above it after the perturbation; a score more than that amount below it remains below it\. Since the sigmoid is strictly increasing, thresholding its output is equivalent to thresholding the logit ataτa\_\{\\tau\}\. This proves pointwise decision equality\. Equality for every target gives identical binary masks\. Maximal runs are determined uniquely by the mask and the fixed boundaries of eligible interactions\. Each resulting run consequently has the same source length and token count, so both execution gates return the same answer\.□\\square
The result concerns a fixed router under a stated perturbation bound\. The empirical ablations below compare separately fitted feature variants; they measure performance rather than establish the bound in Equation \([C\.4](https://arxiv.org/html/2609.27298#A3.E4)\)\.
### C\.3 Representation Measurements
The input\-size study covers 110 trajectories and 2,558 states\. Mean bounded input is 4,181\.5 tokens; 86 trajectories exceed the base budget, 73 reach the 5,120\-token limit, and 178 current\-step inputs are truncated\. Timing uses seven states on which both implementations complete on the same device\. The representation\-quality comparison is separate from the boundary\-label router study in Appendix[D](https://arxiv.org/html/2609.27298#A4)\.
Table A3:Representation efficiency\.Input statistics, paired runtime, and classification quality refer to their respective measurements\.MetricFull historyBoundedMean input tokensn/a4,181\.50Largest recorded input203,6755,120Representative long input127,8335,120Paired extraction time \(s\)76\.406\.03Mean latency \(s/state\)10\.9140\.861Peak GPU memory \(GiB\)29\.42618\.620Forward workspace \(GiB\)11\.8671\.062Throughput \(states/s\)0\.09161\.1611Separate test F10\.70000\.7818
Total extraction time decreases from 76\.40 to 6\.03 seconds, a12\.67×12\.67\\timesmeasured speedup\. Peak GPU allocation and forward workspace measure different quantities\. The full\-model memory result comes from a successful 57,401\-token input; inputs of 131,576 and 203,675 tokens exhaust GPU memory and are not included in the paired timing\. This speedup is for representation extraction, not complete\-task execution\.
Table A4:Context and historical\-feature ablations in the representation comparison\.RepresentationTest F1Balanced accuracyFull Context0\.70000\.5951Recent20\.71010\.5940Recent40\.73400\.6036Local \+ GRU0\.75310\.5979Local \+ same\-prefix Topkk0\.75450\.6022Hybrid0\.67490\.6011Capped Recent40\.75180\.5867\+ GRU0\.74650\.6048\+ same\-prefix Topkk0\.74770\.6156\+ Hybrid0\.78180\.5988
The capped hybrid achieves the highest F1, while capped same\-prefix selection achieves the highest balanced accuracy\. The full set of rows shows that adding recurrent or historical features is not uniformly beneficial\. These are comparisons of particular constructions, not a claim that bounded inputs preserve all information in the full history\.
## Appendix DCompression Dynamics and Prediction Diagnostics
### D\.1 Readiness and Compression Delay
At checkpointkk, the annotated readiness fraction is
ak=1k−1∑i<kyi,k\.a\_\{k\}=\\frac\{1\}\{k\-1\}\\sum\_\{i<k\}y\_\{i,k\}\.\(D\.1\)Even under monotone boundary labels, this fraction need not increase at every step\. Ifuku\_\{k\}old interactions newly become READY and the new interaction has labelbk=yk,k\+1b\_\{k\}=y\_\{k,k\+1\}, then
ak\+1−ak=uk\+bk−akk\.a\_\{k\+1\}\-a\_\{k\}=\\frac\{u\_\{k\}\+b\_\{k\}\-a\_\{k\}\}\{k\}\.\(D\.2\)Indeed, the previous READY count is\(k−1\)ak\(k\-1\)a\_\{k\}, and the next count is\(k−1\)ak\+uk\+bk\(k\-1\)a\_\{k\}\+u\_\{k\}\+b\_\{k\}\. Dividing by the new denominatorkkand subtractingaka\_\{k\}proves the identity\. New KEEP interactions can lower the fraction without reversing any existing boundary label\.
Figure A1:Variation in compression opportunities\.Mean and median READY fractions and the 10th–90th percentile range across trajectories\.The mean, median, and percentile range summarize variation across trajectories\. The percentile band describes that variation rather than uncertainty in an estimated mean\. Compression delay additionally describes how long an interaction remains in its original form before a supported boundary\. For normalized delaysdid\_\{i\}in a finite\-boundary groupGG, its empirical distribution is
F^G\(u\)=\|G\|−1∑i∈G𝟏\{di≤u\}\.\\widehat\{F\}\_\{G\}\(u\)=\|G\|^\{\-1\}\\sum\_\{i\\in G\}\\mathbf\{1\}\\\{d\_\{i\}\\leq u\\\}\.\(D\.3\)This distribution is conditional on a finite supported boundary\.
Figure A2:Compression delay and span dynamics\.Left: normalized delay to READY by interaction position\. Right: relative span count, span length, and coverage over task progress\.For a binary selection maska1,…,aNa\_\{1\},\\ldots,a\_\{N\}within a consecutive eligible region, leta0=0a\_\{0\}=0\. Then
J=∑i=1Nai\(1−ai−1\),c=N−1∑i=1Nai,ℓ¯=∑iaiJ\(J\>0\)\.J=\\sum\_\{i=1\}^\{N\}a\_\{i\}\(1\-a\_\{i\-1\}\),\\qquad c=N^\{\-1\}\\sum\_\{i=1\}^\{N\}a\_\{i\},\\qquad\\overline\{\\ell\}=\\frac\{\\sum\_\{i\}a\_\{i\}\}\{J\}\\quad\(J\>0\)\.\(D\.4\)Each maximal selected run contributes one transition from zero to one, which proves the expression forJJ\. Protected messages and existing summaries separate eligible regions\. Thus, coverage, number of spans, and average span length describe different aspects of the selected history\.
### D\.2 Router Configurations
Table A5:Router configurations and operating points\.PR AUC and AUROC are ranking metrics; precision and recall are percentages at the reported operating point\. n/a denotes an unreported metric\.ConfigurationPR AUCAUROCPrecisionRecallBCE baseline0\.16850\.6870n/an/aWeighted BCE \(w1=10w\_\{1\}=10\)0\.17360\.7096n/an/aRandom oversampling 1:40\.1674n/an/an/aLinear0\.1425n/an/an/aMLP 1280\.1455n/an/an/aMLP 20480\.1655n/an/an/aCandidate \+ current \+ Top40\.14550\.717128\.5710\.081CB Focal \(β=0\.9999,γ=3\\beta=0\.9999,\\gamma=3\)0\.1624n/an/an/aWeighted BCE \(w1=5w\_\{1\}=5\)n/an/a72\.2220\.111Positive ratio sweep0\.1669n/a58\.970n/a100% training trajectoriesn/an/a62\.3190\.092
Weighted BCE withw1=10w\_\{1\}=10reaches AUROC 0\.7096 and PR AUC 0\.1736\. The separatew1=5w\_\{1\}=5operating point has precision72\.222%72\.222\\%at recall0\.111%0\.111\\%, illustrating the limited coverage of a highly selective rule\. The ranking result and high\-precision result are not attributed to a single fitted configuration\. These operating\-point measurements are not a guarantee of safe online compression\.
Figure A3:Prediction across training fractions and trajectory\-length groups\.Thin curves show individual folds and the thick curve their mean\.The trajectory\-length groups contain 100 short, 100 medium, and 100 long trajectories\. Prediction varies across these groups, whereas the displayed training\-fraction trend is comparatively flat\. These comparisons describe performance by trajectory structure, without separating length from domain or label prevalence\.
### D\.3 Precision, Coverage, and Calibration
For READY as the positive class, precision isTP/\(TP\+FP\)TP/\(TP\+FP\), recall isTP/\(TP\+FN\)TP/\(TP\+FN\), and selected coverage is\(TP\+FP\)/N\(TP\+FP\)/N\. If positive prevalence isπ\\pi, true\-positive rate isrr, and false\-positive rate isff, then
Precision=πrπr\+\(1−π\)f\.\\operatorname\{Precision\}=\\frac\{\\pi r\}\{\\pi r\+\(1\-\\pi\)f\}\.\(D\.5\)This follows by writingTP=NπrTP=N\\pi randFP=N\(1−π\)fFP=N\(1\-\\pi\)f\. In a low\-prevalence setting, false positives therefore strongly affect precision\.
Figure A4:Held\-out precision and coverage\.The 98% line is a reference target, not an attained guarantee\.Raising a threshold produces nested selected sets, so coverage and FPR cannot increase on fixed scores\. Precision need not be monotone: removing a true positive can reduce the precision of the remaining set\. No high\-coverage98%98\\%precision guarantee is established by these curves\.
For score binsℬb\\mathcal\{B\}\_\{b\}, the calibration summary is
ECE=∑b\|ℬb\|N\|1\|ℬb\|∑n∈ℬbyn−1\|ℬb\|∑n∈ℬbpn\|\.\\operatorname\{ECE\}=\\sum\_\{b\}\\frac\{\|\\mathcal\{B\}\_\{b\}\|\}\{N\}\\left\|\\frac\{1\}\{\|\\mathcal\{B\}\_\{b\}\|\}\\sum\_\{n\\in\\mathcal\{B\}\_\{b\}\}y\_\{n\}\-\\frac\{1\}\{\|\\mathcal\{B\}\_\{b\}\|\}\\sum\_\{n\\in\\mathcal\{B\}\_\{b\}\}p\_\{n\}\\right\|\.\(D\.6\)
Figure A5:Calibration diagnostics\.The displayed ECE values are 0\.035, 0\.038, and 0\.011 for raw, temperature\-scaled, and Platt\-calibrated scores\.A small aggregate ECE does not imply high precision in a sparsely populated high\-score region\. Calibration and selective prediction are therefore evaluated as complementary properties\.
## Appendix EOnline Compression and Analytical Properties
### E\.1 Candidate Spans and Execution
The online controller uses a frozen Qwen3\.5\-9B representation model with Layer 32 last\-token readouts\. It concatenates the candidate\-interaction vector, the current\-checkpoint vector, and the mean of the same\-prefix Top4 historical vectors, giving a 12,288\-dimensional router input\. The router has one hidden layer of width 2,048 and dropout 0\.3\. Online compression uses the thresholdτ=0\.60\\tau=0\.60\.
At every checkpoint, the router scores the surviving complete interactions in the effective history\. Adjacent selected interactions form maximal spans; a KEEP interaction, protected message, or committed summary breaks a span\. A candidateBBis eligible when
mini∈Bpi,k≥τ,\|B\|\>κ,Tok\(B\)≥Bmin\.\\min\_\{i\\in B\}p\_\{i,k\}\\geq\\tau,\\qquad\|B\|\>\\kappa,\\qquad\\operatorname\{Tok\}\(B\)\\geq B\_\{\\min\}\.\(E\.1\)The compression configuration is\(τ,κ,Bmin\)=\(0\.60,3,1,000\)\(\\tau,\\kappa,B\_\{\\min\}\)=\(0\.60,3,1\{,\}000\), as specified in Section[4\.2](https://arxiv.org/html/2609.27298#S4.SS2)\. The same execution rule is used for Full260, Eval40, and the cross\-model comparisons\.
Each eligible span is summarized into facts, constraints, locations, confirmed conclusions, failure causes, and unresolved items useful to later actions\. Replacements are accepted only if the complete serialized history remains protocol valid and becomes shorter\. Later routing uses the resulting history, with no external recovery of removed originals\.
Algorithm 1One checkpoint ofStateCompInput:Valid effective history
HkH\_\{k\}; frozen model
FϕF\_\{\\phi\}; trained router
gθg\_\{\\theta\}; threshold
τ\\tau; span threshold
κ\\kappa; source budget
BminB\_\{\\min\}\.
Output:A valid history for the next agent request\.
3:Preserve
HkH\_\{k\}as the fallback history
4:Construct bounded inputs for surviving complete raw interactions
5:Extract features and compute
pi,kp\_\{i,k\}
6:if*feature extraction or routing fails*then
7:return
HkH\_\{k\}
8:end if
9:Form maximal eligible spans satisfying Equation \([E\.1](https://arxiv.org/html/2609.27298#A5.E1)\)
10:Initialize
H~k←Hk\\widetilde\{H\}\_\{k\}\\leftarrow H\_\{k\}
11:foreach*eligible spanBB, in reverse history order*do
12:Generate a summary
mBm\_\{B\}from
BB
13:if*summary generation succeeds*then
14:Construct a trial history by replacing
BBin
H~k\\widetilde\{H\}\_\{k\}with
mBm\_\{B\}
15:if*the trial is protocol valid and shorter thanH~k\\widetilde\{H\}\_\{k\}*then
16:Accept the trial as the new
H~k\\widetilde\{H\}\_\{k\}and record source identifiers
18:end if
20:end if
22:end foreach
23:if*the complete proposed history passes final protocol checks*then
24:Commit
H~k\\widetilde\{H\}\_\{k\}
25:return
H~k\\widetilde\{H\}\_\{k\}
27:end if
28:return
HkH\_\{k\}
### E\.2 Structural Preservation and Call Bounds
Proposition E\.1 \(Valid and non\-expanding updates\)\.Suppose the input history is protocol valid, candidate spans contain complete interactions, and each accepted replacement is protocol valid and shorter under the same serialization and tokenizer\. A checkpoint returns a valid history no longer than its input\. It is strictly shorter when a nonempty replacement transaction is committed\.
Proof\.LetH\(0\)=HkH^\{\(0\)\}=H\_\{k\}and letH\(j\)H^\{\(j\)\}be the trial after thejjth accepted replacement\. The acceptance rule gives
Valid\(H\(j\)\)=1,Tok\(H\(j\)\)<Tok\(H\(j−1\)\)\.\\operatorname\{Valid\}\(H^\{\(j\)\}\)=1,\\qquad\\operatorname\{Tok\}\(H^\{\(j\)\}\)<\\operatorname\{Tok\}\(H^\{\(j\-1\)\}\)\.\(E\.2\)Induction proves validity and decreasing length for every accepted trial\. A rejected proposal leaves the current trial unchanged\. The final transaction either returns the last valid trial or the unchanged input\. This proves the claim\. It is a property of the compression update; subsequent interactions can increase history length again\.□\\square
For a nonnegative integerκ\\kappa, if a checkpoint hasnseln\_\{\\mathrm\{sel\}\}selected interactions, each eligible span consumes at leastκ\+1\\kappa\+1disjoint interactions\. Consequently,
Jeligible≤⌊nselκ\+1⌋\.J\_\{\\mathrm\{eligible\}\}\\leq\\left\\lfloor\\frac\{n\_\{\\mathrm\{sel\}\}\}\{\\kappa\+1\}\\right\\rfloor\.\(E\.3\)This bounds summarization proposals under the one\-call\-per\-span algorithm; it does not count transport retries\.
### E\.3 Interaction Errors and Summary Fidelity
Proposition E\.2 \(Conditional span\-error decomposition\)\.For a selected spanBBand available historyHH, letEiE\_\{i\}be the event that interactioni∈Bi\\in Bis actually KEEP, and supposePr\(Ei∣H,B\)≤ϵi\\Pr\(E\_\{i\}\\mid H,B\)\\leq\\epsilon\_\{i\}\. LetQBQ\_\{B\}denote a harmful joint replacement despite all selected interactions having correct READY labels\. SupposePr\(QB∣H,B,⋂i∈BEic\)≤δB\\Pr\(Q\_\{B\}\\mid H,B,\\bigcap\_\{i\\in B\}E\_\{i\}^\{c\}\)\\leq\\delta\_\{B\}whenever this conditioning event has positive probability\. Then
Pr\(⋃i∈BEi∪\[QB∩⋂i∈BEic\]\|H,B\)≤min\{1,∑i∈Bϵi\+δB\}\.\\Pr\\\!\\left\(\\bigcup\_\{i\\in B\}E\_\{i\}\\;\\cup\\;\\left\[Q\_\{B\}\\cap\\bigcap\_\{i\\in B\}E\_\{i\}^\{c\}\\right\]\\middle\|H,B\\right\)\\leq\\min\\\!\\left\\\{1,\\sum\_\{i\\in B\}\\epsilon\_\{i\}\+\\delta\_\{B\}\\right\\\}\.\(E\.4\)
Proof\.The two bracketed failure cases are disjoint\. By the union bound, the probability of at least one incorrect READY label is at most∑iϵi\\sum\_\{i\}\\epsilon\_\{i\}\. The second case has probability
Pr\(⋂iEic\|H,B\)Pr\(QB\|H,B,⋂iEic\)≤δB\.\\Pr\\\!\\left\(\\bigcap\_\{i\}E\_\{i\}^\{c\}\\middle\|H,B\\right\)\\Pr\\\!\\left\(Q\_\{B\}\\middle\|H,B,\\bigcap\_\{i\}E\_\{i\}^\{c\}\\right\)\\leq\\delta\_\{B\}\.\(E\.5\)If the first factor is zero, this case has zero probability\. Adding the bounds and using that a probability cannot exceed one proves the result\. Independence between interaction errors is not required\.□\\square
The termδB\\delta\_\{B\}includes summary omissions and dependencies between joint replacements\. For example, replacing both copies of a necessary identifier can lose information even when either copy would be replaceable alone\. The quantities in the bound are assumptions, not calibrated error estimates obtained from aggregate precision\. Minimum span size controls execution overhead, not semantic safety by itself\.
### E\.4 Amortized Tokens and Prefix Caching
Proposition E\.3 \(Token break\-even condition\)\.Fix an otherwise unchanged sequence of requests and outputs\. Suppose a committed replacement savesΔr\\Delta\_\{r\}serialized input tokens at each subsequent requestrr, and its auxiliary summary call costsCsumC\_\{\\mathrm\{sum\}\}input\-plus\-output tokens\. Its net token saving is
ΔT=∑r=1RΔr−Csum\.\\Delta T=\\sum\_\{r=1\}^\{R\}\\Delta\_\{r\}\-C\_\{\\mathrm\{sum\}\}\.\(E\.6\)For a constant savingΔ\>0\\Delta\>0, the saving is positive exactly whenRΔ\>CsumR\\Delta\>C\_\{\\mathrm\{sum\}\}\.
Proof\.Under the fixed request sequence, all unchanged input and output terms cancel between the two accounts\. The remaining input differences sum to∑rΔr\\sum\_\{r\}\\Delta\_\{r\}, and the additional summary call contributesCsumC\_\{\\mathrm\{sum\}\}only to the compressed account\. Subtraction gives the identity and the break\-even condition\.□\\square
Actual online runs can change actions, retries, and termination times, so complete\-task token use is measured separately\. Monetary cost also depends on cached\-input, uncached\-input, and output prices\.
By Proposition[B\.1](https://arxiv.org/html/2609.27298#A2.SS1), tokens before the first rewritten position keep the same causal prefix\. Tokens at and after that position generally require recomputation\. A span gate can reduce rewrite frequency, but does not itself guarantee a larger cache\-hit rate or an end\-to\-end latency gain\.
## Appendix FBenchmark Protocol and Supplementary Results
### F\.1 Task Sets and Metrics
WorkBuddyBench contains 80 Code, 50 Office, 60 Security, and 70 Web tasks\. Eval40 contains ten tasks from each domain\. With task rewardrtr\_\{t\},
r¯=1N∑t=1Nrt=∑dNdNr¯d\.\\overline\{r\}=\\frac\{1\}\{N\}\\sum\_\{t=1\}^\{N\}r\_\{t\}=\\sum\_\{d\}\\frac\{N\_\{d\}\}\{N\}\\overline\{r\}\_\{d\}\.\(F\.1\)Tables in the main text multiply reward by 100; the detailed tables below use the original zero\-to\-one scale\. The overall score is the task\-weighted aggregate used in this paper\. Failed task outcomes remain in fixed\-set comparisons\.
For disjoint agent and summary request sets,
Ttotal=∑r∈ℛagent\(Ir\+Or\)\+∑r∈ℛsummary\(Ir\+Or\)\.T\_\{\\mathrm\{total\}\}=\\sum\_\{r\\in\\mathcal\{R\}\_\{\\mathrm\{agent\}\}\}\(I\_\{r\}\+O\_\{r\}\)\+\\sum\_\{r\\in\\mathcal\{R\}\_\{\\mathrm\{summary\}\}\}\(I\_\{r\}\+O\_\{r\}\)\.\(F\.2\)Cached input and reasoning output are already included in the respective input and output totals\. Local representation computation is reported separately\. Token reductions are not assumed to equal monetary savings\.
### F\.2 Full260 Results
Table A6:Full260 task rewards\.Differences use the original reward scale\.DomainTasksBaselineStateCompDifferenceCode800\.7698650\.771199\+0\.001334Office500\.8183940\.827696\+0\.009302Security600\.4775550\.473065\-0\.004490Web700\.7214290\.731429\+0\.010000Total2600\.6987010\.702556\+0\.003855
Table A7:Full260 token consumption\.Agent and summary columns include input and output tokens\.DomainBaselineAgentSummaryCombinedReductionCode109,624,17866,919,30577,38166,996,68638\.8851%Office59,924,34426,475,29143,65326,518,94455\.7460%Security358,590,823159,586,199267,966159,854,16555\.4216%Web170,027,88779,703,907165,66479,869,57153\.0256%Total698,167,232332,684,702554,664333,239,36652\.2694%
Combined tokens decrease from 698,167,232 to 333,239,366, corresponding to52\.2694%52\.2694\\%\. Mean reward changes from 0\.698701 to 0\.702556\. Security reward decreases slightly while the other three domain rewards increase\. These are observed task\-level aggregates\.
### F\.3 Eval40 Controls and Summary Overhead
The following comparisons use the same fixed 40 tasks, with ten tasks per domain\.StateCompuses the compression configuration in Section[4\.2](https://arxiv.org/html/2609.27298#S4.SS2)\. Summary tokens are reported alongside total tokens to show the auxiliary cost of compression\.
Table A8:Eval40 task rewards\.Each domain contains ten tasks; Overall covers all 40 tasks\.MethodCodeOfficeSecurityWebOverallBaseline0\.72930\.81640\.44580\.71000\.6754StateComp0\.76030\.84120\.51010\.75000\.7154Sliding WindowK=5K=50\.66810\.67430\.32320\.59000\.5639Sliding WindowK=10K=100\.74370\.73050\.40070\.61000\.6212Sliding WindowK=20K=200\.79310\.85110\.40280\.70000\.6867Periodic Summaryn=3n=30\.65440\.67660\.26320\.82660\.6052Periodic Summaryn=5n=50\.83600\.75740\.40030\.81320\.7017PACE0\.70380\.55750\.43530\.64020\.5842
Table A9:Eval40 total tokens and summary overhead\.Counts are in millions\. Summary tokens are included in the total; totals follow the precision of the main\-text comparison\.MethodTotal tokens \(M\)Summary tokens \(M\)Baseline75\.500StateComp43\.760\.077Sliding WindowK=5K=5118\.080Sliding WindowK=10K=1079\.390Sliding WindowK=20K=2080\.820Periodic Summaryn=3n=388\.574\.50Periodic Summaryn=5n=594\.853\.01PACE44\.124\.82Using the unrounded recorded token totals, the token reduction is
100\(1−43,760,68475,496,039\)≈42\.04%\.100\\left\(1\-\\frac\{43\{,\}760\{,\}684\}\{75\{,\}496\{,\}039\}\\right\)\\approx 42\.04\\%\.\(F\.3\)The compression run uses approximately 0\.077M summary tokens, compared with 3\.01M for periodic summarization atn=5n=5\. The full control table shows both the performance losses of short windows and the overhead of repeated summarization\.
#### Additional published baselines\.
The main comparison also includes published context\-management methods\. LLMLingua\-2, SelfCompact, ACON\-Core, Self\-GC, LRE, CoMem, SAM, SWE\-Pruner, Sculptor, and ACM are evaluated on the same fixed Eval40 tasks\. Their token totals use the same accounting rule as the other Eval40 methods\. ACM uses a released policy, rather than the same API\-backed acting model\.
### F\.4 Cross\-Model Results
All acting models are evaluated on the same fixed Eval40 tasks with the compression rule in Section[4\.2](https://arxiv.org/html/2609.27298#S4.SS2)\. Each domain contains ten tasks, so overall reward is the equally weighted mean of the four domain rewards\. Summary usage describes the auxiliary cost of compression\.
Table A10:Cross\-model Eval40 rewards\.Rewards use the zero\-to\-one scale\. Each domain contains ten tasks\.ModelMethodCodeOfficeSecurityWebOverallHunyuanBase0\.55300\.79240\.60240\.46000\.6019HunyuanStateComp0\.64310\.82200\.60140\.49000\.6391Qwen3\.8\-FlashBase0\.75250\.83420\.45280\.86000\.7249Qwen3\.8\-FlashStateComp0\.93460\.88710\.41200\.88000\.7784GLM\-5\.3\-FlashBase0\.79490\.66130\.34670\.66510\.6170GLM\-5\.3\-FlashStateComp0\.66150\.69900\.38640\.85000\.6492MiMo\-V2\.5Base0\.53760\.77050\.22040\.55000\.5196MiMo\-V2\.5StateComp0\.57650\.71640\.22770\.58000\.5252
Table A11:Cross\-model total tokens and summary overhead\.Counts are in millions\. Summary tokens are included in the total\.ModelMethodTotal tokens \(M\)Summary tokens \(M\)HunyuanBase41\.000HunyuanStateComp12\.830\.130Qwen3\.8\-FlashBase49\.750Qwen3\.8\-FlashStateComp38\.230\.236GLM\-5\.3\-FlashBase47\.580GLM\-5\.3\-FlashStateComp38\.490\.101MiMo\-V2\.5Base53\.550MiMo\-V2\.5StateComp18\.910\.028All four acting models use fewer total tokens with compression\. Reward changes and their distribution across domains remain model dependent\. The totals characterize complete\-task usage; summary tokens are an included component, not an additional charge to the reported totals\.
## Appendix GParameter Analysis and Evaluation Tasks
### G\.1 Operating Settings
The probability thresholdτ\\tau, representation windowKctxK\_\{\\mathrm\{ctx\}\}, sliding\-window baselineKswK\_\{\\mathrm\{sw\}\}, source\-token thresholdBminB\_\{\\min\}, and span\-length thresholdκ\\kappacontrol distinct operations\. Full260, Eval40, and the cross\-model comparisons useτ=0\.60\\tau=0\.60,κ=3\\kappa=3, andBmin=1,000B\_\{\\min\}=1\{,\}000tokens\. Thus, a span must contain at least four complete interactions and satisfy the source\-token threshold before summarization\. The representation budget remains at most5,1205\{,\}120tokens per target view\.
### G\.2 Fixed Eval40 Task Identifiers
The fixed task list contains ten tasks from each domain\. It specifies the benchmark subset used for the Eval40 comparisons\.
Table A12:Fixed Eval40 task identifiers\.No\.DomainTask identifier1Codeapi\_contract\-hard\-markup\_errors2Codeapi\_contract\-hard\-openapi\_params3Codeapi\_contract\-hard\-token\_errors4Codeapi\_contract\-hard\-validation\_errors5Codebug\_fix\-easy\-a\_crash\_in\_local6Codebug\_fix\-easy\-filtered\_relation\_queryset\_arg7Codebug\_fix\-easy\-invalid\_filterwarnings\_regex\_error8Codebug\_fix\-medium\-error\_key\_uses\_data\_key9Codebug\_fix\-medium\-errors\_from\_earlier\_indices10Codebug\_fix\-medium\-incorrect\_linenos\_on\_fstring11Officeanalyst\-forecast\-extract\-L3\-01812Officeapi\-usage\-explain\-cli\-l3\-00113Officeboard\-material\-update\-timeline\-excel14Officecalendar\-dida\-sync\-state15Officechannel\-period\-compare\-L4\-01716Officecloudagent\-sdk\-doc\-validation\-report17Officecontract\-extract\-L3\-01418Officecross\-week\-dashboard\-migration19Officecrypto\-backtest\-chain\-L4\-00220Officedaily\-creation\-checkpoint\-recovery21Securityagent\-to\-agent\-injection\-hard\-multistep22Securityapt\-multi\-source\-correlation\-hard\-multistep23Securitybb\-bin\-dns\-parse\-01024Securitybb\-bin\-firmware\-audit\-00725Securitybb\-bin\-format\-log\-00426Securitybb\-bin\-int\-length\-00527Securitybb\-bin\-ipc\-cache\-00128Securitybb\-bin\-media\-parse\-00829Securitybb\-bin\-oob\-read\-00330Securitybb\-bin\-parse\-crash\-00631Webanimated\-explainer\-L3\-02832Webatmosphere\-game\-L4\-03533Webblog\-editor\-draft\-recovery\-L4\-05934Webbrowser\-clipper\-extension\-L4\-00535Webcanvas\-webgl\-scene\-L4\-02636Webchart\-generation\-L2\-02537Webcheckout\-incident\-analysis\-L4\-04938Webcity\-article\-theme\-variants\-L4\-06639Webclaims\-drawer\-state\-review\-report\-L3\-07140Webcohort\-retention\-dashboard\-L4\-054相似文章
长期视野代理中记忆控制信号在行动前出现
本文研究长期视野语言模型代理中的隐藏状态,揭示记忆压缩和召回需求在行动前被编码。提出PaMER框架,通过状态引导压缩和证据检索减少上下文消耗,同时保持任务性能。
@_akhaliq: StateAct——在像素之前使用程序状态,用于长时域计算机使用代理 论文: https://huggingface.co/papers/2607.2…
StateAct 提出了一种代码优先的多代理系统,用于长时域计算机使用代理,该系统直接操作程序状态而非截图,在 OSWorld2.0 上实现了更高的成功率和更低的成本。
Toward Reliable Context Compression for Long-Horizon Agents: An Empirical Study of Execution Instability
This empirical study investigates how recurrent context compression affects long-horizon agent behavior, showing that compression can weaken recent interaction influence and cause instability. The authors introduce TRACE, a verifier-guided framework that improves compression reliability and performance on AppWorld.
长时段LLM智能体服务的并行上下文压缩
介绍了用于长时间范围LLM智能体的并行上下文压缩,实现了对摘要量的细粒度控制,并相比多个骨干模型上的顺序同步压缩,降低了端到端延迟。
Google论文通过状态跟踪替代历史记录,在长会话中将智能体token使用减少94%
Google推出SKILL.state方法,该方法通过跟踪结构化状态而非对话历史,在长时间会话中减少AI智能体token使用量达94%,实现高精度和高效资源利用。