[Paper Review] Revisiting the Plastic Surgery Hypothesis via Large Language Models
The paper introduces FitRepair, an LLM-based Automated Program Repair approach that leverages the plastic surgery hypothesis through fine-tuning and prompting, achieving state-of-the-art fixes on Defects4j 1.2 and 2.0.
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.
Motivation & Objective
- Revisit the plastic surgery hypothesis in the era of Large Language Models for APR.
- Develop a fully automated framework that leverages project-specific information to guide LLMs in repair.
- Propose two domain-specific fine-tuning strategies and a prompting technique to improve patch generation.
- Demonstrate effectiveness on Defects4j 1.2 and 2.0 and analyze the impact via ablation studies.
Proposed method
- Implement FitRepair on CodeT5 (MSP-based encoder-decoder LLM).
- Introduce Knowledge-Intensified fine-tuning with aggressive 50% token masking to learn project-specific tokens.
- Introduce Repair-Oriented fine-tuning that masks a single continuous code sequence per sample to align with repair tasks.
- Propose Relevant-Identifier prompting that uses information retrieval and static analysis to supply model with bug-relevant identifiers.
- Combine patches from four model variants (base CodeT5, two fine-tuned models, and prompting version), rank by likelihood, and validate against tests to select plausible and correct patches.

Experimental results
Research questions
- RQ1RQ1: How does FitRepair compare against state-of-the-art APR tools on Defects4j 1.2 and 2.0?
- RQ2RQ2: What is the impact of different FitRepair configurations (fine-tuning strategies and prompting) on repair performance?
- RQ3RQ3: How well does FitRepair generalize to fixing additional bugs from different projects?
Key findings
- FitRepair fixes 89 bugs on Defects4j 1.2 and 44 on 2.0, outperforming the best baseline by 15 and 8 fixes respectively.
- An extensive ablation study justifies the design choices and demonstrates the benefits of combining fine-tuning and prompting strategies.
- The approach shows that incorporating the plastic surgery hypothesis with LLMs can substantially boost APR and is fully automated and generalizable.
- Even partial or imprecise project-specific information provided via prompts can effectively guide LLMs to generate correct patches.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.