[论文解读] Your Code Agent Can Grow Alongside You with Structured Memory
MemCoder 通过将历史提交结构化为记忆并使用自我改进,实现持续的人机共进化,在 SWE-bench Verified 上达到 SOTA 性能,并将 DeepSeek-V3.2 的解决率提升至 77.8%。
While "Intent-oriented programming" (or "Vibe Coding") redefines software engineering, existing code agents remain tethered to static code snapshots. Consequently, they struggle to model the critical information embedded in the temporal evolution of projects, failing to leverage the "reasoning trajectories" implicit in past successful practices. This limitation results in rigid behavioral logic and a lack of autonomous adaptability, ultimately hindering their ability to tackle complex, repository-level problems. To bridge this static-dynamic mismatch, we propose MemCoder, a framework designed to enable continual human-AI co-evolution. MemCoder first structures historical human experience to distill latent intent-to-code mappings from past commits. It then employs a self-refinement mechanism driven by verification feedback to correct agent behavior in real-time. Crucially, an experience self-internalization mechanism is introduced to crystallize human-validated solutions into long-term knowledge, thereby supporting sustained evolution. Experimental results on SWE-bench Verified demonstrate that MemCoder not only achieves State-of-the-Art (SOTA) performance but also delivers a 9.4% improvement in resolved rate over the general foundation model DeepSeek-V3.2. These findings indicate that equipping agents with the capability to co-evolve with humans via project history and real-time feedback effectively unlocks the potential of general models in complex software engineering tasks.
研究动机与目标
- 识别仓库级任务中静态代码代理的局限性以及持续人机共进化的需求。
- 提出 MemCoder 将历史开发者经验结构化为记忆,并实现执行时的 refinements 与对解法的长期内部化。
- 证明利用结构化记忆与反馈可以在 SWE-bench Verified 上优于强基线的表现。
- 展示人类验证的知识可以被内化以在跨项目的代理演化中持续提升。
提出的方法
- 将 MemCoder 作为三阶段框架: (1) 从历史提交构建结构化记忆进入记忆条目,捕捉潜在的意图到代码映射;(2) 通过 Refining Sub-agent 进行情境感知的双阶段检索与执行时自我改进;(3) 将经人类验证的解法内化到长期记忆中,闭合共进化循环。
- 将经验表示为记忆条目 m_i = (o_i, c_i, k_i, p_i, r_i, s_i),通过 LLM 与生成器提示 P_gen 从提交中提炼。
- 使用两阶段检索:(a) 对嵌入记忆的快速近似最近邻搜索;(b) 使用 Cross-Encoder 重新排序以得到最终相关性。
- 使 Dynamic self-refinement 通过 Refining Sub-agent 实现,其在给定 p、执行轨迹、反馈和检索到的记忆条件下生成测试代码 t 与验证清单 l。
- 通过 f_intern 将经过验证的经验内化到记忆中,更新 M 以添加新记忆条目并实现长期知识增长。
- 在 SWE-bench Verified 上评估 MemCoder,以上下文为 GPT-5.2 为骨干(并以 DeepSeek-V3.2 进行确认),并与最前沿方法对比,进行消融以评估各模块贡献。

实验结果
研究问题
- RQ1MemCoder 的结构化记忆和自我改进是否能在仓库级代码补丁生成中优于静态代码代理?
- RQ2记忆的质量和组织如何影响基于 LLM 的代码代理的检索、推理与执行?
- RQ3动态自我改进与记忆内化对代理在多轮迭代中的长期性能有何影响?
- RQ4人类验证的解法内化是否会随时间带来持续的提升?
主要发现
| 方法 | 设置 | 已解决(%) |
|---|---|---|
| MemCoder + GPT-5.2 | pass@ 2 | 83.8 (419) |
| MemCoder + GPT-5.2 | pass@ 1 | 78.8 (394) |
| MemCoder + DeepSeek-V3.2 | pass@ 1 | 77.8 (389) |
| OpenHands + Claude Opus 4.5 | pass@ 3 | 77.6 (388) |
| OpenHands + Claude Sonnet 4.5 | pass@ 3 | 74.6 (373) |
| OpenHands + GPT-5.2 | pass@ 3 | 74.4 (372) |
| OpenHands + Gemini 3 pro | pass@ 3 | 70.4 (352) |
- MemCoder 在 SWE-bench Verified 上达到 SOTA 性能,GPT-5.2 的表现达到与顶级方法相当的水平。
- 在 SWE-bench Verified 上使用 MemCoder 结合 GPT-5.2,pass@2 的解决率为 83.8%,pass@1 为 78.8%(相对于基线)。
- MemCoder 与 GPT-5.2 的表现优于通用模型如 DeepSeek-V3.2,在论文背景中实现了 83.8% 对比 68.4% 的提升。
- 消融研究显示三大模块(提交检索 CR、经验表示 ER、动态自我改进 DSR)均有贡献,其中 CR 贡献最大。
- 结构化记忆相较于原始提交能带来稳健提升,验证了标准化、面向代理的记忆表示的重要性。
- 检索颗粒度和数量存在权衡;中等初始 top-k 与受控检索可获得最佳性能,避免噪声和收益递减。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。