🤖 AI Summary
This work addresses the challenge of long-horizon software engineering tasks for AI agents, which are hindered by limited context windows and inefficient handling of lengthy, noisy interaction histories. Existing approaches lack flexible control over when, what, and how to compress memory, and fail to jointly optimize memory management with problem-solving performance. To overcome these limitations, we propose SWE-MeM, a novel training framework that enables agents to adaptively decide memory compression strategies based on trajectory state, task progress, and remaining context budget. Our approach integrates a memory-aware GRPO algorithm, synthetic trajectories for active memory management, dynamic context-budget-aware compression, and step-level credit assignment to co-optimize memory efficiency and task success. Evaluated on SWE-Bench Verified, our method achieves 43.4% and 60.2% solve rates with 4B and 30B parameter models, respectively, substantially outperforming existing memory management baselines.
📝 Abstract
Long-horizon software engineering agents often need to manage lengthy and noisy interaction histories under limited context budgets. Existing memory management methods typically rely on static compression workflows or impose rigid constraints on compression timing and granularity. Moreover, these approaches fail to jointly optimize memory management and issue resolution capabilities to improve performance while reducing token usage. We present SWE-MeM, a training framework for proactive and on-demand memory management in software engineering agents. SWE-MeM provides a flexible memory tool that lets agents decide when, what, and how to compress based on trajectory state, task progress, and remaining context budget. We train agents with synthesized proactive memory-management trajectories and Memory-aware GRPO, which jointly optimizes memory management and issue resolution through memory-aware trajectory splitting and step-level credit assignment. On SWE-Bench Verified, SWE-MeM achieves 43.4% and 60.2% resolve rate with 4B and 30B models, respectively, outperforming existing memory management baselines in both performance and efficiency.