arrow
返回

Evaluating few-shot and contrastive learning methods for code clone detection

delete2024-10-09
delete1
PRE
AI
M
Mohamad Khajezade *
F
Fatemeh H. Fard
M
Mohamed Shehata
DOI:10.1007/s10664-024-10441-zdelete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
ContextCode Clone Detection (CCD) is a software engineering task that is used for plagiarism detection, code search, and code comprehension. Recently, deep learning-based models have achieved an F1-Score (a metric used to assess classifiers) of similar to\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sim $$\end{document}95% on the CodeXGLUE benchmark. These models require many training data, mainly fine-tuned on Java or C++ datasets. However, no previous study evaluates the generalizability of these models where a limited amount of annotated data is available.ObjectiveThe main objective of this research is to assess the ability of the CCD models as well as few-shot learning algorithms for unseen programming problems and new languages (i.e., the model is not trained on these problems/languages).MethodWe assess the generalizability of the state-of-the-art models for CCD in few-shot settings (i.e., only a few samples are available for fine-tuning) by setting three scenarios: i) unseen problems, ii) unseen languages, iii) combination of new languages and new problems. We choose CodeNet and conduct our experiments on Java, C++, and Ruby languages. Then, we employ Model Agnostic Meta-learning (MAML), where the model learns a meta-learner capable of extracting transferable knowledge from the train set; so that the model can be fine-tuned using a few samples. Finally, we combine contrastive learning with MAML to further study whether it can improve the results of MAML.ResultsOur results show that the performance of the models drops similar to 50%\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sim 50\%$$\end{document} for Java and similar to 20%\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sim 20\%$$\end{document} for C++ and Ruby for unseen problems, which are then boosted by 13%\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$13\%$$\end{document} to 24%\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$24\%$$\end{document} F1 scores for Java and C++/Ruby, respectively when MAML is used. Similar observations are found for unseen languages and the third scenario. Though in case of third scenario (i.e., unseen problems and unseen languages) the scores are lower. Integrating contrastive learning with MAML did not help in boosting the performance more than what we could achieve with MAML. Our results open new avenues of research and the need to develop robust models for clone detection, in the settings we investigated here.
Keyword:
Contrastive learning
Few-shot learning
Code clone detection

期刊

Empirical Software Engineering 封面图
Empirical Software Engineering
IF:
3.6
论文数:
2.0K
被引数:
5.3K

机构

U
University of British Columbia
学者数:
7.0W
论文数: 6.1W
被引数: 8.6W
引用论文

引用论文

err分享
err收藏
Graph-based few-shot learning with transformed feature propagation and optimal class allocation
err2022-01-01
err61
PREAI
errZhang, Ruiheng; Yang, Shuo; Zhang, Qi; Xu, Lixin; He, Yang; Zhang, Fan
err分享
err收藏
Caveolin-1 and -2 regulate cell motility in castration-resistant prostate cancer
err2018-10-01
err0
errOAAI
errToyoharu Kamibeppu; Koji Yamasaki; Kozue Nakahara; Takahiro Nagai; Naoki Terada; Hiromasa Tsukino; Shoichiro Mukai; Toshiyuki Kamoto
err分享
err收藏
Targets of cGMP/cGKI in Cardiac Myocytes
err2020-06-01
err0
PREAI
errJulia Adler; Anna Kuret; Natalie Längst; Robert Lukowski
err分享
err收藏
学者 查看更多内容