Gamma: Revisiting Template-Based Automated Program Repair Via Mask Prediction
Quanjun Zhang, Chunrong Fang, Tongke Zhang, Bowen Yu, Weisong Sun, Zhenyu Chen
摘要
Automated program repair (APR) aims to fix software bugs without manual debugging efforts and plays a crucial role in software development and maintenance. Template-based APR has been widely investigated and shown promising results. However, it is challenging for template-based APR to select the appropriate donor code, which is an important repair ingredient for generating candidate patches. Inappropriate donor code may cause plausible but incorrect patch generation even with correct fix patterns, limiting the repair performance. In this paper, we aim to revisit template-based APR, and propose Gamma, to directly leverage large pre-trained language models for donor code generation. Our main insight is that instead of retrieving donor code in the local buggy file, we can directly predict the correct code tokens based on the context code snippets and repair patterns by a cloze task. Specifically, (1) Gamma revises a variety of fix templates from state-of-the-art template-based APR techniques (i.e., TBar) and transforms them into mask patterns. (2) Gamma adopts a pre-trained language model to predict the correct code for masked code as a fill-in-the-blank task. Although our idea is general and can be built on various existing pre-trained language models, we have implemented Gamma as a practical APR tool based on the recent UniXcoder model. The experimental results demonstrate that Gamma correctly repairs 82 bugs on Defects4J-v1.2, which achieves 20.59% (14 bugs) and 26.15% (17 bugs) improvement over the previous state-of-the-art template-based approach TBar and learning-based one Recoder. Furthermore, Gamma repairs 45 bugs and 22 bugs from the additional Defects4J-v2.0 and QuixBugs, indicating the generalizability of Gamma in addressing the dataset overfitting issue. We also prove that adopting other pre-trained language models can provide substantial advancement, e.g., CodeBERT-based and ChatGPT-based Gamma is able to fix 80 and 67 bugs on Defects4J-v1.2, indicating the scalability of Gamma. Overall, our study highlights the promising future of adopting pre-trained models to generate correct patches on top of fix patterns in practice.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 12 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- A Large-Scale Empirical Study on Fine-Tuning Large Language Models for Unit Testing 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program Repair 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program Repair 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program Repair 引用了 CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
- CURE: Code-Aware Neural Machine Translation for Automatic Program Repair 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Template-Guided Program Repair in the Era of Large Language Models 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Template-Guided Program Repair in the Era of Large Language Models 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Template-Guided Program Repair in the Era of Large Language Models 引用了 CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
- Benchmarking Automated Program Repair: An Extensive Study on Both Real-World and Artificial Bugs 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Benchmarking Automated Program Repair: An Extensive Study on Both Real-World and Artificial Bugs 引用了 CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
- Benchmarking Automated Program Repair: An Extensive Study on Both Real-World and Artificial Bugs 引用了 Automated Program Repair in the Era of Large Pre-trained Language Models
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue Repair 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue Repair 引用了 CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue Repair 引用了 Template-Guided Program Repair in the Era of Large Language Models
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue Repair 引用了 Automated Program Repair in the Era of Large Pre-trained Language Models
- Automated Program Repair in the Era of Large Pre-trained Language Models 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Automated Program Repair in the Era of Large Pre-trained Language Models 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Automated Program Repair in the Era of Large Pre-trained Language Models 引用了 Language Models are Few-Shot Learners
- Automated Program Repair in the Era of Large Pre-trained Language Models 引用了 CURE: Code-Aware Neural Machine Translation for Automatic Program Repair
引用它的顶会 Paper12
- One Size Does Not Fit All: Multi-granularity Patch Generation for Better Automated Program RepairBo Lin, Shangwen Wang, Ming Wen, Liqian Chen 等ISSTA 2024 · 10 次引用
- Benchmarking Automated Program Repair: An Extensive Study on Both Real-World and Artificial BugsYicheng Ouyang, Jun Yang, Lingming ZhangISSTA 2024 · 8 次引用
- A Large-Scale Empirical Study on Fine-Tuning Large Language Models for Unit TestingYe Shang, Quanjun Zhang, Chunrong Fang, Siqi Gu 等ISSTA 2025 · 7 次引用
- Template-Guided Program Repair in the Era of Large Language ModelsKai Huang, Jian Zhang, Xiangxin Meng, Yang LiuICSE 2025 · 7 次引用
- Seeing is Fixing: Cross-Modal Reasoning with Multimodal LLMs for Visual Software Issue RepairKai Huang, Jian Zhang, Xiaofei Xie, Chunyang ChenASE 2025 · 5 次引用
它引用的 Paper16
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
- CoCoNuT: combining context-aware neural translation models using ensemble for program repairThibaud Lutellier, Hung Viet Pham, Lawrence Pang, Yitong Li 等ISSTA 2020 · 325 次引用
- Automated Program Repair in the Era of Large Pre-trained Language ModelsChunqiu Steven Xia, Yuxiang Wei, Lingming ZhangICSE 2023 · 321 次引用
- CURE: Code-Aware Neural Machine Translation for Automatic Program RepairNan Jiang, Thibaud Lutellier, Lin TanICSE 2021 · 267 次引用
相关 Paper
- Aligning the Objective of LLM-Based Program RepairJunjielong Xu, Ying Fu, Shin Hwei Tan, Pinjia HeICSE 2025 · 5 次引用
- An Empirical Study on Fine-Tuning Large Language Models of Code for Automated Program RepairKai Huang, Xiangxin Meng, Jian Zhang, Yang Liu 等ASE 2023 · 91 次引用
- The Plastic Surgery Hypothesis in the Era of Large Language ModelsChunqiu Steven Xia, Yifeng Ding, Lingming ZhangASE 2023 · 26 次引用
- Automated Repair of Programs from Large Language ModelsZhiyu Fan, Xiang Gao, Martin Mirchev, Abhik Roychoudhury 等ICSE 2023 · 213 次引用
- Automated Program Repair via Conversation: Fixing 162 out of 337 Bugs for $0.42 Each using ChatGPTChunqiu Steven Xia, Lingming ZhangISSTA 2024 · 105 次引用
