CompactionRL: Reinforcement Learning with Context Compaction for Long-Horizon Agents
On the map: LLM agents and tool use → Reinforcement learning for LLM agents
Abstract (arXiv)
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-segment 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-A12B) to achieve Pass@1 scores of 66.4% on SWE-bench Verified and 26.2% on Terminal-Bench 2.0, exceeding the base model under inference-time compaction by 6.6 and 4.9 points, respectively. Built upon GLM-4.7-Flash (30B-A3B), CompactionRL improves Pass@1 by 5.5 and 6.7 points against the base model, reaching 56.0% on SWE-bench Verified and 20.2% on Terminal-Bench 2.0. CompactionRL is thus deployed in the RL pipeline for training the open GLM-5.2 model (750B-A40B).
Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). Placed in Reinforcement learning for LLM agents, one of 16 directions in LLM agents and tool use. Builds on 33 of its 41 references that are in the map. First posted on arXiv 6 Jul 2026.
Builds on
33 of 41 references.
Closest ancestors · 1
Same direction, newest first
Other references · 32
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2025Qwen3 Technical Reportcited by 8,195
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,500
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2025DAPO: An Open-Source LLM Reinforcement Learning System at Scalecited by 2,678
- 2015High-Dimensional Continuous Control Using Generalized Advantage Estimationcited by 1,916
20 more
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,722
- 2023LongBench: A Bilingual, Multitask Benchmark for Long Context Understandingcited by 1,378
- 2023MemGPT: Towards LLMs as Operating Systemscited by 1,295
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,270
- 2022Solving math word problems with process- and outcome-based feedbackcited by 871
- 2025Group Sequence Policy Optimizationcited by 788
- 2026Terminal-Bench: Benchmarking Agents on Hard, Realistic Tasks in Command Line Interfacescited by 515
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 443
- 2025VAPO: Efficient and Reliable Reinforcement Learning for Advanced Reasoning Taskscited by 281
- 2023LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Modelscited by 279
- 2025MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agentscited by 226
- 2025Scaling Long-Horizon LLM Agent via Context-Foldingcited by 136
- 2025ReSum: Unlocking Long-Horizon Search Intelligence via Context Summarizationcited by 132
- 2025What's Behind PPO's Collapse in Long-CoT? Value Optimization Holds the Secretcited by 95
- 2025T1: Advancing Language Model Reasoning through Reinforcement Learning and Inference Scalingcited by 77
- 2025TreeRL: LLM Reinforcement Learning with On-Policy Tree Searchcited by 75
- 2025Scaling LLM Multi-turn RL with End-to-end Summarization-based Context Managementcited by 51
- 2025MobileRL: Online Agentic Reinforcement Learning for Mobile GUI Agentscited by 43
- 2025SWE-Dev: Building Software Engineering Agents with Training and Inference Scalingcited by 24
- 2026Learning Agent-Compatible Context Management for Long-Horizon Taskscited by 12
Built on by
Citing papers per year: 2026: 8.
8 papers.
- 2026Occamy-1.0: Open Pareto-frontier 35B Intelligence for Co-workcited by 3
- 2026Rethinking Critic Learning in PPO: Understanding and Mitigating Value Flatteningcited by 1
- 2026KV-streams for Efficient Compaction in Agentic Reinforcement Learningcited by 1
- 2026AgentOmnia: Scaling Agentic Models for Full-Scenario Applicationscited by 0
- 2026Coding Agent Memory Post-training: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via Reinforcement Learningcited by 0
- 2026Continuous Context Managementcited by 0
- 2026Context Language Modelscited by 0
- 2026AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agentscited by 0
- 2026AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents1 Oct 2026
- 2026Context Language Models29 Sep 2026
- 2026KV-streams for Efficient Compaction in Agentic Reinforcement Learning28 Sep 2026
- 2026Continuous Context Management28 Sep 2026
- 2026Coding Agent Memory Post-training: Unlocking the Memory Potential of Pre-trained File Operations for Long-Horizon Tasks via Reinforcement Learning28 Sep 2026
- 2026Rethinking Critic Learning in PPO: Understanding and Mitigating Value Flattening16 Sep 2026
- 2026Occamy-1.0: Open Pareto-frontier 35B Intelligence for Co-work4 Sep 2026
- 2026AgentOmnia: Scaling Agentic Models for Full-Scenario Applications25 Jul 2026
Similar, not cited
Close in wording, no citation either way
- 2026Beyond Reward Engineering: A Data Recipe for Long-Context Reinforcement Learning
- 2025FoldAct: Efficient and Stable Context Folding for Long-Horizon Search Agents
- 2026Act More, Decide Less: Skill-Guided Adaptive Action Chunking for Long-Horizon LLM Agents
- 2026RAPO: Expanding Exploration for LLM Agents via Retrieval-Augmented Policy Optimization
- 2025The Landscape of Agentic Reinforcement Learning for LLMs: A Survey
- 2025Guiding Exploration in Reinforcement Learning Through LLM-Augmented Observations
- 2026Agentic ESOpt: Fine-Tuning Long-Horizon LLM Agents with Minimal GPU Requirements
- 2026Parallel Context Compaction for Long-Horizon LLM Agent Serving