PATCH: Empowering Large Language Model with Programmer-Intent Guidance and Collaborative-Behavior Simulation for Automatic Bug Fixing

📅 2025-01-27
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Existing large language models (LLMs) for automated program repair largely neglect collaborative development workflows and contextual code information, limiting repair quality. This paper proposes PATCH, a staged collaborative repair framework that decomposes the repair process into four sequential phases—error localization, root-cause diagnosis, patch generation, and validation—each executed via multi-turn LLM dialogues. To enhance reasoning fidelity, we explicitly integrate programmer intent modeling and static dependency analysis into prompt engineering and stage-wise prompt orchestration. To our knowledge, PATCH is the first approach to establish an interactive repair paradigm grounded in simulated collaborative software engineering behavior. Evaluated on the BFP benchmark, PATCH achieves substantial improvements over state-of-the-art methods: +12.3% absolute gain in patch accuracy and +18.7% improvement in compilability.

Technology Category

Application Category

📝 Abstract
Bug fixing holds significant importance in software development and maintenance. Recent research has made substantial strides in exploring the potential of large language models (LLMs) for automatically resolving software bugs. However, a noticeable gap in existing approaches lies in the oversight of collaborative facets intrinsic to bug resolution, treating the process as a single-stage endeavor. Moreover, most approaches solely take the buggy code snippet as input for LLMs during the patch generation stage. To mitigate the aforementioned limitations, we introduce a novel stage-wise framework named PATCH. Specifically, we first augment the buggy code snippet with corresponding dependence context and intent information to better guide LLMs in generating the correct candidate patches. Additionally, by taking inspiration from bug management practices, we decompose the bug-fixing task into four distinct stages: bug reporting, bug diagnosis, patch generation, and patch verification. These stages are performed interactively by LLMs, aiming to simulate the collaborative behavior of programmers during the resolution of software bugs. By harnessing these collective contributions, PATCH effectively enhances the bug-fixing capability of LLMs. We implement PATCH by employing the powerful dialogue-based LLM ChatGPT. Our evaluation on the widely used bug-fixing benchmark BFP demonstrates that PATCH has achieved better performance than state-of-the-art LLMs.
Problem

Research questions and friction points this paper is trying to address.

Large Language Models
Software Bug Repair
Context-awareness
Innovation

Methods, ideas, or system contributions that make the work stand out.

PATCH
Large Language Model (LLM)
Automated Code Repair
🔎 Similar Papers
No similar papers found.
Y
Yuwei Zhang
Key Laboratory of System and Software (Chinese Academy of Sciences); Institute of Software, Chinese Academy of Sciences; University of Chinese Academy of Sciences, China
Zhi Jin
Zhi Jin
Sun Yat-Sen University, Associate Professor
Y
Ying Xing
School of Artificial Intelligence, Beijing University of Posts and Telecommunications, China
Ge Li
Ge Li
Full Professor of Computer Science, Peking University
Program AnalysisProgram GenerationDeep Learning
F
Fang Liu
State Key Laboratory of Complex & Critical Software Environment; School of Computer Science and Engineering, Beihang University, China
Jiaxin Zhu
Jiaxin Zhu
Institute of Software, Chinese Academy of Sciences
software engineeringmining software repositories
Wensheng Dou
Wensheng Dou
Professor, Institute of Software Chinese Academy of Sciences (ISCAS)
software analysis and testingdatabase systemsdistributed systemsspreadsheet
J
Jun Wei
Key Laboratory of System and Software (Chinese Academy of Sciences); Institute of Software, Chinese Academy of Sciences; University of Chinese Academy of Sciences, China