arXiv:2610.41291cs.CLOct 2026

Manuscript Offprint

arXiv:2610.41291

In-Model Context Compression with Agentic Soft Tokens for Long-Horizon LLM Agents

Xuning He, Kai Fan, Runyu Zhang, Binghuan Wang, Yuxiang Zhang, Xue Jiang, Yihong Dong

ABSTRACT

Long-horizon LLM agents play an important role in solving complex and sustained tasks, with ever-growing interaction contexts. However, these accumulated contexts will raise substantial computational cost and obscure key decision-relevant evidence. Existing methods typically train external compressors or context-management agents to rewrite context as shorter hard-token sequences, but such external selection may not align with the LLM's evolving representation and is necessarily lossy. In this paper, we introduce Agentic Soft-Token Compression (ASTC), a training-free compression method using soft tokens within LLM agent for long-horizon tasks. Specifically, ASTC uses the model's native recurrent dynamics to determine the already absorbed information, leveraging the commonly-used hybrid Gated Delta Network (GDN)–attention. It then carries this information forward as agentic soft tokens while retaining exact values as hard tokens. The resulting compact sequence reduces later-layer computation and yields reusable KV caches, extending the savings across the agent's trajectory. Extensive experiments on long-horizon tasks show that ASTC matches or exceeds the uncompressed agent's accuracy with up to 50.68% fewer end-to-end Attention Pairs, while trained compressors require 15.4×−103.7×15.4 \times -103.7 \times more Attention Pairs per successful task. These findings highlight agentic soft tokens as a model-native way to carry absorbed context forward as the task representation evolves.

GitHub Repo: https://github.com/RISE-X-Lab/Agentic-Soft-Token

Correspondence: dongyh@sjtu.edu.cn

1 Introduction

Large language models (LLMs) are increasingly deployed as agents that execute multi-step workflows rather than produce isolated responses (Hsu et al., 2026; Liu et al., 2026a; Dong et al., 2026). Each step appends system instructions, skills, earlier decisions, tool interactions, code, and environmental feedback to the next model call. The resulting context connects decisions across time, so losing an early constraint or observation can trigger an inconsistent action whose effects propagate through the remaining trajectory. Preserving the full context, however, increases prefill and attention computation, enlarges the key-value (KV) cache, and forces relevant evidence to compete with stale or redundant information. Long-horizon agents therefore face the central challenge of controlling this growing cost without disrupting the cross-step information flow required for coherent decisions.

Reducing context under this constraint is not an ordinary summarization problem. Agent context mixes semantic content with exact values. Explanations, code, and repeated observations can become

✉: Corresponding author.

Figure

Figure 1. ASTC in a long-horizon agent and in-model stage sensitivity on AppWorld.

redundant once the acting LLM has integrated their information, whereas identifiers, API arguments, and numerical values may determine later actions and must remain exact. Information that has little effect on the current action may also become decisive several steps later. Such delayed relevance makes one-shot importance estimates unreliable. Compressibility therefore cannot be inferred from length, repetition, or semantic similarity alone. It depends on what the acting LLM has already absorbed, what the current decision requires, and what a future step may need to recover. Because compression recurs as the trajectory grows, each operation must save more computation than it consumes. Effective context compression must therefore compact information already absorbed by the acting LLM, preserve exact or potentially useful evidence as the task evolves, and deliver savings across subsequent decoding and agent steps.

Existing context-compression methods typically rely on training, using either hard-token or soft-token compression. Hard-token methods prune or rewrite text, risking irreversible loss of exact values (Jiang et al., 2023; Pan et al., 2024; Xu et al., 2024a; Kang et al., 2026; Liu et al., 2026b). Soft-token methods preserve continuous representations but require separately trained encoders or compressors (Mu et al., 2023; Chevalier et al., 2023; Ge et al., 2024; Li et al., 2026). More fundamentally, separately trained compressors create a model-taste gap. The information they learn to preserve may not match what the acting LLM has already absorbed or will need later. This motivates an in-model approach that uses the acting LLM's recurrent state to determine compressibility and carries absorbed information forward as agentic soft tokens.

In this paper, we introduce Agentic Soft-Token Compression (ASTC), a training-free approach that uses the acting LLM's own computation to decide what its growing context must retain. The early layers have read the full context and the later layers would otherwise continue to process every original token. Figure 1 places this boundary within a continuing agent workflow and shows how the choice of compression stage changes task accuracy and workload. In hybrid Gated Delta Network (GDN)–attention models (Yang et al., 2025), ASTC examines native recurrent updates and checks whether the retained state can recover a token's contribution. It keeps exact values explicit as hard tokens and carries eligible content forward as agentic soft tokens. The shorter sequence reduces attention work for the current prediction and creates smaller KV caches that remain reusable as the agent continues. Each compression decision is therefore informed by what the model has already absorbed, and its benefit extends across the trajectory.

Across diverse long-horizon tasks, ASTC maintains task quality close to or above the uncompressed model while reducing end-to-end Attention Pairs by up to 50.68%. Preserving exact values avoids the sharp accuracy loss seen when protection is removed, while the compact cache continues to save attention work over later decisions with only small changes in action distributions. The same training-free criterion extends beyond tool observations, matching uncompressed accuracy with 24.52% fewer Decode KV interactions under full-history compression and reducing workload in additional long-context and code-repair tasks. ASTC combines the highest task accuracy with the lowest Attention Pairs per successful task, a 15.4×−103.7×15.4\times-103.7\times advantage over trained compressors.

Our contributions are summarized as follows:

  • We identify the core challenge of long-horizon compression as reducing context cost without losing

future-relevant evidence or diverging from the acting LLM's task representation.

  • We introduce ASTC, a training-free method that uses native recurrent dynamics to retain exact values as hard tokens and carry absorbed content forward as soft tokens with reusable compact KV caches across subsequent agent steps.

  • We bound trained-compressor objective mismatch, establish conditions under which ASTC has lower next-token distortion than equal-length hard-token representations, and quantify attention savings from cache reuse.

  • Across long-horizon tasks, ASTC achieves comparable or better accuracy with up to 50.68% fewer end-to-end Attention Pairs and a 15.4×–103.7× advantage in end-to-end Attention Pairs per successful task over trained compressors.

References (31)