一篇论文提出用强化学习+上下文压缩训练长程智能体,在SWE-bench等基准上显著提升开源模型表现,适合关注Agent训练和RL方法的人。
CompactionRL是一种新的强化学习策略,用于训练长程agentic LLM,通过上下文压缩解决有限上下文窗口问题。该方法联合优化任务执行和摘要生成,采用token级损失归一化和跨轨迹广义优势估计,让LLM agent从压缩的长轨迹中学习。基于GLM-4.5-Air模型(106B-A30B),CompactionRL在SWE-bench Verified上达到66.8%的Pass@1,提升7.0点;在Terminal-Bench 2.0上达到24.5%,提升3.1点。基于GLM-4.7-Flash(30B-A3B),Pass@1分别提升5.5和6.8点。该技术已被部署于训练GLM-5.2模型(750B-A40B)的RL流水线。
CompactionRL: Reinforcement Learning with Context Compaction for Long-Horizon Agents
Long-horizon agentic LLMs are increasingly limited by finite context windows, as extended interaction trajectories can exceed the maximum context length before a task is completed. Context compaction offers a natural solution by summarizing previous interaction states and continuing the rollout under a compressed context, but incorporating compaction into reinforcement learning remains underexplored. We propose CompactionRL, a reinforcement learning strategy to train long-horizon agentic LLMs with context compaction. Our approach jointly optimizes task execution and summary generation with token-level loss normalization and cross-trajectory generalized advantage estimation. This design enables the LLM agents to learn from compacted long-horizon trajectories. We train CompactionRL on top of open models and observe consistent performance gains on agentic coding tasks. CompactionRL enables the open GLM-4.5-Air model (106B-A30B) to achieve Pass@1 scores of 66.8% on SWE-bench Verified and 24.5% on Terminal-Bench 2.0, with absolute gains of 7.0 and 3.1 points, respectively. Built upon GLM-4.7-Flash (30B-A3B), CompactionRL improves Pass@1 by 5.5 and 6.8 points, reaching 56.0% on SWE-bench Verified and 20.2% on Terminal-Bench 2.0, respectively. CompactionRL is thus deployed in the RL pipeline for training the open GLM-5.2 model (750B-A40B).