Interpreting CodeBERT for Semantic Code Clone Detection

被引:6
作者
Abid, Shamsa [1 ]
Cai, Xuemeng [1 ]
Jiang, Lingxiao [1 ]
机构
[1] Singapore Management Univ, Sch Comp & Informat Syst, Singapore, Singapore
来源
PROCEEDINGS OF THE 2023 30TH ASIA-PACIFIC SOFTWARE ENGINEERING CONFERENCE, APSEC 2023 | 2023年
关键词
Explainable AI; Model Interpretation; Blackbox; Semantic Clone Detection; Code Model; Deep Learning;
D O I
10.1109/APSEC60848.2023.00033
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Accurate detection of semantic code clones has many applications in software engineering but is challenging because of lexical, syntactic, or structural dissimilarities in code. CodeBERT, a popular deep neural network based pre-trained code model, can detect code clones with a high accuracy. However, its performance on unseen data is reported to be lower. A challenge is to interpret CodeBERT's clone detection behavior and isolate the causes of mispredictions. In this paper, we evaluate CodeBERT and interpret its clone detection behavior on the SemanticCloneBench dataset focusing on Java and Python clone pairs. We introduce the use of a black-box model interpretation technique, SHAP, to identify the core features of code that CodeBERT pays attention to for clone prediction. We first perform a manual similarity analysis over a sample of clone pairs to revise clone labels and to assign labels to statements indicating their contribution to core functionality. We then evaluate the correlation between the human and model's interpretation of core features of code as a measure of CodeBERT's trustworthiness. We observe only a weak correlation. Finally, we present examples on how to identify causes of mispredictions for CodeBERT. Our technique can help researchers to assess and fine-tune their models' performance.
引用
收藏
页码:229 / 238
页数:10
相关论文
共 36 条
[1]  
Al-omari F, 2020, INT WORKS SOFTW CLON, P57, DOI [10.1109/IWSC50091.2020.9047643, 10.1109/iwsc50091.2020.9047643]
[2]  
[Anonymous], 2022, Stackoverflow
[3]  
[Anonymous], 2022, SHAP KernelExplainer
[4]  
[Anonymous], 2021, BigCloneBench-Dataset
[5]  
[Anonymous], 2023, CloneSHAP Interpreter Code, Data and Results
[6]   CodeBERT for Code Clone Detection: A Replication Study [J].
Arshad, Saad ;
Abid, Shamsa ;
Shamail, Shafay .
2022 IEEE 16TH INTERNATIONAL WORKSHOP ON SOFTWARE CLONES (IWSC 2022), 2022, :39-45
[7]  
Cito J, 2022, 2022 ACM/IEEE 44TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING: SOFTWARE ENGINEERING IN PRACTICE (ICSE-SEIP 2022), P125, DOI [10.1109/ICSE-SEIP55303.2022.9794112, 10.1145/3510457.3513081]
[8]   Explaining Mispredictions of Machine Learning Models using Rule Induction [J].
Cito, Juergen ;
Dillig, Isil ;
Kim, Seohyun ;
Murali, Vijayaraghavan ;
Chandra, Satish .
PROCEEDINGS OF THE 29TH ACM JOINT MEETING ON EUROPEAN SOFTWARE ENGINEERING CONFERENCE AND SYMPOSIUM ON THE FOUNDATIONS OF SOFTWARE ENGINEERING (ESEC/FSE '21), 2021, :716-727
[9]  
Doshi-Velez F, 2017, Arxiv, DOI [arXiv:1702.08608, 10.48550/arXiv.1702.08608]
[10]   Functional Code Clone Detection with Syntax and Semantics Fusion Learning [J].
Fang, Chunrong ;
Liu, Zixi ;
Shi, Yangyang ;
Huang, Jeff ;
Shi, Qingkai .
PROCEEDINGS OF THE 29TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS, ISSTA 2020, 2020, :516-527