Self-Collaboration Code Generation via ChatGPT

被引:6
|
作者
Dong, Yihong [1 ,2 ]
Jiang, Xue [1 ,2 ]
Jin, Zhi [1 ,2 ]
Li, Ge [1 ,2 ]
机构
[1] Peking Univ, Key Lab High Confidence Software Technol, Minist Educ, Beijing, Peoples R China
[2] Peking Univ, Sch Comp Sci, Beijing, Peoples R China
基金
中国国家自然科学基金;
关键词
Code generation; large language models; multi-agent collaboration; software development;
D O I
10.1145/3672459
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Although large language models (LLMs) have demonstrated remarkable code-generation ability, they still struggle with complex tasks. In real-world software development, humans usually tackle complex tasks through collaborative teamwork, a strategy that significantly controls development complexity and enhances software quality. Inspired by this, we present a self-collaboration framework for code generation employing LLMs, exemplified by ChatGPT. Specifically, through role instructions, (1) Multiple LLM agents act as distinct "experts," each responsible for a specific subtask within a complex task; (2) Specify the way to collaborate and interact, so that different roles form a virtual team to facilitate each other's work, ultimately the virtual team addresses code generation tasks collaboratively without the need for human intervention. To effectively organize and manage this virtual team, we incorporate software-development methodology into the framework. Thus, we assemble an elementary team consisting of three LLM roles (i.e., analyst, coder, and tester) responsible for software development's analysis, coding, and testing stages. We conduct comprehensive experiments on various code-generation benchmarks. Experimental results indicate that self-collaboration code generation relatively improves 29.9-47.1% Pass@1 compared to the base LLM agent. Moreover, we showcase that selfcollaboration could potentially enable LLMs to efficiently handle complex repository-level tasks that are not readily solved by the single LLM agent.
引用
收藏
页数:38
相关论文
共 50 条
  • [21] An Automatic Code Generation for Self-Healing
    Park, Jeongmin
    Youn, Hyunsang
    Lee, Eunseok
    JOURNAL OF INFORMATION SCIENCE AND ENGINEERING, 2009, 25 (06) : 1753 - 1781
  • [22] GENERATION OF OPTIMAL CODE FOR EXPRESSIONS VIA FACTORIZATION
    BREUER, MA
    COMMUNICATIONS OF THE ACM, 1969, 12 (06) : 333 - &
  • [23] CoDeSe: Fast deserialization via code generation
    Deptartment of Computer Science, University of Illinois, Urbana, IL 61801, United States
    Int. Symp. Softw. Test. Anal., ISSTA - Proc., 2011, (298-308):
  • [24] Can ChatGPT Support Developers? An Empirical Evaluation of Large Language Models for Code Generation
    Jin, Kailun
    Wang, Chung-Yu
    Hung Viet Pham
    Hemmati, Hadi
    2024 IEEE/ACM 21ST INTERNATIONAL CONFERENCE ON MINING SOFTWARE REPOSITORIES, MSR, 2024, : 167 - 171
  • [25] ChatGPT Code Detection: Techniques for Uncovering the Source of Code
    Oedingen, Marc
    Engelhardt, Raphael C.
    Denz, Robin
    Hammer, Maximilian
    Konen, Wolfgang
    AI, 2024, 5 (03) : 1066 - 1094
  • [26] Self-Edit: Fault-Aware Code Editor for Code Generation
    Zhang, Kechi
    Li, Zhuo
    Li, Jia
    Li, Ge
    Jin, Zhi
    PROCEEDINGS OF THE 61ST ANNUAL MEETING OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS, ACL 2023, VOL 1, 2023,
  • [27] Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning
    Ye, Wei
    Xie, Rui
    Zhang, Jinglei
    Hu, Tianxiang
    Wang, Xiaoyin
    Zhang, Shikun
    WEB CONFERENCE 2020: PROCEEDINGS OF THE WORLD WIDE WEB CONFERENCE (WWW 2020), 2020, : 2309 - 2319
  • [28] ChatIoT: Zero-code Generation of Trigger-action Based IoT Programs with ChatGPT
    Li, Fu
    Huang, Jiaming
    Gao, Yi
    Dong, Wei
    PROCEEDINGS OF THE 7TH ASIA-PACIFIC WORKSHOP ON NETWORKING, APNET 2023, 2023, : 219 - 220
  • [29] Code Generation Using Self-interactive Assistant
    Zhao, Zixiao
    Sun, Jing
    Cai, Cheng-Hao
    Wei, Zhiyuan
    2024 IEEE 48TH ANNUAL COMPUTERS, SOFTWARE, AND APPLICATIONS CONFERENCE, COMPSAC 2024, 2024, : 2347 - 2352
  • [30] CYCLE: Learning to Self-Refine the Code Generation
    Ding, Yangruibo
    Min, Marcus J.
    Kaiser, Gail
    Ray, Baishakhi
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2024, 8 (OOPSLA):