Software clones are often introduced when developers reuse code fragments to implement similar functionalities in the same or different software systems. Many high-performing clone detection tools today are based on deep learning techniques and are mostly used for detecting clones written in the same programming language, whereas clone detection tools for detecting cross-language clones are also emerging rapidly. The popularity of deep learning-based clone detection tools creates an opportunity to investigate how known strategies that boost the performances of deep learning models could be further leveraged to improve clone detection tools. In this paper, we investigate such a strategy, data augmentation, which has not yet been explored for cross-language clone detection as opposed to single-language clone detection. We show how the existing knowledge on transcompilers (source-to-source translators) can be used for data augmentation to boost the performance of cross-language clone detection models, as well as to adapt single-language clone detection models to create cross-language clone detection pipelines. To demonstrate the performance boost for cross-language clone detection through data augmentation, we exploit Transcoder, which is a pre-trained source-to-source translator. To show how to extend single-language models for cross-language clone detection, we extend a popular single-language model, Graph Matching Network (GMN) in a combination with the transcompilers. We evaluated our models on popular benchmark datasets. Our experimental results showed improvements in F1 scores (sometimes up to 3%) for the cutting-edge cross-language clone detection models. Even when extending GMN for cross-language clone detection, the models built leveraging data augmentation outperformed the baseline with scores of 0.90, 0.92, and 0.91 for precision, recall, and F1 score, respectively.
翻译:软件开发者在同一或不同软件系统中复用代码片段以实现相似功能时,常引入软件克隆。当前许多高性能克隆检测工具基于深度学习技术,主要用于检测同一编程语言编写的克隆,而检测跨语言克隆的工具也正迅速发展。基于深度学习的克隆检测工具的普及,为研究如何进一步利用已知的深度学习模型性能提升策略来改进克隆检测工具创造了契机。本文针对跨语言克隆检测中尚未探索的数据增强策略展开研究(与单语言克隆检测不同)。我们展示了如何利用现有的转译器(源到源翻译器)知识进行数据增强,以提升跨语言克隆检测模型的性能,并将单语言克隆检测模型适配为跨语言克隆检测流水线。为验证通过数据增强提升跨语言克隆检测性能的效果,我们利用了预训练的源到源翻译器Transcoder。为展示如何将单语言模型扩展至跨语言克隆检测,我们结合转译器扩展了流行的单语言模型——图匹配网络(GMN)。我们在主流基准数据集上评估了模型性能。实验结果表明,前沿跨语言克隆检测模型的F1分数得到提升(最高提升3%)。即使将GMN扩展用于跨语言克隆检测时,基于数据增强构建的模型仍以精确率0.90、召回率0.92、F1分数0.91的成绩超越基线。