arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2311.07957cs.SEcs.LG
收藏

通过代码对分类,语言模型是更优秀的缺陷检测器

Language Models are Better Bug Detector Through Code-Pair Classification

Georgia Institute of Technology(佐治亚理工学院)

Kamel Alrashedy, Ahmed Binjahlan

AI总结:

针对大语言模型微调成本高的问题,提出代码对分类缺陷检测任务,实验证明该任务比传统单片段缺陷检测更易完成,且现有大模型表现良好。

摘要:

GPT-3.5、CodeLlama等大语言模型(LLM)是代码生成与理解领域的强大模型。微调这类模型计算成本高昂,且需要大量标注数据集。作为替代方案,上下文学习技术仅需少量示例就能让模型学习下游任务。近期研究人员已证实上下文学习在缺陷检测与修复任务中表现出色。本文提出代码对分类任务:将存在缺陷和无缺陷的两个代码版本同时输入模型,由模型识别出有缺陷的代码。我们在真实世界缺陷检测数据集以及两款性能最强的LLM上评估了该任务。实验表明,LLM通常能从成对的代码中区分出有缺陷的版本;与给定单个代码片段、判断是否存在缺陷及缺陷位置的任务相比,代码对分类任务的难度要低得多。

英文摘要:

Large language models (LLMs) such as GPT-3.5 and CodeLlama are powerful models for code generation and understanding. Fine-tuning these models comes with a high computational cost and requires a large labeled dataset. Alternatively, in-context learning techniques allow models to learn downstream tasks with only a few examples. Recently, researchers have shown how in-context learning performs well in bug detection and repair. In this paper, we propose code-pair classification task in which both the buggy and non-buggy versions are given to the model, and the model identifies the buggy ones. We evaluate our task in real-world dataset of bug detection and two most powerful LLMs. Our experiments indicate that an LLM can often pick the buggy from the non-buggy version of the code, and the code-pair classification task is much easier compared to be given a snippet and deciding if and where a bug exists.

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

↑