Self-collaboration Code Generation via ChatGPT

Yihong Dong, Xue Jiang, Zhi Jin, Ge Li

Code generation is widely regarded as a key technique for elevating the automation and ultimate quality of software development. Nevertheless, existing code generation approaches usually concentrate on a single stage of the software development process (i.e., the coding stage) and do not take into consideration other stages that are crucial in reducing complexity and ensuring quality assurance. The organization and conduction of multiple stages in software development require collaborative teamwork. To this end, this paper presents a self-collaboration code generation framework employing large language models (LLMs), exemplified by ChatGPT. Specifically, multiple LLMs play distinct roles through role instructions to form teams, addressing code generation tasks collaboratively and interactively without the need for human intervention. To showcase our framework, we assemble an elementary team consisting of three ChatGPT roles (i.e., analyst, coder, and tester) corresponding to the analysis, coding, and testing stages of software development. We conduct comprehensive experiments on various code-generation benchmarks. The experimental results indicate that self-collaboration code generation improves 29.9%-47.1% relative performance compared to naive direct code generation, achieving state-of-the-art performance and even surpassing GPT-4.

Knowledge Graph

arrow_drop_up

Comments

Sign up or login to leave a comment