Large Language Models for Test-Free Fault Localization
作者: Aidan Z. H. Yang, Ruben Martins, Claire Le Goues, Vincent J. Hellendoorn
分类: cs.SE, cs.LG
发布日期: 2023-10-03
💡 一句话要点
提出LLMAO以解决无测试覆盖的故障定位问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 故障定位 大型语言模型 自动程序修复 深度学习 代码分析
📋 核心要点
- 现有的故障定位技术依赖于输入测试,导致在没有测试覆盖信息时效果不佳。
- 本文提出LLMAO,通过在LLMs上微调双向适配层,克服了LLMs的单向特性,实现无测试覆盖的故障定位。
- 实验表明,LLMAO在故障定位的Top-1结果上比最先进的机器学习基线提高了2.3%-54.4%。
📝 摘要(中文)
故障定位(FL)旨在自动定位代码中的错误行,这是许多手动和自动调试任务的关键第一步。以往的FL技术假设提供输入测试,并且通常需要广泛的程序分析、程序插桩或数据预处理。深度学习在自动程序修复(APR)中的应用面临小数据集学习困难的问题。本文提出LLMAO,利用大型语言模型(LLMs)进行行级故障定位,首次在没有测试覆盖信息的情况下定位错误行。通过对350百万、60亿和160亿参数的LLMs进行微调,实验结果表明,LLMAO在故障定位性能上显著优于现有的机器学习故障定位基线。
🔬 方法详解
问题定义:本文解决的具体问题是如何在没有测试覆盖信息的情况下进行故障定位。现有方法通常依赖于输入测试,导致在缺乏测试的情况下定位效果不佳。
核心思路:论文的核心思路是利用大型语言模型(LLMs)在小样本情况下的适应能力,通过微调双向适配层来实现行级故障定位。这样的设计使得模型能够更好地理解代码上下文,从而提高定位准确性。
技术框架:整体架构包括对LLMs进行微调,使用350百万、60亿和160亿参数的模型,结合手动整理的缺陷程序数据集(如Defects4J),通过双向适配层增强模型的表示能力。
关键创新:最重要的技术创新在于LLMAO是首个基于语言模型架构的故障定位技术,能够在没有测试覆盖的情况下进行代码行级的错误检测,这在以往的研究中是未曾实现的。
关键设计:在微调过程中,采用了特定的损失函数和网络结构设计,以确保模型能够有效学习到代码中的错误模式。具体的参数设置和训练策略也经过精心设计,以适应小数据集的特点。
📊 实验亮点
实验结果显示,LLMAO在故障定位的Top-1结果上比现有的机器学习故障定位基线提高了2.3%-54.4%,Top-5结果提高了14.4%-35.6%。这表明LLMAO在大型语言模型的支持下,能够显著提升故障定位的性能。
🎯 应用场景
该研究的潜在应用领域包括软件开发、自动化测试和安全审计等。通过提高故障定位的准确性,LLMAO可以显著减少开发人员的调试时间,提升软件质量。同时,能够检测安全漏洞的能力为代码安全性提供了新的保障,具有重要的实际价值和未来影响。
📄 摘要(原文)
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.