The Research Report
AGORA: Why Token-Level Compression Destroys Agents, and What to Do Instead
The Problem
LLM agents hit a wall around turn 30. On WebShop, the in-context history can exceed 100,000 tokens. Compressing that history is not optional. It is a practical necessity.
But the compressors that work for chatbots do not work for agents. Token-level extractive compressors rank individual tokens by self-information or perplexity, then drop the lowest-scoring ones. This approach dominates single-turn QA and summarization. It collapses completely on agents.
Across 17 environment-backbone-method cells spanning two independent token-level families, every single cell collapsed to mean reward of 0.05 or below. The compressors achieved 1.3x to 13.3x compression. The agents achieved near-zero reward.
Action-Grammar Destruction
The authors name the failure mode: action-grammar destruction.
Tokens that carry action semantics are exactly the ones self-information ranks lowest. Identifiers like search[men's shoes size 10], brackets, action verbs, and click targets are predictable from natural-text context. A general-purpose compressor reliably removes them. The residual is grammatical English. It is ungrammatical agent commands. The environment rejects it.
This is not a hyperparameter problem. Two LLMLingua-2 variants, one off-the-shelf and one retrained on agent data at the 4x target, failed identically. The rank-and-delete paradigm is structurally wrong for agent prompts.
The Diagnosis: Step Granularity
Agents are format-sensitive machines. AgentBench names Invalid Format and Invalid Action as primary termination categories. Meaning-preserving perturbations alone swing accuracy by up to 76 points on in-context learning tasks. Restricting output format degrades reasoning. Template choice can reduce strong models to random-guess level.
A compressor for agent prompts must operate at step granularity. Each retained action-observation pair must stay verbatim. Brackets and identifiers must survive by construction, not by hope.
AGORA: The Design
AGORA stands for Adapter-Grounded Observation-Action Retention Architecture. It is an inference-free step-level compressor with three components.
Structural parser. At each step, the agent trajectory is segmented into role-typed blocks: system, task instruction, past action-observation steps, current observation, and pending assistant turn. A single regex over role markers yields an ordered block list. A deterministic state machine groups them.
Always-keep floor. This layer unconditionally retains the system block, task instruction, current observation, pending assistant turn, and the last 2 recent steps. The floor also absorbs any past step the relevance scorer flags with confidence above 0.9. The floor alone retains mean reward of 0.356 averaged over 99 cells. That is only 0.031 below the full system. The floor carries the bulk of quality retention.
Learned step-relevance scorer. A 125M-parameter RoBERTa classifier scores each past step against the current observation. It outputs the probability that a step is critical. The model is trained on counterfactual next-action-change labels. For each step pair, the authors query the agent backbone 8 times at temperature 1.0, half with the full trajectory and half with the step removed. If removing the step changes the canonicalized next action, the step is labeled critical. This training signal directly asks: does this past step matter for the current decision?
The scorer is a single shared instance across all environments and backbones. No per-cell tuning. One forward pass per step takes about 2 milliseconds. No API call. No LLM toll.
Greedy char-budget fill. Given a target keep ratio of 0.25, the floor consumes part of the budget. The remaining past steps are ranked by relevance score and inserted in descending order until the character budget is full. Surviving steps are reinserted in chronological order. Consecutive dropped steps are replaced by a single elision marker.
The Results
AGORA is the only compared method retaining at least 75% of uncompressed performance in 88 of 99 cells. The lone exception hit 73%.
A four-way component ablation isolates the structural floor as the dominant quality lever. The learned scorer is the source of adaptive end-to-end compression ranging from 1.0x to 11.5x from a single fixed keep ratio. The scorer adds modest incremental quality. Its primary effect is on realized compression range.
Compared methods include token-level baselines (Selective Context, LLMLingua-2, LongLLMLingua), LLM-based compressors (HiAgent, ACON, AgentDiet), and inference-free rules (observation masking, floor-only). AGORA is the only one that hits both quality and speed targets.
Why Inference-Free Matters
LLM-based compressors like HiAgent and ACON invoke a secondary model per step. They preserve quality but pay 8,000 to 126,000 extra tokens per task. For long trajectories paired with expensive backbones, that toll compounds fast.
AGORA's cost advantage concentrates on exactly those cases. A 125M-parameter forward pass at ~2ms per step adds negligible latency. The compressor runs inside the agent loop without external API calls. This makes it practical for production deployments where latency and cost are binding constraints.
Practical Implications for Agent Builders
Stop using token-level compressors on agents. The evidence is unambiguous. Two independent method families, 17 cells, every single one collapses. This is not a marginal failure. It is structural.
Design compressors at step granularity. The unit of decision must be a whole action-observation pair, not a token. Each retained step must stay verbatim. Action grammar must be preserved by construction.
Use structural floors, not just learned scorers. The ablation shows the always-keep floor carries most of the quality. A deterministic rule that pins format-critical and recency-critical content is the dominant lever. The learned scorer adds adaptive compression on top.
Train on counterfactual labels, not extractive faithfulness. The standard training signal for token-level compressors is whether the compressed text faithfully represents the original. That signal is mis-specified for agents. The right question is whether removing a step changes the next action. AGORA's counterfactual label pipeline operationalizes this directly.
Context window discipline is not enough. Even with compression, append-only systems necessarily exceed effective window in finite time. The Root Theorem of Context Engineering proved this formally in March 2026. Compression extends the runway. It does not eliminate the need for architectural solutions like RAG, progressive disclosure, or session boundaries.
The Bigger Picture
AGORA fits into a growing pattern in context engineering: structural preservation beats semantic compression when the consumer is a format-sensitive system. Random documents can improve RAG accuracy by up to 35% while semantically related but non-answer-bearing documents do the most damage. Multi-criteria reranking beats relevance-maximization alone.
Token-level compressors optimize an informativeness axis that is mis-specified for agents. The binding constraint is structural preservation of action grammar. AGORA diagnoses this correctly and builds a compressor that respects it.
The paper was published on arXiv on May 26, 2026. Code and data are open-source at https://github.com/ranranrannervous/agoracompression under the MIT License.
Suggested title: AGORA: Why Token-Level Compression Destroys Agents, and What to Do Instead
Word count: ~1,050
Fact-check notes:
- arXiv ID verified: 2605.26596, published May 26, 2026.
- Authors: Haoran Zhang and Zhaohua Sun, University of Hong Kong.
- GitHub repo verified: https://github.com/ranranrannervous/agoracompression.
- All benchmark numbers (75% in 88/99 cells, 0.05 mean reward collapse, 1.0-11.5x compression, ~2ms/step, 125M parameters, rho=0.25, K_recent=2) are drawn directly from the paper abstract and sections 3-4.
- The 17-cell audit spans Selective Context (6 cells) and LLMLingua-2 (11 cells, off-shelf plus 4x-retrained variant).
- The action-grammar destruction mechanism and the structural-over-semantic pattern are from the paper's related work and discussion sections.
- References to AgentBench, Sclar et al. 2024, Tam et al. 2024, and Liu et al. 2024a are from the paper's citations.
- The Root Theorem of Context Engineering reference is to arXiv paper from March 2026 by Borja Odriozola Schick, previously covered in this newsletter.