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

评估大型语言模型的代码克隆检测能力

Assessing the Code Clone Detection Capability of Large Language Models

School of Computer Science, University of Galway(戈尔韦大学计算机科学学院);CRT-AI, the Science Foundation Ireland Centre for Research Training in Artificial Intelligence(爱尔兰科学基金会人工智能研究培训中心(CRT-AI));Lero, the Science Foundation Ireland Research Centre for Software(爱尔兰科学基金会软件研究中心(Lero))

Zixian Zhang, Takfarinas Saber

AI总结:

本文在BigCloneBench与GPTCloneBench上评估GPT-3.5和GPT-4的代码克隆检测能力,发现GPT-4更优但Type-4检测薄弱,且模型偏向识别LLM生成克隆。

摘要:

本研究旨在评估两款先进大型语言模型(LLM)——GPT-3.5和GPT-4——在代码克隆检测任务中的表现。评估过程在多种代码对上测试这些模型,这些代码对具有不同的克隆类型和相似程度,来源于两个数据集:人工构建的BigCloneBench和LLM生成的GPTCloneBench。研究结果表明,GPT-4在所有克隆类型上均持续优于GPT-3.5。研究观察到GPT模型识别代码克隆的准确率与代码相似性之间存在相关性,两款GPT模型在检测最复杂的Type-4代码克隆时均表现出较低的有效性。此外,与识别人工生成代码中的克隆相比,GPT模型在识别LLM生成代码中的克隆时表现出更高性能;然而,它们仍未达到令人满意的准确率。这些结果强调,必须持续提升LLM能力,尤其是在代码克隆识别以及缓解其偏向自生成代码克隆的倾向方面——随着越来越多软件工程师利用支持LLM的代码生成和代码重构工具,这很可能成为一个问题。

英文摘要:

This study aims to assess the performance of two advanced Large Language Models (LLMs), GPT-3.5 and GPT-4, in the task of code clone detection. The evaluation involves testing the models on a variety of code pairs of different clone types and levels of similarity, sourced from two datasets: BigCloneBench (human-made) and GPTCloneBench (LLM-generated). Findings from the study indicate that GPT-4 consistently surpasses GPT-3.5 across all clone types. A correlation was observed between the GPTs' accuracy at identifying code clones and code similarity, with both GPT models exhibiting low effectiveness in detecting the most complex Type-4 code clones. Additionally, GPT models demonstrate a higher performance identifying code clones in LLM-generated code compared to humans-generated code. However, they do not reach impressive accuracy. These results emphasize the imperative for ongoing enhancements in LLM capabilities, particularly in the recognition of code clones and in mitigating their predisposition towards self-generated code clones--which is likely to become an issue as software engineers are more numerous to leverage LLM-enabled code generation and code refactoring tools.

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

↑