Predicting Patch Correctness Based on the Similarity of Failing Test Cases
Not on the map. Why?
Abstract (arXiv)
Towards predicting patch correctness in APR, we propose a simple, but novel hypothesis on how the link between the patch behaviour and failing test specifications can be drawn: similar failing test cases should require similar patches. We then propose BATS, an unsupervised learning-based system to predict patch correctness by checking patch Behaviour Against failing Test Specification. BATS exploits deep representation learning models for code and patches: for a given failing test case, the yielded embedding is used to compute similarity metrics in the search for historical similar test cases in order to identify the associated applied patches, which are then used as a proxy for assessing generated patch correctness. Experimentally, we first validate our hypothesis by assessing whether ground-truth developer patches cluster together in the same way that their associated failing test cases are clustered. Then, after collecting a large dataset of 1278 plausible patches (written by developers or generated by some 32 APR tools), we use BATS to predict correctness: BATS achieves an AUC between 0.557 to 0.718 and a recall between 0.562 and 0.854 in identifying correct patches. Compared against previous work, we demonstrate that our approach outperforms state-of-the-art performance in patch correctness prediction, without the need for large labeled patch datasets in contrast with prior machine learning-based approaches. While BATS is constrained by the availability of similar test cases, we show that it can still be complementary to existing approaches: used in conjunction with a recent approach implementing supervised learning, BATS improves the overall recall in detecting correct patches. We finally show that BATS can be complementary to the state-of-the-art PATCH-SIM dynamic approach of identifying the correct patches for APR tools.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 39 of its 94 references that are in the map. First posted on arXiv 28 Jul 2021.
Builds on
39 of 94 references.
References · 39
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2014Distributed Representations of Sentences and Documentscited by 677
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2018SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repaircited by 144
- 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 85
- 2020When Machine Learning Meets Privacy: A Survey and Outlookcited by 67
- 2017Neural Network-based Graph Embedding for Cross-Platform Binary Code Similarity Detectioncited by 65
- 2019TBar: Revisiting Template-based Automated Program Repaircited by 64
- 2020CC2Vec: Distributed Representations of Code Changescited by 38
- 2018Nopol: Automatic Repair of Conditional Statement Bugs in Java Programscited by 32
27 more
- 2017Sorting and Transforming Program Repair Ingredients via Deep Learning Code Similaritiescited by 26
- 2017ARJA: Automated Repair of Java Programs via Multi-Objective Genetic Programmingcited by 26
- 2018Automatic Software Repair: a Bibliographycited by 24
- 2017Dynamic Neural Program Embedding for Program Repaircited by 23
- 2018FixMiner: Mining Relevant Fix Patterns for Automated Program Repaircited by 22
- 2018AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violationscited by 22
- 2020Evaluating Representation Learning of Code Changes for Predicting Patch Correctness in Program Repaircited by 22
- 2020Opportunities and Challenges in Code Search Toolscited by 22
- 2018Practical Program Repair via Bytecode Mutationcited by 19
- 2019A Survey of Binary Code Similaritycited by 18
- 2017Identifying Patch Correctness in Test-Based Program Repaircited by 16
- 2020On the Efficiency of Test Suite based Program Repair: A Systematic Assessment of 16 Automated Repair Systems for Java Programscited by 16
- 2018Dissection of a Bug Dataset: Anatomy of 395 Patches from Defects4Jcited by 14
- 2016Precise Condition Synthesis for Program Repaircited by 13
- 2018You Cannot Fix What You Cannot Find! An Investigation of Fault Localization Bias in Benchmarking Automated Program Repair Systemscited by 13
- 2019Automated Patch Assessment for Program Repair at Scalecited by 13
- 2019Harnessing Evolution for Multi-Hunk Program Repaircited by 12
- 2019Automated Classification of Overfitting Patches with Statically Extracted Code Featurescited by 10
- 2017Mining Fix Patterns for FindBugs Violationscited by 9
- 2017Ultra-Large Repair Search Space with Automatically Mined Templates: the Cardumen Mode of Astorcited by 9
- 2016An Analysis of the Search Spaces for Generate and Validate Patch Generation Systemscited by 8
- 2018On Reliability of Patch Correctness Assessmentcited by 8
- 2019Human-In-The-Loop Automatic Program Repaircited by 4
- 2018The Remarkable Role of Similarity in Redundancy-based Program Repaircited by 3
- 2020SLACC: Simion-based Language Agnostic Code Clonescited by 3
- 2015Automatic Repair of Real Bugs: An Experience Report on the Defects4J Datasetcited by 2
- 2020Fast and Precise On-the-fly Patch Validation for Allcited by 2
Built on by
Citing papers per year: 2022: 2; 2023: 0; 2024: 0; 2025: 2.
4 papers.
- 2022Is this Change the Answer to that Problem? Correlating Descriptions of Bug and Code Changes for Evaluating Patch Correctnesscited by 7
- 2022MetaTPTrans: A Meta Learning Approach for Multilingual Code Representation Learningcited by 6
- 2025LogiCase: Effective Test Case Generation from Logical Description in Competitive Programmingcited by 4
- 2025SAGE:Specification-Aware Grammar Extraction for Automated Test Case Generation with LLMscited by 0
- 2025SAGE:Specification-Aware Grammar Extraction for Automated Test Case Generation with LLMs4 Jun 2025
- 2025LogiCase: Effective Test Case Generation from Logical Description in Competitive Programming21 May 2025
- 2022Is this Change the Answer to that Problem? Correlating Descriptions of Bug and Code Changes for Evaluating Patch Correctness8 Aug 2022
- 2022MetaTPTrans: A Meta Learning Approach for Multilingual Code Representation Learning13 Jun 2022