MapCoder: Multi-Agent Code Generation for Competitive Problem Solving

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

arXiv:2405.11403 · 2026-07-27 공개 · arXiv · PDF

llm-agents code-generation multi-agent human-eval mbpp competitive-programming program-synthesis apps

Abstract

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.

한국어 요약

한 줄 요약

MapCoder는 인간 개발자와 유사한 4단계 프로세스를 모방한 멀티에이전트 프롬프팅을 통해 코드 생성 성능을 대폭 향상시킨다.

핵심 기여도

핵심 아이디어

MapCoder는 인간 개발자가 문제를 해결할 때 거치는 4단계 프로세스—예제 추출, 계획 수립, 코드 생성, 디버깅—를 LLM 에이전트로 구현한 멀티에이전트 프롬프팅 프레임워크이다. 기존 연구는 단일 에이전트가 문제 설명만을 기반으로 코드를 생성하거나, 외부 테스트 케이스를 생성해 코드를 수정하는 방식을 사용했으나, 이는 테스트 케이스 생성의 오류로 인해 성능이 저하될 수 있었다. MapCoder는 샘플 I/O만을 기반으로 단위 테스트와 버그 수정을 수행하는 디버깅 에이전트를 도입하여, 실제 세계 적용 가능성과 신뢰도를 높였다. 이는 기존 Self-Reflection 기반 접근법과 달리, 외부 테스트 케이스 생성 없이도 코드 품질을 향상시킬 수 있다는 점에서 혁신적이다.

기술적 접근법

주요 결과

의의 및 한계

MapCoder는 인간 개발자의 문제 해결 과정을 모방한 구조를 통해, 기존 단일 에이전트 기반 코드 생성 방식의 한계를 극복하였다. 특히, 샘플 I/O만을 사용하는 디버깅 에이전트는 실제 세계 적용 가능성과 신뢰도를 높이는 데 기여한다. 그러나, MapCoder는 여전히 매우 복잡한 문제(예: APPS)에서는 낮은 성능(22.0%)을 보이며, 더 복잡한 알고리즘 문제 해결 능력 향상이 필요하다. 또한, 에이전트 간 상호작용이 복잡해지면서 계산 비용이 증가할 수 있다는 점도 한계로 지적된다.

실용적 활용

MapCoder는 경쟁 프로그래밍, 코드 자동 생성, 프로그래밍 교육 등 다양한 분야에서 활용 가능하다. 특히, 개발자 도구로 통합되어 실시간 코드 생성 및 디버깅을 지원하거나, 온라인 코딩 플랫폼에서 자동 평가 시스템으로 활용될 수 있다.