A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement

Huan Zhang, Wei Cheng, Yuhan Wu, Wei Hu
9/8/2024
cs.SEcs.AI

No official code found. Best implementation: nju-websoft/PairCoder (113 stars, GPL-3.0, last commit 2024-11-29).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

GPL-3.0

A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement, ASE 2024 (Distinguished Paper Award)

11313PythonAug 18, 20241 years agoGPL-3.0
code-generationlarge-language-modelsllm-agentmulti-agent-systempair-programing+1 more

Similar Papers

Cite this paper

@article{zhang2024pair,
  title  = {A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven Refinement},
  author = {Huan Zhang and Wei Cheng and Yuhan Wu and Wei Hu},
  year   = {2024},
  eprint = {2409.05001},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2409.05001v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2409.05001.svg)](https://codeofpaper.com/paper/2409.05001)

Discussion