SWE-MEM: Learning Adaptive Memory Management for Long-Horizon Coding Agents

Shuzheng Gao, Wenhao Zeng, Zhaojian Yu, Jianqiao Wangni, Chaozheng Wang, Kai Cai, Shilin He, Michael R. Lyu


Abstract
Long-horizon software engineering agents often need to manage lengthy and noisy interaction histories under limited context budgets. Existing memory management methods rely on static compression workflows or rigid compression schedules, and often decouple memory decisions from task-solving performance. 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.
Anthology ID:
2026.emnlp-main.1312
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
29855–29881
Language:
URL:
https://aclanthology.org/2026.emnlp-main.1312/
DOI:
Bibkey:
Cite (ACL):
Shuzheng Gao, Wenhao Zeng, Zhaojian Yu, Jianqiao Wangni, Chaozheng Wang, Kai Cai, Shilin He, and Michael R. Lyu. 2026. SWE-MEM: Learning Adaptive Memory Management for Long-Horizon Coding Agents. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 29855–29881, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
SWE-MEM: Learning Adaptive Memory Management for Long-Horizon Coding Agents (Gao et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.1312.pdf