通过多计划探索和反馈驱动改进生成代码的结对编程框架

Huan Zhang, Wei Cheng, Yuhan Wu, Wei Hu
{"title":"通过多计划探索和反馈驱动改进生成代码的结对编程框架","authors":"Huan Zhang, Wei Cheng, Yuhan Wu, Wei Hu","doi":"arxiv-2409.05001","DOIUrl":null,"url":null,"abstract":"Large language models (LLMs) have achieved impressive performance on code\ngeneration. Although prior studies enhanced LLMs with prompting techniques and\ncode refinement, they still struggle with complex programming problems due to\nrigid solution plans. In this paper, we draw on pair programming practices to\npropose PairCoder, a novel LLM-based framework for code generation. PairCoder\nincorporates two collaborative LLM agents, namely a Navigator agent for\nhigh-level planning and a Driver agent for specific implementation. The\nNavigator is responsible for proposing promising solution plans, selecting the\ncurrent optimal plan, and directing the next iteration round based on execution\nfeedback. The Driver follows the guidance of Navigator to undertake initial\ncode generation, code testing, and refinement. This interleaved and iterative\nworkflow involves multi-plan exploration and feedback-based refinement, which\nmimics the collaboration of pair programmers. We evaluate PairCoder with both\nopen-source and closed-source LLMs on various code generation benchmarks.\nExtensive experimental results demonstrate the superior accuracy of PairCoder,\nachieving relative pass@1 improvements of 12.00%-162.43% compared to prompting\nLLMs directly.","PeriodicalId":501278,"journal":{"name":"arXiv - CS - Software Engineering","volume":"7 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-09-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement\",\"authors\":\"Huan Zhang, Wei Cheng, Yuhan Wu, Wei Hu\",\"doi\":\"arxiv-2409.05001\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Large language models (LLMs) have achieved impressive performance on code\\ngeneration. Although prior studies enhanced LLMs with prompting techniques and\\ncode refinement, they still struggle with complex programming problems due to\\nrigid solution plans. In this paper, we draw on pair programming practices to\\npropose PairCoder, a novel LLM-based framework for code generation. PairCoder\\nincorporates two collaborative LLM agents, namely a Navigator agent for\\nhigh-level planning and a Driver agent for specific implementation. The\\nNavigator is responsible for proposing promising solution plans, selecting the\\ncurrent optimal plan, and directing the next iteration round based on execution\\nfeedback. The Driver follows the guidance of Navigator to undertake initial\\ncode generation, code testing, and refinement. This interleaved and iterative\\nworkflow involves multi-plan exploration and feedback-based refinement, which\\nmimics the collaboration of pair programmers. We evaluate PairCoder with both\\nopen-source and closed-source LLMs on various code generation benchmarks.\\nExtensive experimental results demonstrate the superior accuracy of PairCoder,\\nachieving relative pass@1 improvements of 12.00%-162.43% compared to prompting\\nLLMs directly.\",\"PeriodicalId\":501278,\"journal\":{\"name\":\"arXiv - CS - Software Engineering\",\"volume\":\"7 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-09-08\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Software Engineering\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2409.05001\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Software Engineering","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2409.05001","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

大型语言模型(LLM)在代码生成方面取得了令人瞩目的成绩。尽管之前的研究利用提示技术和代码精炼技术增强了 LLM,但由于求解计划过于僵化,它们在处理复杂的编程问题时仍然举步维艰。在本文中,我们借鉴结对编程实践,提出了基于 LLM 的新型代码生成框架 PairCoder。PairCoder 包含两个协作式 LLM 代理,即负责高层规划的 Navigator 代理和负责具体实施的 Driver 代理。导航员负责提出有前途的解决方案计划,选择当前最优计划,并根据执行反馈指导下一轮迭代。驱动程序根据导航器的指导进行初始代码生成、代码测试和完善。这种交错迭代的工作流程包括多计划探索和基于反馈的完善,模拟了一对程序员的协作。我们在各种代码生成基准上评估了 PairCoder 与开源和闭源 LLM。大量实验结果表明,PairCoder 的准确性更胜一筹,与直接提示 LLM 相比,PairCoder 的相对通过率@1 提高了 12.00%-162.43% 。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement
Large language models (LLMs) have achieved impressive performance on code generation. Although prior studies enhanced LLMs with prompting techniques and code refinement, they still struggle with complex programming problems due to rigid solution plans. In this paper, we draw on pair programming practices to propose PairCoder, a novel LLM-based framework for code generation. PairCoder incorporates two collaborative LLM agents, namely a Navigator agent for high-level planning and a Driver agent for specific implementation. The Navigator is responsible for proposing promising solution plans, selecting the current optimal plan, and directing the next iteration round based on execution feedback. The Driver follows the guidance of Navigator to undertake initial code generation, code testing, and refinement. This interleaved and iterative workflow involves multi-plan exploration and feedback-based refinement, which mimics the collaboration of pair programmers. We evaluate PairCoder with both open-source and closed-source LLMs on various code generation benchmarks. Extensive experimental results demonstrate the superior accuracy of PairCoder, achieving relative pass@1 improvements of 12.00%-162.43% compared to prompting LLMs directly.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信