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

探究大语言模型在代码克隆检测中的效能

Investigating the Efficacy of Large Language Models for Code Clone Detection

University of British Columbia(不列颠哥伦比亚大学)

Mohamad Khajezade, Jie JW Wu, Fatemeh Hendijani Fard, Gema Rodríguez-Pérez, Mohamed Sami Shehata

AI总结:

本研究探索大语言模型在非生成式代码克隆检测任务中的适用性,基于CodeNet构建数据集测试ChatGPT的零样本检测效果,发现其跨语言表现超基线、单语言性能媲美微调模型,并分析了影响因素与未来方向。

摘要:

大语言模型(LLMs)已在代码生成等各类自然语言处理与软件工程任务中展现出显著成效,这类模型主要以基于提示的零样本/少样本范式被用于引导完成任务。基于GPT的模型是代码注释生成、测试生成等任务中广受研究的一类模型,这些任务都属于“生成式”任务。然而,针对基于提示的范式将LLMs用于分类等“非生成式”任务的研究仍较为有限。\n在这项初步探索性研究中,我们探究了LLMs在非生成式任务——代码克隆检测(Code Clone Detection, CCD)中的适用性。我们基于CodeNet构建了单语言与跨语言CCD数据集,首先采用ChatGPT设计两种不同提示,在零样本设置下检测Java-Java与Java-Ruby代码对中的Type-4代码克隆,随后开展分析以明确ChatGPT在CCD任务中的优势与不足。实验结果显示,ChatGPT在跨语言CCD任务中超越基线模型,F1值达0.877;在单语言CCD任务中F1值为0.878,性能与完全微调的模型相当。此外,提示设计与问题难度均会对ChatGPT的性能产生影响。最后,我们基于初步分析提出了相关见解与未来研究方向。

英文摘要:

Large Language Models (LLMs) have demonstrated remarkable success in various natural language processing and software engineering tasks, such as code generation. The LLMs are mainly utilized in the prompt-based zero/few-shot paradigm to guide the model in accomplishing the task. GPT-based models are one of the popular ones studied for tasks such as code comment generation or test generation. These tasks are `generative' tasks. However, there is limited research on the usage of LLMs for `non-generative' tasks such as classification using the prompt-based paradigm. In this preliminary exploratory study, we investigated the applicability of LLMs for Code Clone Detection (CCD), a non-generative task. By building a mono-lingual and cross-lingual CCD dataset derived from CodeNet, we first investigated two different prompts using ChatGPT to detect Type-4 code clones in Java-Java and Java-Ruby pairs in a zero-shot setting. We then conducted an analysis to understand the strengths and weaknesses of ChatGPT in CCD. ChatGPT surpasses the baselines in cross-language CCD attaining an F1-score of 0.877 and achieves comparable performance to fully fine-tuned models for mono-lingual CCD, with an F1-score of 0.878. Also, the prompt and the difficulty level of the problems has an impact on the performance of ChatGPT. Finally we provide insights and future directions based on our initial analysis

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

↑