arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.15480cs.SEcs.AI
收藏

选择和组合大型语言模型用于可扩展的代码克隆检测

Selecting and Combining Large Language Models for Scalable Code Clone Detection

University of Limerick(利默里克大学);Trinity College Dublin(都柏林三一学院);Huawei Technologies Co., Ltd.(华为技术有限公司)

Muslim Chochlov, Gul Aftab Ahmed, James Vincent Patten, Yuanhua Han, Guoxian Lu, David Gregg, Jim Buckley

AI总结:

本文针对可扩展代码克隆检测,筛选76个LLM并评估,发现CodeT5+110M等表现最佳,且集成方法通过分数归一化和最大值/求和策略可进一步提升精确度至46.91%。

摘要:

源代码克隆带来的风险从知识产权侵犯到意外漏洞不等。有效且高效的可扩展克隆检测,特别是对于分化的克隆,仍然具有挑战性。大型语言模型(LLMs)最近已被应用于克隆检测任务。然而,LLMs的快速涌现引发了关于最优模型选择和潜在LLM集成效能的问题。本文通过识别76个LLMs并将其筛选为适合大规模克隆检测的候选模型,来解决第一个问题。这些候选模型在两个公共工业数据集BigCloneBench和一个商业大规模数据集上进行了评估。没有出现统一的“最佳LLM”,尽管CodeT5+110M、CuBERT和SPTCode是表现最好的。对LLM候选模型的分析表明,较小的嵌入大小、较小的分词器词汇表和定制的数据集是有利的。在商业大规模数据集上,表现最好的CodeT5+110M达到了39.71%的精确度:是先前使用的CodeBERT精确度的两倍。为了解决第二个问题,本文探讨了所选LLMs的集成:一种提高效果的高性价比方法。结果表明,分数归一化的重要性,以及倾向于使用最大值或求和等集成方法而非平均。此外,研究结果表明,集成方法在较大数据集上可以具有统计显著性和有效性:最佳性能的集成在商业大规模代码上比单个LLM实现了更高的精确度,达到46.91%。

英文摘要:

Source code clones pose risks ranging from intellectual property violations to unintended vulnerabilities. Effective and efficient scalable clone detection, especially for diverged clones, remains challenging. Large language models (LLMs) have recently been applied to clone detection tasks. However, the rapid emergence of LLMs raises questions about optimal model selection and potential LLM-ensemble efficacy. This paper addresses the first question by identifying 76 LLMs and filtering them down to suitable candidates for large-scale clone detection. The candidates were evaluated on two public industrial datasets, BigCloneBench, and a commercial large-scale dataset. No uniformly 'best-LLM' emerged, though CodeT5+110M, CuBERT and SPTCode were top-performers. Analysis of LLM-candidates suggested that smaller embedding sizes, smaller tokenizer vocabularies and tailored datasets are advantageous. On commercial large-scale dataset a top-performing CodeT5+110M achieved 39.71\% precision: twice the precision of previously used CodeBERT. To address the second question, this paper explores ensembling of the selected LLMs: effort-effective approach to improving effectiveness. Results suggest the importance of score normalization and favoring ensembling methods like maximum or sum over averaging. Also, findings indicate that ensembling approach can be statistically significant and effective on larger datasets: the best-performing ensemble achieved even higher precision of 46.91\% over individual LLM on the commercial large-scale code.

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

↑