[Paper Review] SelfAPR: Self-supervised Program Repair with Test Execution Diagnostics
SelfAPR proposes a self-supervised program repair framework that generates project-specific training samples by perturbing a past version of the target program and incorporates test execution diagnostics into the input representation to guide repair. It achieves 110 repairs on Defects4J bugs, outperforming all prior supervised learning-based approaches by addressing domain-specific knowledge and fault-type awareness gaps.
Learning-based program repair has achieved good results in a recent series of papers. Yet, we observe that the related work fails to repair some bugs because of a lack of knowledge about 1) the application domain of the program being repaired, and 2) the fault type being repaired. In this paper, we solve both problems by changing the learning paradigm from supervised training to self-supervised training in an approach called SelfAPR. First, SelfAPR generates training samples on disk by perturbing a previous version of the program being repaired, enforcing the neural model to capture projectspecific knowledge. This is different from the previous work based on mined past commits. Second, SelfAPR executes all training samples and extracts and encodes test execution diagnostics into the input representation, steering the neural model to fix the kind of fault. This is different from the existing studies that only consider static source code as input. We implement SelfAPR and evaluate it in a systematic manner. We generate 1 039 873 training samples obtained by perturbing 17 open-source projects. We evaluate SelfAPR on 818 bugs from Defects4J, SelfAPR correctly repairs 110 of them, outperforming all the supervised learning repair approaches.
Motivation & Objective
- To address the lack of project-specific knowledge in supervised neural program repair, which limits generalization to domain-specific tokens.
- To overcome the absence of fault-type information in training data, which hinders repair of specific bug categories like NullPointerExceptions.
- To develop a self-supervised training paradigm that generates synthetic, project-aware training samples without relying on mined past commits.
- To integrate runtime diagnostics from test executions into the input representation to guide the model toward fixing specific fault types.
- To evaluate the effectiveness of self-supervised learning in program repair on real-world benchmarks, particularly on bugs previously unfixable by supervised models.
Proposed method
- SelfAPR generates 1,039,873 training samples by systematically perturbing a past version of the program under repair, ensuring project-specific tokens are present in the training data.
- The framework executes all generated training samples to collect test execution diagnostics, such as runtime exceptions and assertion failures, which are encoded into the input representation.
- Test execution diagnostics are embedded as additional input tokens to the neural model, providing fault-type signals during repair prediction.
- A self-supervised training loop replaces supervised learning by using the perturbed past version as the source of training data, avoiding reliance on external commits.
- The model uses an encoder-decoder architecture with input representation enriched by both source code and diagnostic signals to predict correct patches.
- The approach leverages SentencePiece tokenization and fine-tunes a pre-trained model on the synthetic dataset to improve generalization to unseen bugs.
Experimental results
Research questions
- RQ1Can self-supervised training with project-specific perturbations improve neural program repair beyond supervised learning based on mined commits?
- RQ2Does incorporating test execution diagnostics into the input representation enhance the model's ability to repair specific fault types?
- RQ3Can SelfAPR fix bugs that existing supervised neural repair models fail to repair due to lack of project-specific tokens?
- RQ4How does SelfAPR perform compared to state-of-the-art supervised learning-based repair tools on standard benchmarks?
- RQ5To what extent does the inclusion of execution diagnostics improve repair accuracy and fault-type generalization?
Key findings
- SelfAPR successfully repairs 110 out of 818 bugs from the Defects4J benchmark, outperforming all prior supervised learning-based repair approaches.
- The model fixes 110 bugs where previous methods failed, including those requiring project-specific tokens like requiresLevel.isOn(), which were absent in training data of prior systems.
- SelfAPR's use of test execution diagnostics enables it to identify and repair fault types such as NullPointerExceptions, which are often missed by models relying only on static code.
- The self-supervised training loop generates 1,039,873 training samples from 17 open-source projects, ensuring rich project-specific knowledge is embedded in the model.
- By encoding diagnostics into the input, SelfAPR steers the model toward repairing specific fault categories, improving precision and generalization.
- The framework demonstrates that self-supervised data generation with execution feedback is more effective than mining real-world commits for neural program repair.
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.