MultiMend: Multilingual Program Repair with Context Augmentation and Multi-Hunk Patch Generation
arXiv:2501.16044 · doi:10.1007/s10515-026-00611-2
Abstract
Debugging software remains a labor-intensive and time-consuming process despite advances in testing and verification. Learning-based automated program repair (APR) has shown promise in reducing the effort of manually fixing bugs. However, existing techniques face several challenges, including language-dependent strategies, limited bug context utilization, and difficulties in handling bugs that span multiple locations in the code. This paper presents MultiMend, a multilingual learning-based APR approach designed to improve repair performance through language-independent context augmentation and multi-hunk patch generation. MultiMend fine-tunes a pre-trained code language model to generate bug-fixing patches. It embeds source code lines and applies retrieval-augmented generation to augment the usual function-based buggy context with relevant lines during patch generation. The approach also systematically constructs patches for multi-hunk bugs to extend the capabilities of single-hunk models and reduce the needed patch validations. We evaluate MultiMend on six benchmarks with 5,501 bugs covering four programming languages and compare it with state-of-the-art methods. Results show that MultiMend achieves competitive effectiveness and efficiency, fixing 2,227 bugs, of which 1,545 are identical to the developer's patch, and 121 are for multi-hunk bugs. Both context augmentation and multi-hunk patch generation contribute positively to these results. Overall, MultiMend's contributions are promising and offer practical and effective techniques to enhance APR performance for real-world software maintenance.
References in corpus (33)
- Retrieval-Augmented Generation for Large Language Models: A Survey
- CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
- 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
- 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
- Keep the Conversation Going: Fixing 162 out of 337 bugs for $0.42 each using ChatGPT
- BugsInPy: A Database of Existing Bugs in Python Programs to Enable Controlled Testing and Debugging Studies
- On the Efficiency of Test Suite based Program Repair: A Systematic Assessment of 16 Automated Repair Systems for Java Programs
- Copiloting the Copilots: Fusing Large Language Models with Completion Engines for Automated Program Repair
- Dissection of a Bug Dataset: Anatomy of 395 Patches from Defects4J
- SelfAPR: Self-supervised Program Repair with Test Execution Diagnostics
- Automated Patch Assessment for Program Repair at Scale
- A Comprehensive Study of Automatic Program Repair on the QuixBugs Benchmark
- ITER: Iterative Neural Repair for Multi-Location Patches
- Checkpoint Ensembles: Ensemble Methods from a Single Training Process
- A Critical Review of Large Language Model on Software Engineering: An Example from ChatGPT and Automated Program Repair
- Revisiting the Plastic Surgery Hypothesis via Large Language Models
- ContrastRepair: Enhancing Conversation-Based Automated Program Repair via Contrastive Test Case Pairs
- RepairLLaMA: Efficient Representations and Fine-Tuned Adapters for Program Repair
- A Survey on Automated Program Repair Techniques
- GitBug-Java: A Reproducible Benchmark of Recent Java Bugs
- T5APR: Empowering Automated Program Repair across Languages through Checkpoint Ensemble
- Practical Program Repair via Preference-based Ensemble Strategy
- RunBugRun -- An Executable Dataset for Automated Program Repair
- UniDebugger: Hierarchical Multi-Agent Framework for Unified Software Debugging
- Program Repair
- MUFIN: Improving Neural Repair Models with Back-Translation
- Neural Program Repair with Program Dependence Analysis and Effective Filter Mechanism
- Exploring the Potential of Conversational Test Suite Based Program Repair on SWE-bench