Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program Repair
arXiv:2309.00608 · doi:10.1145/3611643.3616271
Abstract
During Automated Program Repair (APR), it can be challenging to synthesize correct patches for real-world systems in general-purpose programming languages. Recent Large Language Models (LLMs) have been shown to be helpful "copilots" in assisting developers with various coding tasks, and have also been directly applied for patch synthesis. However, most LLMs treat programs as sequences of tokens, meaning that they are ignorant of the underlying semantics constraints of the target programming language. This results in plenty of statically invalid generated patches, impeding the practicality of the technique. Therefore, we propose Repilot, a general code generation framework to further copilot the AI "copilots" (i.e., LLMs) by synthesizing more valid patches during the repair process. Our key insight is that many LLMs produce outputs autoregressively (i.e., token by token), resembling human writing programs, which can be significantly boosted and guided through a Completion Engine. Repilot synergistically synthesizes a candidate patch through the interaction between an LLM and a Completion Engine, which 1) prunes away infeasible tokens suggested by the LLM and 2) proactively completes the token based on the suggestions provided by the Completion Engine. Our evaluation on a subset of the widely-used Defects4j 1.2 and 2.0 datasets shows that Repilot outperforms state-of-the-art techniques by fixing 27% and 47% more bugs, respectively. Moreover, Repilot produces more valid and correct patches than the base LLM with the same budget. While we focus on leveraging Repilot for APR in this work, the overall approach is also generalizable to other code generation tasks.
arXiv commentPaper accepted at ESEC/FSE 2023
References in corpus (11)
- SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repair
- Practical Program Repair in the Era of Large Pre-trained Language Models
- TBar: Revisiting Template-based Automated Program Repair
- CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
- Automatic Repair of Real Bugs in Java: A Large-Scale Experiment on the Defects4J Dataset
- Less Training, More Repairing Please: Revisiting Automated Program Repair via Zero-shot Learning
- FixMiner: Mining Relevant Fix Patterns for Automated Program Repair
- Neural Program Repair with Execution-based Backpropagation
- Automatic Repair of Buggy If Conditions and Missing Preconditions with SMT
- Conversational Automated Program Repair
- A study on Prompt Design, Advantages and Limitations of ChatGPT for Deep Learning Program Repair
Cited by in corpus (12)
- Generative AI for Self-Adaptive Systems: State of the Art and Research Roadmap
- Look Before You Leap: An Exploratory Study of Uncertainty Measurement for Large Language Models
- RepairLLaMA: Efficient Representations and Fine-Tuned Adapters for Program Repair
- LPR: Large Language Models-Aided Program Reduction
- Statically Contextualizing Large Language Models with Typed Holes
- Type-Constrained Code Generation with Language Models
- ClozeMaster: Fuzzing Rust Compiler by Harnessing LLMs for Infilling Masked Real Programs
- Position: Vibe Coding Needs Vibe Reasoning: Improving Vibe Coding with Formal Verification
- STEAM: Simulating the InTeractive BEhavior of ProgrAMmers for Automatic Bug Fixing
- ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets using LLMs
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue Fixing
- MultiMend: Multilingual Program Repair with Context Augmentation and Multi-Hunk Patch Generation