让大模型在修软件漏洞时既能规划步骤又能记住过程,减少重复错误。
Coupling Planning with Episodic Memory in LLM Agents for Software Issue Resolution

- 用分层计划与记忆双向联动,动态调整修复策略。
- 在SWE-bench上多解决25个问题,准确率提升5.0个百分点。
- 适合需要长流程推理的代码修复任务,尤其关注可验证性。
用大语言模型(LLM)代理修复真实软件问题是一个长达数十至数百步的修复过程,涵盖探索、假设、实现和验证等多个阶段。成功依赖于基础模型的局部推理能力,以及代理在各阶段中维持动态计划和记忆观察结果的能力。现有仓库级代理通常只强化计划或记忆中的某一方面,导致长轨迹易受过时证据、重复失败修改和基于自我报告而非执行证据的验证影响。我们提出PMCoder,一个将分层阶段计划与情景记忆耦合的缺陷修复代理。这种耦合是双向的:当前计划阶段决定记忆检索,而记忆推导出的轨迹统计信息用于检测卡顿和重新规划。当可用时,问题复现结论以执行证据为基础,确保验证真实性。在SWE-bench Verified上,PMCoder平均比基线多解决25个问题(+5.0个百分点),即使复现门未触发,优势仍持续。进一步的Verified-500评估显示,在Claude Haiku 4.5、DeepSeek-V4-Flash和OpenHands移植版本中均呈现正向提升,至少多解决14个问题(+2.8个百分点)。终端世界官方样本评估表明,该计划-记忆结构具备跨问题报告的迁移能力。消融实验与轨迹分析显示,计划与记忆的耦合优于单一组件,显著降低重复失败操作、空补丁退出和上下文窗口耗尽现象。
原文摘要 · Abstract (English)
Resolving a real software issue with a large language model (LLM) agent is a long repair episode, often tens to hundreds of steps spanning exploration, hypothesis, implementation, and verification. Success depends on both the base model's local reasoning and the agent's ability to maintain an evolving plan and remember observations across phases. Existing repository-level agents typically strengthen planning or memory in isolation, leaving long trajectories vulnerable to stale evidence, repeated failed edits, and verification inferred from the agent's own claims instead of execution evidence. We present PMCoder, an issue-resolution agent that couples a hierarchical phase planner with episodic memory. The coupling is bidirectional: the current plan phase conditions memory retrieval, while memory-derived trajectory statistics inform stuck detection and replanning. When available, issue-reproduction verdicts ground verification progress in execution evidence rather than self-reported completion. On SWE-bench Verified, PMCoder resolves an average of $25$ more cases ($+5.0$pp) than a harness-matched baseline, with gains persisting even where the reproduction gate never fires. Further Verified-500 evaluations show the same positive direction across Claude Haiku 4.5, DeepSeek-V4-Flash, and an OpenHands port, with at least $14$ additional resolved cases ($+2.8$pp). Separately, evaluation on TerminalWorld's official sample suggests that the plan-memory substrate transfers beyond issue reports. Ablation and trajectory analyses show where the gains come from: coupling planning and memory outperforms either component alone and reduces repeated failed actions, empty-patch exits, and context-window exhaustion.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。