The Best of Both Worlds: Combining Learned Embeddings with Engineered Features for Accurate Prediction of Correct Patches

被引:16
作者
Tian, Haoye [1 ]
Liu, Kui [2 ]
Li, Yinghua [1 ]
Kabore, Abdoul Kader [1 ]
Koyuncu, Anil [3 ]
Habib, Andrew [1 ]
Li, Li [4 ]
Wen, Junhao [5 ]
Klein, Jacques [1 ]
Bissyande, Tegawende F. [1 ]
机构
[1] Univ Luxembourg, Esch Sur Alzette, Luxembourg
[2] Huawei, Shenzhen, Peoples R China
[3] Sabanci Univ, Istanbul, Turkiye
[4] Monash Univ, Melbourne, Australia
[5] Chongqing Univ, Chongqing, Peoples R China
基金
欧洲研究理事会; 中国国家自然科学基金;
关键词
Program repair; patch correctness; distributed representation learning; machine learning; embeddings; features combination; explanation; AUTOMATED REPAIR; GENERATION;
D O I
10.1145/3576039
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A large body of the literature on automated program repair develops approaches where patches are automatically generated to be validated against an oracle (e.g., a test suite). Because such an oracle can be imperfect, the generated patches, although validated by the oracle, may actually be incorrect. While the state-of-the-art explores research directions that require dynamic information or rely on manually-crafted heuristics, we study the benefit of learning code representations in order to learn deep features that may encode the properties of patch correctness. Our empirical work investigates different representation learning approaches for code changes to derive embeddings that are amenable to similarity computations of patch correctness identification, and assess the possibility of accurate classification of correct patch by combining learned embeddings with engineered features. Experimental results demonstrate the potential of learned embeddings to empower Leopard (a patch correctness predicting framework implemented in this work) with learning algorithms in reasoning about patch correctness: a machine learning predictor with BERT transformer-based learned embeddings associated with XGBoost achieves an AUC value of about 0.803 in the prediction of patch correctness on a new dataset of 2,147 labeled patches that we collected for the experiments. Our investigations show that deep learned embeddings can lead to complementary/better performance when comparing against the state-of-the-art, PATCH-SIM, which relies on dynamic information. By combining deep learned embeddings and engineered features, Panther (the upgraded version of Leopard implemented in this work) outperforms Leopard with higher scores in terms of AUC, +Recall and -Recall, and can accurately identify more (in)correct patches that cannot be predicted by the classifiers only with learned embeddings or engineered features. Finally, we use an explainable ML technique, SHAP, to empirically interpret how the learned embeddings and engineered features are contributed to the patch correctness prediction.
引用
收藏
页数:34
相关论文
共 77 条
[1]   A Survey of Machine Learning for Big Code and Naturalness [J].
Allamanis, Miltiadis ;
Barr, Earl T. ;
Devanbu, Premkumar ;
Sutton, Charles .
ACM COMPUTING SURVEYS, 2018, 51 (04)
[2]   code2vec: Learning Distributed Representations of Code [J].
Alon, Uri ;
Zilberstein, Meital ;
Levy, Omer ;
Yahav, Eran .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (POPL)
[3]   Getafix: Learning to Fix Bugs Automatically [J].
Bader, Johannes ;
Scott, Andrew ;
Pradel, Michael ;
Chandra, Satish .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (OOPSLA)
[4]   The Plastic Surgery Hypothesis [J].
Barr, Earl T. ;
Brun, Yuriy ;
Devanbu, Premkumar ;
Harman, Mark ;
Sarro, Federica .
22ND ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (FSE 2014), 2014, :306-317
[5]  
Chen JJ, 2018, Dagstuhl reports, V7, P65, DOI [10.4230/dagrep.7.12.50, 10.4230/DagRep.7.12.50, DOI 10.4230/DAGREP.7.12.50]
[6]  
Cheng H. T., 2016, P 1 WORKSH DEEP LEAR, P7, DOI DOI 10.1145/2988450.2988454
[7]  
Csuvik V, 2020, PROCEEDINGS OF THE 2020 IEEE 2ND INTERNATIONAL WORKSHOP ON INTELLIGENT BUG FIXING (IBF '20), P18, DOI [10.1109/ibf50092.2020.9034714, 10.1109/IBF50092.2020.9034714]
[8]  
Devlin J, 2019, 2019 CONFERENCE OF THE NORTH AMERICAN CHAPTER OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS: HUMAN LANGUAGE TECHNOLOGIES (NAACL HLT 2019), VOL. 1, P4171
[9]   Approximate statistical tests for comparing supervised classification learning algorithms [J].
Dietterich, TG .
NEURAL COMPUTATION, 1998, 10 (07) :1895-1923
[10]   Empirical Review of Java']Java Program Repair Tools: A Large-Scale Experiment on 2,141 Bugs and 23,551 Repair Attempts [J].
Durieux, Thomas ;
Madeiral, Fernanda ;
Martinez, Matias ;
Abreu, Rui .
ESEC/FSE'2019: PROCEEDINGS OF THE 2019 27TH ACM JOINT MEETING ON EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING, 2019, :302-313