arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2204.07501cs.SE
收藏

评估用于代码克隆检测的少样本与对比学习方法

Evaluating few shot and Contrastive learning Methods for Code Clone Detection

Mohamad Khajezade, Fatemeh Hendijani Fard, Mohamed S. Shehata

AI总结:

该研究针对代码克隆检测模型在标注数据有限时的泛化问题,设置三类少样本场景,结合MAML与对比学习,评估模型在未见过的问题和新编程语言下的检测能力。

摘要:

研究背景:代码克隆检测(Code Clone Detection,CCD)是软件工程领域的一项任务,应用于抄袭检测、代码搜索与代码理解。近年来,基于深度学习的模型在CodeXGLUE基准上取得了约95%的F1值(一种用于评估分类器的指标)。这类模型需要大量训练数据,主要在Java或C++数据集上进行微调。但此前尚无研究评估这些模型在标注数据有限场景下的泛化能力。研究目标:本研究的核心目标是评估CCD模型以及少样本学习算法针对未见过的编程问题与新编程语言(即模型未在这些问题/语言上训练过)的适配能力。研究方法:我们设置了三种场景来评估前沿CCD模型在少样本设定(即仅少量样本可供微调)下的泛化性:1)未见过的问题,2)未见过的语言,3)新语言与新问题的组合。我们选用BigCloneBench、POJ-104、CodeNet三个数据集,涉及Java、C++、Ruby三种语言。随后我们采用模型无关元学习(Model Agnostic Meta-learning,MAML),该方法会让模型学习一个能从训练集中提取可迁移知识的元学习器,从而使模型仅需少量样本即可完成微调。最后我们将对比学习与MAML相结合,进一步探究其是否能提升MAML的效果。

英文摘要:

Context: Code 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 $\sim$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. Objective: The 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). Method: We 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 three datasets of BigCloneBench, POJ-104, and CodeNet and 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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑