一句话:论文实验比较 LLM 与嵌入分类器在跨语言代码克隆检测上的表现,发现嵌入模型更稳健。
跨语言代码克隆检测因多语言软件开发而受到关注,近期 LLM 进展促使重新审视该问题。本文在 XLCoST 与 CodeNet 数据集上评估四种 LLM、八种提示以及一个预训练嵌入模型用于克隆对分类的表现。结果显示,LLM 在简单程序示例上 F1 可达 0.98,但在复杂案例和跨语言理解上表现不佳;嵌入模型将不同语言代码片段映射到共享表示空间,基于其训练的基础分类器在 XLCoST 和 CodeNet 上分别约高出 LLM 2 和 24 个百分点,表明嵌入表示更稳健,可实现跨语言代码克隆检测的先进性能。
Cross-lingual code clone detection has gained attention in software development due to the use of multiple programming languages. Recent advances in machine learning, particularly Large Language Models (LLMs), have motivated a reexamination of this problem.This paper evaluates the performance of four LLMs and eight prompts for detecting cross-lingual code clones, as well as a pre-trained embedding model for classifying clone pairs. Both approaches are tested on the XLCoST and CodeNet datasets.Our findings show that while LLMs achieve high F1 scores (up to 0.98) on straightforward programming examples, they struggle with complex cases and cross-lingual understanding. In contrast, embedding models, which map code fragments from different languages into a common representation space, allow for the training of a basic classifier that outperforms LLMs by approximately 2 and 24 percentage points on the XLCoST and CodeNet datasets, respectively. This suggests that embedding models provide more robust representations, enabling state-of-the-art performance in cross-lingual code clone detection.
@inproceedings{MoumoulaKKB24,
title = {Cross-lingual Code Clone Detection: When LLMs Fail Short Against Embedding-based Classifier},
author = {Micheline Benedicte Moumoula and Abdoul Kader Kabore and Jacques Klein and Tegawende F. Bissyande},
booktitle = {ASE},
year = {2024},
doi = {10.1145/3691620.3695335}
}