arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.11403cs.CLcs.AI
收藏

MapCoder:面向竞赛问题求解的多智能体代码生成

MapCoder: Multi-Agent Code Generation for Competitive Problem Solving

Bangladesh University of Engineering and Technology(孟加拉工程技术大学);Qatar Computing Research Institute (QCRI)(卡塔尔计算研究所)

Md. Ashraful Islam, Mohammed Eunus Ali, Md Rizwan Parvez

AI总结:

本文提出 MapCoder 多智能体框架,通过示例回忆、规划、生成与调试四个 LLM 智能体模拟人类程序合成流程,在多个代码基准上取得 pass@1 新最优。

摘要:

代码合成需要深入理解复杂的自然语言问题描述、为复杂算法和数据结构生成代码指令,并成功执行全面的单元测试,因此构成一项重大挑战。尽管大型语言模型(LLM)在自然语言处理方面表现出令人瞩目的熟练程度,但它们在代码生成任务中的性能仍然有限。本文提出一种利用多智能体提示进行代码生成任务的新方法,该方法独特地复现了人类开发者所展现的完整程序合成周期。我们的框架 MapCoder 由四个 LLM 智能体组成,专门设计用于模拟该周期的各个阶段:回忆相关示例、规划、代码生成和调试。在八个具有挑战性的竞赛问题求解和程序合成基准上进行包含多种 LLM 消融和分析的充分实验后,MapCoder 展现出卓越的代码生成能力,在 HumanEval(93.9%)、MBPP(83.1%)、APPS(22.0%)、CodeContests(28.5%)和 xCodeEval(45.3%)上取得新的最先进结果(pass@1)。此外,我们的方法在多种编程语言和不同问题难度下均持续提供优异性能。我们在 https://github.com/Md-Ashraful-Pramanik/MapCoder 开源了该框架。

英文摘要:

Code synthesis, which requires a deep understanding of complex natural language problem descriptions, generation of code instructions for complex algorithms and data structures, and the successful execution of comprehensive unit tests, presents a significant challenge. While large language models (LLMs) demonstrate impressive proficiency in natural language processing, their performance in code generation tasks remains limited. In this paper, we introduce a new approach to code generation tasks leveraging multi-agent prompting that uniquely replicates the full cycle of program synthesis as observed in human developers. Our framework, MapCoder, consists of four LLM agents specifically designed to emulate the stages of this cycle: recalling relevant examples, planning, code generation, and debugging. After conducting thorough experiments, with multiple LLM ablations and analyses across eight challenging competitive problem-solving and program synthesis benchmarks, MapCoder showcases remarkable code generation capabilities, achieving new state-of-the-art results (pass@1) on HumanEval (93.9%), MBPP (83.1%), APPS (22.0%), CodeContests (28.5%), and xCodeEval (45.3%). Moreover, our method consistently delivers superior performance across various programming languages and varying problem difficulties. We open-source our framework at https://github.com/Md-Ashraful-Pramanik/MapCoder.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑