ARSM: Auto-Regressive State Machine for Agentic Reasoning Compression
Authors: Xiafeng Man, Siyuan Ye, Xiaosong Ma
Organizations: College of Future Information Technology Fudan University Shanghai, China · Department of Computing The Hong Kong Polytechnic University Hong Kong, China
While Large Language Model (LLM)-based agents demonstrate strong capabilities in long-horizon tasks by interleaving reasoning with external environment interactions, the continuous accumulation of context rapidly creates a critical memory bottleneck. Existing memory compression methods rely on task-specific optimization or external auxiliary models, introducing significant computational overhead. Furthermore, the resulting compressed representations tend to lose structured relationships, leading to information dilution, attention collapse, and degraded decision consistency. To address these limitations, we propose Auto-Regressive State Machine (ARSM), a lightweight training-free framework that enables in-situ reasoning compression through structured state evolution. ARSM introduces two key components: (i) a trajectory abstraction mechanism that reorganizes interaction histories into compact Hypothesis-Action-Result (HAR) micro-chains; (ii) a dynamic state machine that regulates hierarchical memory through atomic operations and a compression-control parameter. These components are unified within an auto-regressive, self-compressive generation space, where each model output jointly performs external action execution and internal state updates. We evaluate ARSM on Webshop, Multi-Objective Multi-Hop QA, and SWE-Bench Lite datasets. Experimental results show that ARSM maintains the task performance while simultaneously reducing token consumption, offering a practical, cost-effective route toward scalable autonomous agents for long-horizon tasks.
Figures & tables
Figure 1: Overview of the dual-loop architecture. It contains two cyclical processes: (i) execution loop, which manages direct interactions with external tools and feeds back environmental output; and (ii) state evolution loop, which synchronizes agent’s cognition with ARSM. The Auto-Regressive Self-Compressive Space acts as a unified generation space, dispatching tool-call action to the environment and evolution metadata to drive ARSM’s inner state update: Statet−1→Statet .
Figure 2: Workflow of trajectory abstraction. The agent performs in-situ compression: previous raw observations are evaluated and distilled into concise results.
Figure 3: State transition mechanism. The model’s structured generation space is parsed to yield a discrete routing signal ut , mapping to the branches. Targeted atomic operators are then dynamically applied to update their respective layers, while unaffected subspaces remain frozen.
Method
Training-Free
Self-Contained
Plug-and-Play
Generality
Search-R1
× (RL)
✓
×
× (QA)
MEM1
× (RL)
× (RAG)
×
∘
ContextBudget
× (RL)
✓
×
∘
Agent-FLAN
× (SFT)
✓
×
∘
Mini SWE-Agent
✓
✓
✓
× (Code)
SE-Agent
✓
✓
✓
× (Code)
Table 1: Comparison of training costs, structural dependencies, and generalizability across methods. “ ∘ ” indicates that the generality requires task-specific training.
Method
Reward ↑
Peak Token (k) ↓
Total Token (k) ↓
Qwen2.5-7B-Instruct
0.2858
5.41 ± 2.40
63.24
Agent-FLAN-7B (SFT)
0.2342
5.84 ± 1.61 ( ↑ 7.9%)
63.26 ( ↑ 0.03%)
MEM1-Webshop (Qwen, RAG+RL)
0.1528
1.55 ± 0.14 ( ↓ 71%)
21.82 ( ↓ 65%)
ARSM (Qwen-7B, ρ=0.3 )
0.4906
3.61 ± 0.87 ( ↓ 33%)
21.46 ( ↓ 66%)
ARSM (Qwen-7B, ρ=0.5 )
0.4641
3.01 ± 0.47 ( ↓ 44%)
23.11 ( ↓ 63%)
ARSM (Qwen-7B, ρ=0.7 )
0.4186
2.51 ± 0.23 ( ↓ 54%)
20.88 ( ↓ 67%)
Table 2: Performance on WebShop.
Method
ΣEM↑
ΣF1↑
Peak Token (k) ↓
Total Token (k) ↓
Qwen2.5-14B-Instruct
0.567
0.703
3.84
N/R
Search-R1 (RL)
0.009
0.011
2.09 ( ↓ 46%)
N/R
MEM1-QA (14B, truncate)
0.44
0.50
1.19 ( ↓ 69%)
N/R
ContextBudget 1 1 1 ContextBudget reports only the context budget; therefore, we use it as its peak token usage. (30B, w/o RL)
0.17
N/R
8.00 ( ↑ 108%)
N/R
ARSM (14B, ρ=0.3 )
1.85
2.15
0.78 ( ↓ 80%)
55.06
ARSM (14B, ρ=0.5 )
1.87
2.30
0.81 ( ↓ 79%)
54.09
Table 3: Performance on Multi-Objective Multi-Hop QA (16-Objective). N/R denotes results that were not reported in the original work.
Method
Qwen3.5-9B
Qwen3.5-27B
Pass@1 ↑
Pass@5 ↑
Token (M) ↓
Pass@1 ↑
Token (M) ↓
Mini SWE-Agent
26.6%
47.5%
6.57
51.7%
1.74
SE-Agent 2 2 2 We were unable to complete the evaluation for SE-Agent; its complex system prompts and tool-calling requirements overwhelmed the models, consistently resulting in format errors or empty patches. (Evolution)
15.0%
N/A
N/A
N/A
N/A
SWE-Pruner (Auxiliary)
40.7%
58.7%
2.29 ( ↓ 65%)
45.0%
2.37 ( ↑ 36%)
ARSM ( ρ=0.1 )
29.7%
46.67%
2.40 ( ↓ 63%)
46.5%
0.92 ( ↓ 47%)
ARSM ( ρ=0.5 )
26.2%
44.5%
2.05 ( ↓ 69%)
46.0%
0.84 ( ↓ 52%)
Table 4: Performance on SWE-Bench Lite.
Figure 4: Efficiency analysis on SWE-Bench Lite using Qwen3.5-27B. It illustrates the distribution of tokens and interaction turns. Our ARSM ( ρ=0.5 ) consistently shifts the distribution towards the left, demonstrating higher efficiency compared to baselines.
Figure 5: Performance and efficiency comparison across different ARSM compression-control parameter ( ρ ) and baselines using Qwen3.5-27B. ARSM drastically reduces prompt token usage compared to SWE-Agent and SWE-Pruner across all evaluated compression rates.
Routing Signal
Ongoing
Milestone
Failure
Success
Percentage (%)
76.34
8.99
9.17
5.50
Table 5: Distribution of routing signals on SWE-Bench Lite, Qwen3.5-9B.
Method
HAR
SM
Reward ↑
Peak Tokens (k) ↓
Total Tokens (k) ↓
Plain Summary
×
×
0.3305
3.63 ± 0.84
44.71
Structured Summary
×
×
0.1321
1.37 ± 0.10
18.44
HAR-only
✓
×
0.4240
3.18 ± 1.86
28.92
SM-only
×
✓
0.3178
2.74 ± 0.23
24.18
ARSM ( ρ=0.5 )
✓
✓
0.4899
2.97 ± 0.45
22.84
Table 6: Trajectory summarization and state machine (SM) evolution on 200 Webshop instances. It highlights the complementary roles of HAR abstraction and dynamic state evolution in balancing task performance and token efficiency.
Metric
Score ↑
Interpretation
State Fidelity
76.1%
Factual faithfulness of compressed states
State Sufficiency
81.4%
Retention of information needed later
Routing Correctness
73.2%
Correctness of routing signals
Trajectory Coherence
72.5%
Global consistency across the trajectory
Table 7: Trajectory-level evaluation of ARSM state updates and routing decisions on 100 WebShop trajectories with ρ=0.5 . Higher scores indicate better performance.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 6: Efficiency analysis on SWE-Bench Lite using Qwen3.5-9B.
Figure 7: Performance and efficiency comparison across different compression-control parameters ( ρ ) and baselines using Qwen3.5-9B.
Figure 8: Intersections of resolved SWE-Bench Lite instances on Qwen3.5-9B model.
Figure 9: Intersections of resolved SWE-Bench Lite instances on Qwen3.5-27B model.
Model
Union Solved
Solved by All ρ
Long-Tail Coverage
Qwen3.5-9B
142
25
48 cases / 18 patterns
Qwen3.5-27B
190
48
94 cases / 90 patterns
Appendix
Table 8: Solved-set overlap of ARSM across different ρ settings.
Instance
ρ=0.2
ρ=0.5
ρ=0.8
django__django-16408
151
300
207
Appendix
Table 9: Trajectory length comparison under different compression-control parameters.
ρ=0.2
ρ=0.5
ρ=0.8
Recent raw interaction remains broad and preserves more direct traces of earlier file-reading failures, exploratory inspection, and repeated attempts to understand the relation structure around FilteredRelation.
Recent raw interaction is still available, but it is more selective; repeated low-value inspection is progressively displaced by folded state, and the retained raw messages are increasingly concentrated on specific subproblems such as join reuse and multi-level relation resolution.
Recent raw interaction is narrower still; the visible raw context is more sharply localized to the current debugging hypothesis, while earlier exploration is no longer exposed directly and instead survives primarily through structured memory.
Appendix
Table 10: Qualitative comparison of recent raw memory. As ρ increases, the raw interaction surface becomes more selective and more localized to the current subproblem.
ρ=0.2
ρ=0.5
ρ=0.8
# Pitfall - The file-reading commands are producing malformed output; need a more reliable reading method. - Need to use grep or targeted inspection to locate FilteredRelation first. - The problem likely concerns how filtered relation paths are resolved in the ORM.
# Pitfall - The fix needs to be in setup_joins so that existing joins are reused when the field is already part of a FilteredRelation path. - The single-level fix is insufficient; nested paths such as tournament_pool. tournament require the second-level relation to use the correct join. - The necessary information may need to be propagated through the relation metadata structure rather than patched only at the surface.
# Pitfall - The current fixes address part of the join path but still cache the intermediate object on the wrong model. - The issue appears deeper in how nested filtered relations are represented in the relation chain. - Submission may need to avoid unrelated test edits and focus on source-level correction only.
Appendix
Table 11: Representative internal-state excerpts. As compression increases, more of the long-range reasoning trace is preserved through structured pitfalls instead of direct transcript replay.
Large language models (LLMs) excel at complex reasoning, yet their efficiency is limited by the surging cognitive overhead of long thought traces. In this paper, we propose LightThinker, a method that enables LLMs to dynamically compress intermediate thoughts into compact semantic representations. However, static compression often struggles with complex reasoning where the irreversible loss of intermediate details can lead to logical bottlenecks. To address this, we evolve the framework into LightThinker++, introducing Explicit Adaptive Memory Management. This paradigm shifts to behavioral-level management by incorporating explicit memory primitives, supported by a specialized trajectory synthesis pipeline to train purposeful memory scheduling. Extensive experiments demonstrate the framework's versatility across three dimensions. (1) LightThinker reduces peak token usage by 70% and inference time by 26% with minimal accuracy loss. (2) In standard reasoning, LightThinker++ slashes peak token usage by 69.9% while yielding a +2.42% accuracy gain under the same context budget for maximum performance. (3) Most notably, in long-horizon agentic tasks, it maintains a stable footprint beyond 80 rounds (a 60%-70% reduction), achieving an average performance gain of 14.8% across different complex scenarios. Overall, our work provides a scalable direction for sustaining deep LLM reasoning over extended horizons with minimal overhead.
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 propose State Conditioned Compression (StateComp), a framework that determines when historical interactions can be safely compressed according to the current agent state. StateComp constructs 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 that StateComp reduces total agent and summarization tokens by 52.27% while maintaining task performance, and achieves a 12.67-fold speedup in representation extraction.
Mingxuan Wang, Hongyue Chen, Yinglong Guo +6
TierFlow Team · Gaoling School of Artificial Intelligence, Renmin University of China · Tsinghua University
Long-horizon agentic reasoning requires large language models to act over long interaction histories containing thoughts, tool calls, observations, and partial conclusions. The challenge is not merely that these histories grow long, but that information needed for the current decision may be scattered across distant steps and only become relevant later. Existing approaches address this difficulty by truncating the interaction history, compressing it into shorter surrogates, or retrieving selected parts of it for reuse, but they do not explicitly model how access to past interaction should adapt to the agent's evolving state. We instead cast long-horizon reasoning as a problem of state-adaptive memory. To this end, we propose State-Adaptive Memory~(SAM), a standalone framework that consolidates ongoing interaction into compact memory cues while preserving raw trajectory pages for intent-driven recall. These cues are not treated as replacements for history; rather, they serve as lightweight handles that allow the agent to reconstruct temporally distant information according to its current needs, without retraining the underlying backbone. We further optimize the memory module through expert-guided supervision and reinforcement learning, aligning it with trajectory-level utility. Across BrowseComp, BrowseComp-ZH, WideSearch, and HLE, SAM consistently outperforms strong baselines over diverse agent backbones. Our results suggest that explicit memory modeling provides a simple and effective foundation for long-horizon agentic reasoning.
Yuyang Hu, Hongjin Qian, Shuting Wang +5
GSAI, Renmin University of China · Beijing Academy of Artificial Intelligence