arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.14739cs.SEcs.LG
收藏

关于使用深度学习模型进行语义克隆检测的研究

On the Use of Deep Learning Models for Semantic Clone Detection

University of Saskatchewan(萨斯喀彻温大学)

Subroto Nag Pinku, Debajyoti Mondal, Chanchal K. Roy

AI总结:

本文提出一种多步评估方法,利用现有基准数据集和变异算子,对五种最先进的单语言与跨语言代码克隆检测模型进行鲁棒性与性能比较,发现跨语言模型C4在语义克隆检测上表现更优且更稳定。

摘要:

检测和跟踪代码克隆可以在代码片段的变更需要传播到其所有副本时,简化各种软件开发和维护任务。文献中已经出现了几种基于深度学习的克隆检测模型用于检测语法和语义克隆,并广泛使用 BigCloneBench 数据集进行评估。然而,类别不平衡和语义克隆数量较少使得 BigCloneBench 在解释模型性能方面不够理想。研究人员还使用其他数据集,如 GoogleCodeJam、OJClone 和 SemanticCloneBench,来了解模型的泛化能力。为了克服现有数据集的局限性,已发布了 GPT 辅助的语义和跨语言克隆数据集 GPTCloneBench。然而,这些模型在不同数据集上的比较情况仍不清楚。在本文中,我们提出了一种多步评估方法,利用现有的基准数据集(包括 GPTCloneBench)评估五种最先进的克隆检测模型,并使用变异算子研究模型的能力。具体而言,我们在 BigCloneBench、SemanticCloneBench 和 GPTCloneBench 上考察了三种高性能的单语言模型(ASTNN、GMN、CodeBERT),并通过变异操作测试了它们的鲁棒性。此外,我们将它们与以检测语义克隆著称的跨语言模型(C4、CLCDSA)进行了比较。虽然单语言模型在 BigCloneBench 上显示出较高的 F1 分数,但它们在 SemanticCloneBench 上的表现差异很大(高达 20%)。有趣的是,跨语言模型(C4)在 SemanticCloneBench 上表现出优于其他模型的性能(约 7%),并且在 BigCloneBench 和 GPTCloneBench 上表现相似。在基于变异的数据集上,与表现出高变异性的单语言模型相比,C4 具有更稳健的性能(差异小于 1%)。

英文摘要:

Detecting and tracking code clones can ease various software development and maintenance tasks when changes in a code fragment should be propagated over all its copies. Several deep learning-based clone detection models have appeared in the literature for detecting syntactic and semantic clones, widely evaluated with the BigCloneBench dataset. However, class imbalance and the small number of semantic clones make BigCloneBench less ideal for interpreting model performance. Researchers also use other datasets such as GoogleCodeJam, OJClone, and SemanticCloneBench to understand model generalizability. To overcome the limitations of existing datasets, the GPT-assisted semantic and cross-language clone dataset GPTCloneBench has been released. However, how these models compare across datasets remains unclear. In this paper, we propose a multi-step evaluation approach for five state-of-the-art clone detection models leveraging existing benchmark datasets, including GPTCloneBench, and using mutation operators to study model ability. Specifically, we examine three highly-performing single-language models (ASTNN, GMN, CodeBERT) on BigCloneBench, SemanticCloneBench, and GPTCloneBench, testing their robustness with mutation operations. Additionally, we compare them against cross-language models (C4, CLCDSA) known for detecting semantic clones. While single-language models show high F1 scores for BigCloneBench, their performance on SemanticCloneBench varies (up to 20%). Interestingly, the cross-language model (C4) shows superior performance (around 7%) on SemanticCloneBench over other models and performs similarly on BigCloneBench and GPTCloneBench. On mutation-based datasets, C4 has more robust performance (less than 1% difference) compared to single-language models, which show high variability.

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

↑