{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/self-collaboration-code-generation-via","title":"Self-collaboration Code Generation via ChatGPT","arxiv_id":"2304.07590","date":"2023-04-15","proceeding":null,"authors":["Yihong Dong","Xue Jiang","Zhi Jin","Ge Li"],"abstract":"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 self-collaboration could potentially enable LLMs to efficiently handle complex repository-level tasks that are not readily solved by the single LLM agent.","url_abs":"https://arxiv.org/abs/2304.07590v3","url_pdf":"https://arxiv.org/pdf/2304.07590v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"links_only","authors_date_abstract":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license), from the Kaggle arXiv metadata snapshot of 2026-09-12"},"code_links":[{"paper_slug":"self-collaboration-code-generation-via","repo_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"self-collaboration-code-generation-via","repo_url":"https://github.com/besser-pearl/agentic-bpmn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2304.07590","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2304.07590"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/besser-pearl/agentic-bpmn","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/YihongDong/Self-collaboration-Code-Generation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":17},"by_repo_kind":{"official":{"samples":17,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"edb3468adda5e752","entry":"call_chatgpt","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/backend.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/backend.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"edb3468adda5e752"}},{"code_sha256_prefix":"6b210bdeeae33ffc","entry":"call_llm","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/backend.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/backend.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6b210bdeeae33ffc"}},{"code_sha256_prefix":"93b3e7a2b08c74b7","entry":"call_llm_with_tools","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/backend.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/backend.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"93b3e7a2b08c74b7"}},{"code_sha256_prefix":"85dcee64dcb03ae5","entry":"clone_repo","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/repo_tools.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/repo_tools.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"85dcee64dcb03ae5"}},{"code_sha256_prefix":"39ca69f20203b0e1","entry":"code_truncate","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"39ca69f20203b0e1"}},{"code_sha256_prefix":"4d6900765a680c9f","entry":"code_truncate_regex","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4d6900765a680c9f"}},{"code_sha256_prefix":"40263bfc7c17c517","entry":"extract_patch","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/patch_utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/patch_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"40263bfc7c17c517"}},{"code_sha256_prefix":"8d702cbfc56a7d48","entry":"get_image_name","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"run_swe_docker.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/run_swe_docker.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8d702cbfc56a7d48"}},{"code_sha256_prefix":"34c188c42a3e46a9","entry":"get_repo_structure","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/repo_tools.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/repo_tools.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"34c188c42a3e46a9"}},{"code_sha256_prefix":"6d314c06f83ec007","entry":"image_exists","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"run_swe_docker.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/run_swe_docker.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6d314c06f83ec007"}},{"code_sha256_prefix":"ba1bea1b924882e1","entry":"openai_config","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/config.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/config.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ba1bea1b924882e1"}},{"code_sha256_prefix":"91120a9f594cb6e3","entry":"prompt_split_humaneval","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"91120a9f594cb6e3"}},{"code_sha256_prefix":"bac44134ee8d1581","entry":"read_file","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/repo_tools.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/repo_tools.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bac44134ee8d1581"}},{"code_sha256_prefix":"5b0f4aae224d17d9","entry":"repair_patch","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/patch_utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/patch_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5b0f4aae224d17d9"}},{"code_sha256_prefix":"c94bc015446c731b","entry":"start_container","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"run_swe_docker.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/run_swe_docker.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c94bc015446c731b"}},{"code_sha256_prefix":"4699f7376865432a","entry":"strip_context_lines","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/patch_utils.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/patch_utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4699f7376865432a"}},{"code_sha256_prefix":"584acc1f9637179b","entry":"unsafe_execute","repo":"YihongDong/Self-collaboration-Code-Generation","repo_kind":"official","path":"core/sandbox.py","file_url":"https://github.com/YihongDong/Self-collaboration-Code-Generation/blob/HEAD/core/sandbox.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"584acc1f9637179b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}