[Paper Review] Neural Program Repair with Program Dependence Analysis and Effective Filter Mechanism
This paper proposes RepeatNPR, a neural program repair framework that enhances patch generation by leveraging program dependence graphs to extract semantically relevant context around buggy statements and applying a filter mechanism to eliminate unaltered patches. Evaluated on five benchmarks, RepeatNPR achieves state-of-the-art performance, outperforming existing methods in exact match accuracy.
Automated program repair is a crucial task for improving the efficiency of software developers. Recently, neural-based techniques have demonstrated significant promise in generating correct patches for buggy code snippets. However, most existing approaches arbitrarily treat the buggy context without any analysis to capture the semantic relationship between the buggy statement and its context. Additionally, we observe that existing neural models may output an unaltered patch consistent with the input buggy code snippet, which fails to be the correct human-written one for fixing the given bug. To address the aforementioned limitations, we present in this paper a novel neural program repair framework called \approach, which adapts the general pre-trained language model for fixing single-line Java bugs. We make the first attempt to use program slicing to extract contextual information directly related to the given buggy statement as repair ingredients from the corresponding program dependence graph and eliminate unaltered patches using an intuitive but effective filter mechanism. We demonstrate the effectiveness of \approach on five benchmarks when compared with state-of-the-art baselines.
Motivation & Objective
- To address the limitation of existing neural program repair models that treat context arbitrarily and generate unaltered patches.
- To improve repair accuracy by identifying and incorporating only the most relevant contextual information around buggy statements using program dependence analysis.
- To eliminate unaltered patches—outputs identical to the input—through an effective filter mechanism based on ensemble model predictions.
- To demonstrate that context-aware repair ingredients and unaltered patch filtering significantly enhance the effectiveness of neural program repair.
Proposed method
- Construct a program dependence graph (PDG) for each buggy method to model data and control dependencies.
- Apply program slicing to extract only the statements directly influencing the buggy statement as repair-relevant context.
- Use a pre-trained encoder-decoder model (e.g., CodeT5) to generate patches based on the sliced context and buggy statement.
- Implement a filter mechanism that identifies and removes unaltered patches by comparing predictions across multiple NPR models.
- Train and fine-tune the model on the BFP benchmark using the exact match metric for evaluation.
- Leverage the ensemble behavior of multiple models to detect when a prediction matches the input, indicating no repair was applied.
Experimental results
Research questions
- RQ1Can program dependence analysis improve the selection of relevant contextual information for neural program repair?
- RQ2Does filtering out unaltered patches significantly improve the quality of generated fixes?
- RQ3How does the proposed framework compare to state-of-the-art models in terms of exact match accuracy across diverse benchmarks?
- RQ4To what extent do the repair ingredients extracted via program slicing contribute to fixing real-world Java bugs?
- RQ5Can the framework be generalized to other programming languages with minimal adaptation?
Key findings
- RepeatNPR achieved the highest exact match score of 357 (35.00%) on the BFP benchmark, outperforming all other models including CodeT5 and SequenceR.
- The framework generated 390 unique correct patches on the BFP benchmark, more than any other model except Recoder, indicating strong complementary performance.
- RepeatNPR showed a 24.49% exact match rate on the Defects4J benchmark, significantly higher than baseline models such as GraphCodeBERT (17.64%) and CodeBERT (17.68%).
- The filter mechanism successfully eliminated a substantial number of unaltered patches, which otherwise would have been incorrectly accepted as correct.
- The overlapping patching rate between RepeatNPR and other models was high (e.g., 52% with SequenceR), yet RepeatNPR still produced the largest number of unique correct fixes, demonstrating its distinct effectiveness.
- The results suggest that context-aware repair ingredients and unaltered patch filtering are critical for improving neural program repair performance.
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.