让AI写代码时能记住并复用过去修复经验,提升调试效率。
MemoCoder: Automated Function Synthesis using LLM-Supported Agents
- 构建可积累修复知识的多智能体系统,支持持续学习。
- 在三个基准测试中,通过率最高提升14.5%。
- 适合需要反复调试和长期优化的开发者使用。
随着GitHub Copilot等大语言模型的广泛应用,开发者越来越多地依赖AI辅助生成代码。尽管大模型能生成语法正确的解决方案,但在需要迭代调试、错误处理或适应多样问题结构的任务中表现不佳。现有方法如微调或自修复策略要么需高昂重训练成本,要么缺乏知识积累与复用机制。为此,我们提出MemoCoder,一个支持协作求解与持久学习的多智能体框架。核心是修复知识集,用于存储成功修复方案并支持未来检索。中心导师智能体通过识别重复错误模式,优化高层修复策略,提供新颖的监督角色以引导自修复循环。我们在MBPP、HumanEval和LiveCodeBench三个公开基准上评估了MemoCoder,涵盖不同复杂度的问题。实验结果表明,其在零样本提示和自修复策略基础上均有显著提升,Pass@10提升3.1%至12.1%,Pass@50提升1.4%至14.5%,证明其在迭代优化与知识引导代码生成方面的有效性。
原文摘要 · Abstract (English)
With the widespread adoption of Large Language Models (LLMs) such as GitHub Copilot and ChatGPT, developers increasingly rely on AI-assisted tools to support code generation. While LLMs can generate syntactically correct solutions for well-structured programming tasks, they often struggle with challenges that require iterative debugging, error handling, or adaptation to diverse problem structures. Existing approaches such as fine-tuning or self-repair strategies either require costly retraining or lack mechanisms to accumulate and reuse knowledge from previous attempts. To address these limitations, we propose MemoCoder, a multi-agent framework that enables collaborative problem solving and persistent learning from past fixes. At the core of MemoCoder is a Fixing Knowledge Set, which stores successful repairs and supports retrieval for future tasks. A central Mentor Agent supervises the repair process by identifying recurring error patterns and refining high-level fixing strategies, providing a novel supervisory role that guides the self-repair loop. We evaluate MemoCoder across three public benchmarks -- MBPP, HumanEval, and LiveCodeBench -- spanning a range of problem complexities. Experimental results show that MemoCoder consistently outperforms both zero-shot prompting and a Self-Repair strategy, with improvements ranging from 3.1% to 12.1% in Pass@10 and from 1.4% to 14.5% in Pass@50, demonstrating its effectiveness in iterative refinement and knowledge-guided code generation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。