Table of Contents
Fetching ...

Revisiting the Plastic Surgery Hypothesis via Large Language Models

Chunqiu Steven Xia, Yifeng Ding, Lingming Zhang

TL;DR

This work investigates how the plastic surgery hypothesis can boost large-language-model–driven automated program repair (APR). It introduces FitRepair, which combines Knowledge-Intensified and Repair-Oriented fine-tuning with Relevant-Identifier prompting to enable LLMs to reuse project-specific code ingredients for patch generation. On Defects4j 1.2 and 2.0, FitRepair achieves 89 and 44 correct fixes, respectively, surpassing prior state-of-the-art by notable margins and reducing patch ranking time. The approach demonstrates full automation and generalizability of leveraging repository-specific information through retrieval-based prompting, signaling a practical path toward more reliable LLM-based APR systems.

Abstract

Automated Program Repair (APR) aspires to automatically generate patches for an input buggy program. Traditional APR tools typically focus on specific bug types and fixes through the use of templates, heuristics, and formal specifications. However, these techniques are limited in terms of the bug types and patch variety they can produce. As such, researchers have designed various learning-based APR tools with recent work focused on directly using Large Language Models (LLMs) for APR. While LLM-based APR tools are able to achieve state-of-the-art performance on many repair datasets, the LLMs used for direct repair are not fully aware of the project-specific information such as unique variable or method names. The plastic surgery hypothesis is a well-known insight for APR, which states that the code ingredients to fix the bug usually already exist within the same project. Traditional APR tools have largely leveraged the plastic surgery hypothesis by designing manual or heuristic-based approaches to exploit such existing code ingredients. However, as recent APR research starts focusing on LLM-based approaches, the plastic surgery hypothesis has been largely ignored. In this paper, we ask the following question: How useful is the plastic surgery hypothesis in the era of LLMs? Interestingly, LLM-based APR presents a unique opportunity to fully automate the plastic surgery hypothesis via fine-tuning and prompting. To this end, we propose FitRepair, which combines the direct usage of LLMs with two domain-specific fine-tuning strategies and one prompting strategy for more powerful APR. Our experiments on the widely studied Defects4j 1.2 and 2.0 datasets show that FitRepair fixes 89 and 44 bugs (substantially outperforming the best-performing baseline by 15 and 8), respectively, demonstrating a promising future of the plastic surgery hypothesis in the era of LLMs.

Revisiting the Plastic Surgery Hypothesis via Large Language Models

TL;DR

This work investigates how the plastic surgery hypothesis can boost large-language-model–driven automated program repair (APR). It introduces FitRepair, which combines Knowledge-Intensified and Repair-Oriented fine-tuning with Relevant-Identifier prompting to enable LLMs to reuse project-specific code ingredients for patch generation. On Defects4j 1.2 and 2.0, FitRepair achieves 89 and 44 correct fixes, respectively, surpassing prior state-of-the-art by notable margins and reducing patch ranking time. The approach demonstrates full automation and generalizability of leveraging repository-specific information through retrieval-based prompting, signaling a practical path toward more reliable LLM-based APR systems.

Abstract

Automated Program Repair (APR) aspires to automatically generate patches for an input buggy program. Traditional APR tools typically focus on specific bug types and fixes through the use of templates, heuristics, and formal specifications. However, these techniques are limited in terms of the bug types and patch variety they can produce. As such, researchers have designed various learning-based APR tools with recent work focused on directly using Large Language Models (LLMs) for APR. While LLM-based APR tools are able to achieve state-of-the-art performance on many repair datasets, the LLMs used for direct repair are not fully aware of the project-specific information such as unique variable or method names. The plastic surgery hypothesis is a well-known insight for APR, which states that the code ingredients to fix the bug usually already exist within the same project. Traditional APR tools have largely leveraged the plastic surgery hypothesis by designing manual or heuristic-based approaches to exploit such existing code ingredients. However, as recent APR research starts focusing on LLM-based approaches, the plastic surgery hypothesis has been largely ignored. In this paper, we ask the following question: How useful is the plastic surgery hypothesis in the era of LLMs? Interestingly, LLM-based APR presents a unique opportunity to fully automate the plastic surgery hypothesis via fine-tuning and prompting. To this end, we propose FitRepair, which combines the direct usage of LLMs with two domain-specific fine-tuning strategies and one prompting strategy for more powerful APR. Our experiments on the widely studied Defects4j 1.2 and 2.0 datasets show that FitRepair fixes 89 and 44 bugs (substantially outperforming the best-performing baseline by 15 and 8), respectively, demonstrating a promising future of the plastic surgery hypothesis in the era of LLMs.
Paper Structure (27 sections, 1 equation, 9 figures, 7 tables, 1 algorithm)

This paper contains 27 sections, 1 equation, 9 figures, 7 tables, 1 algorithm.

Figures (9)

  • Figure 1: LLM overview
  • Figure 2: Cloze-style APR
  • Figure 3: FitRepair overview
  • Figure 4: Knowledge-Intensified fine-tuning overview
  • Figure 5: Repair-Oriented fine-tuning overview
  • ...and 4 more figures