Skip to main content
QUICK REVIEW

[论文解读] Large Language Models in Fault Localisation

Yonghao Wu, Zheng Li|arXiv (Cornell University)|Aug 29, 2023
Software Engineering ResearchComputer Science被引用 18
一句话总结

本研究在 Defects4J 上评估 ChatGPT-3.5 和 ChatGPT-4 的故障定位能力,发现 ChatGPT-4 (Log) 在函数级上下文中提供了最佳 TOP-1 表现,但在类级上下文下效果显著下降;补充的错误日志提高了准确性和一致性。

ABSTRACT

Large Language Models (LLMs) have shown promise in multiple software engineering tasks including code generation, program repair, code summarisation, and test generation. Fault localisation is instrumental in enabling automated debugging and repair of programs and was prominently featured as a highlight during the launch event of ChatGPT-4. Nevertheless, the performance of LLMs compared to state-of-the-art methods, as well as the impact of prompt design and context length on their efficacy, remains unclear. To fill this gap, this paper presents an in-depth investigation into the capability of ChatGPT-3.5 and ChatGPT-4, the two state-of-the-art LLMs, on fault localisation. Using the widely-adopted large-scale Defects4J dataset, we compare the two LLMs with the existing fault localisation techniques. We also investigate the consistency of LLMs in fault localisation, as well as how prompt engineering and the length of code context affect the fault localisation effectiveness. Our findings demonstrate that within function-level context, ChatGPT-4 outperforms all the existing fault localisation methods. Additional error logs can further improve ChatGPT models' localisation accuracy and consistency, with an average 46.9% higher accuracy over the state-of-the-art baseline SmartFL on the Defects4J dataset in terms of TOP-1 metric. However, when the code context of the Defects4J dataset expands to the class-level, ChatGPT-4's performance suffers a significant drop, with 49.9% lower accuracy than SmartFL under TOP-1 metric. These observations indicate that although ChatGPT can effectively localise faults under specific conditions, limitations are evident. Further research is needed to fully harness the potential of LLMs like ChatGPT for practical fault localisation applications.

研究动机与目标

  • 评估 ChatGPT-3.5 和 ChatGPT-4 在 Defects4J 的真实世界缺陷故障定位能力。
  • 将基于 ChatGPT 的定位与最先进基线方法(SBFL、MBFL、SmartFL)进行比较。
  • 研究提示设计与代码上下文长度对定位有效性的影响。
  • 评估在重复实验中的一致性,并测试错误日志与上下文对定位的影响。
  • 通过扩展到 StuDefects(一组更新的数据集)来解决过拟合担忧并进行更广泛的评估。

提出的方法

  • 使用六个 Defects4J Java 项目来评估故障定位技术。
  • 比较 SBFL(Ochiai、Dstar)、MBFL(基于 Metallaxis 的)、SmartFL,以及四种 ChatGPT 配置(ChatGPT-3.5/4 与 Origin/Log 提示)。
  • 采用函数级代码上下文以适配大语言模型的令牌限制,使 ChatGPT 的上下文与基线匹配。
  • 提示包含一个 origin 版本(仅目标函数)和一个 log 版本(对话中的故障日志和错误信息)。
  • 使用 TOP-N(TOP-1 到 TOP-5)进行评估,并对五次重复取平均;使用 Wilcoxon 符号秩检验来判断显著性。
  • 将分析扩展到 StuDefects,以测试 Defects4J 之外的泛化能力。

实验结果

研究问题

  • RQ1RQ1. 与最先进基线相比,ChatGPT 在故障定位中的表现如何?
  • RQ2RQ1.1 使用 TOP-N 指标,ChatGPT-3.5 与 ChatGPT-4 在 Defects4J 上的表现如何?
  • RQ3RQ1.2 ChatGPT 的故障定位在重复实验中的一致性如何?
  • RQ4RQ2 提示设计(包括或排除各组件)如何影响 ChatGPT 的故障定位性能?
  • RQ5RQ3 提示中代码上下文的长度如何影响 ChatGPT 的性能?

主要发现

  • ChatGPT-4 (Log) 在 Defects4J 上的平均最高 TOP-1 为 23.13,较 SmartFL 提升 46.9%。
  • ChatGPT-4 (Log) 在 Defects4J 的 TOP-1 至 TOP-5 的 TOP-N 值普遍高于其他配置。
  • ChatGPT-4 (Log) 与其他方法的重叠度最高,并识别出许多其他基线未覆盖的独有缺陷。
  • 将代码上下文从函数级扩展到类级显著降低 ChatGPT-4 的效果,与 SmartFL 相比 TOP-1 下降 49.9%。
  • 将错误日志并入提示是最具影响力的组成部分;若省略,准确性下降 25.6%。
  • 扩展到 StuDefects 的评估结果与 Defects4J 一致,ChatGPT-4 (Log) 在 TOP-1 上对最先进方法的优势约为 52.9%。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。