ComplexAgents: Complex Code Generation Framework Based on Multi-agents and Large Language Model
摘要
The rapidly developed large language models (LLMs) have been utilized for code generation. However, existing LLM-based code generation approaches, while effective on simple tasks, often suffer from performance issues on complex tasks that require complex reasoning and understanding such as APPS+ datasets. Inspired by the team collaboration paradigm of software development, we proposes ComplexAgents, an LLM-based multi-agent code generation framework to address the problem of unsatisfactory and inefficient complex code generation. Specifically, ComplexAgents pioneers incorporating typical human workflows (the waterfall model) into complex code generation. By assigning different roles to various agents, ComplexAgents effectively breaks down complex tasks into a series of manageable subtasks and integrates them efficiently, thereby improving the accuracy and efficiency of code generation. Experimental results show that, ComplexAgents achieve improvements of 40.1% and 1.4%, respectively, in Pass@1 over the basic LLM agent (GPT-4-Turbo) on the tasks HumanEval and MBPP. Furthermore, when applied to the complex code generation tasks such as APPS+, ComplexAgents achieved 70.4%, 49.6%, and 20.6% Pass@1 in three different difficulty categories of tasks: Introductory, Interview, and Competition, respectively, while the state-of-the-art technology (sota) only achieved 59.7%, 23.5%, and 8.6%, which demonstrates that our approach holds significant promise for real-world code generation.