RL with context compaction trains long-horizon agents

CompactionRL jointly optimizes task execution and summary generation, enabling LLMs to learn from compacted trajectories.

PaperTop Universitycs.LGarXiv:2607.05378v1
Yujiang Li · Zhenyu Hou · Yi Jing · Jie Tang · Yuxiao Dong

Tsinghua University

Research Digest··2 min read
Li et al. propose CompactionRL, a reinforcement learning method that trains LLM agents to perform long-horizon tasks by compressing interaction histories. Applied to open models, it yields consistent gains on code agent benchmarks, with GLM-4.5-Air reaching 66.8% Pass@1 on SWE-bench Verified.

What they did

The authors introduce a reinforcement learning (RL) strategy that incorporates context compaction — summarising past interaction states — into the training loop for LLM-based agents. They modify the RL objective with token-level loss normalization and cross-trajectory generalized advantage estimation, so the agent learns both task execution and summary generation jointly. They trained CompactionRL on top of pretrained open models GLM-4.5-Air (106B parameters, 30B active) and GLM-4.7-Flash (30B parameters, 3B active), evaluating on SWE-bench Verified and Terminal-Bench 2.0, two code agent benchmarks requiring long-horizon planning and execution.

Key findings

  • GLM-4.5-Air with CompactionRL achieves 66.8% Pass@1 on SWE-bench Verified, an absolute gain of 7.0 points over the base model.
  • On Terminal-Bench 2.0, GLM-4.5-Air improves by 3.1 points to 24.5% Pass@1.
  • GLM-4.7-Flash with CompactionRL reaches 56.0% Pass@1 on SWE-bench Verified (+5.5 points) and 20.2% Pass@1 on Terminal-Bench 2.0 (+6.8 points).
  • The method is already deployed in the training pipeline for the larger GLM-5.2 model (750B parameters, 40B active).

Why it matters

Context window limits are a core bottleneck for agentic LLMs in long-horizon tasks. CompactionRL provides a principled way to incorporate compaction into the RL training objective, enabling agents to handle extended trajectories without truncation. The demonstrated gains on two challenging benchmarks suggest this approach can scale to larger models and real-world agentic applications.

Caveats

The experiments use model families from a single lab (GLM series), so generalizability to other architectures is not tested. The paper does not report on potential quality degradation from summary generation or on compute costs. It is unclear whether the performance gains are additive with other RL improvements or orthogonal.

§
newspaper

Research Digest

Articles published under the Zotpaper byline are synthesized from multiple source publications by our AI editor and reviewed by our editorial process. Each story combines reporting from credible outlets to give readers a balanced, comprehensive view.