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

面向无测试故障定位的大语言模型

Large Language Models for Test-Free Fault Localization

Carnegie Mellon University(卡内基梅隆大学)

Aidan Z. H. Yang, Ruben Martins, Claire Le Goues, Vincent J. Hellendoorn

AI总结:

本研究针对传统故障定位依赖测试用例的问题,提出在大语言模型上添加双向适配器层的LLMAO方法,无需测试覆盖信息即可行级定位缺陷,在Defects4J等数据集上性能随模型规模提升,显著优于现有MLFL基准,还可实现行级安全漏洞检测。

摘要:

故障定位(FL)旨在自动定位有缺陷的代码行,是许多手动和自动调试任务中关键的第一步。以往的FL技术假设存在输入测试用例,且通常需要大量程序分析、程序插桩或数据预处理。此前用于自动程序修复(APR)的深度学习方法难以从小规模数据集中学习,在真实世界程序上的效果有限。受代码大语言模型(LLM)仅需少量示例即可适配新任务的能力启发,我们探究了LLM在行级故障定位中的适用性。具体而言,我们提出通过在LLM学习到的表示之上微调少量双向适配器层,来克服LLM的从左到右生成特性,由此构建出LLMAO——这是首个基于语言模型的故障定位方法,无需任何测试覆盖信息即可定位缺陷代码行。我们在人工整理的小规模缺陷程序语料库(如Defects4J语料库)上,分别微调了参数量为3.5亿、60亿和160亿的LLM。我们观察到,当基于更大规模的模型构建时,该技术的故障定位置信度显著提升,缺陷定位性能随LLM规模增大持续提升。我们的实证评估表明,LLMAO的Top-1结果相比当前最优的机器学习故障定位(MLFL)基准提升了2.3%-54.4%,Top-5结果提升了14.4%-35.6%。LLMAO也是首个采用语言模型架构训练、可将安全漏洞检测精确到代码行级别的FL技术。

英文摘要:

Fault Localization (FL) aims to automatically localize buggy lines of code, a key first step in many manual and automatic debugging tasks. Previous FL techniques assume the provision of input tests, and often require extensive program analysis, program instrumentation, or data preprocessing. Prior work on deep learning for APR struggles to learn from small datasets and produces limited results on real-world programs. Inspired by the ability of large language models (LLMs) of code to adapt to new tasks based on very few examples, we investigate the applicability of LLMs to line level fault localization. Specifically, we propose to overcome the left-to-right nature of LLMs by fine-tuning a small set of bidirectional adapter layers on top of the representations learned by LLMs to produce LLMAO, the first language model based fault localization approach that locates buggy lines of code without any test coverage information. We fine-tune LLMs with 350 million, 6 billion, and 16 billion parameters on small, manually curated corpora of buggy programs such as the Defects4J corpus. We observe that our technique achieves substantially more confidence in fault localization when built on the larger models, with bug localization performance scaling consistently with the LLM size. Our empirical evaluation shows that LLMAO improves the Top-1 results over the state-of-the-art machine learning fault localization (MLFL) baselines by 2.3%-54.4%, and Top-5 results by 14.4%-35.6%. LLMAO is also the first FL technique trained using a language model architecture that can detect security vulnerabilities down to the code line level.

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

↑