🛰️ Daily AI Frontier
‹ back to 2026-10-03

AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents

arXiv cs.CL LLM Agents Xuan Zhang, Longtao Zheng, Cunxiao Du, Bo An, Xin Dong 2026-10-01

TL;DR - AutoCompact trains coding agents to decide when and how to compact stale context during long software-engineering tasks. It improves task completion without relying solely on larger context windows or overflow-triggered compaction.

  • Training data is generated by correcting flawed compaction decisions, summaries, and post-compaction actions before trajectories continue.
  • Supervised fine-tuning is followed by reinforcement learning that jointly optimizes coding and context compaction using task-success rewards.
  • AutoCompact raises pass rates by 9.2 percentage points on SWE-bench Verified and 5.0 points on SWE-PolyBench Verified versus the base model.
  • Gains persist across tested inference budgets with both a non-overflowing 256K context window and a 16K window using fallback compaction.

view merged work →