Skip to main content
QUICK REVIEW

[Paper Review] Large Language Models in Fault Localisation

Yonghao Wu, Zheng Li|arXiv (Cornell University)|Aug 29, 2023
Software Engineering ResearchComputer Science18 citations
TL;DR

The study evaluates ChatGPT-3.5 and ChatGPT-4 for fault localisation on Defects4J, finding ChatGPT-4 (Log) delivers the best TOP-1 performance within function-level context, but its effectiveness drops substantially with class-level context; supplementary error logs improve accuracy and consistency.

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.

Motivation & Objective

  • Assess the capability of ChatGPT-3.5 and ChatGPT-4 in fault localisation on real-world bugs from Defects4J.
  • Compare ChatGPT-based localisation to state-of-the-art baselines (SBFL, MBFL, SmartFL).
  • Investigate prompt design and code context length on localisation effectiveness.
  • Evaluate consistency across repeated experiments and test the impact of error logs and context on localisation.
  • Address overfitting concerns by extending evaluation to StuDefects, a more recent dataset.

Proposed method

  • Use six Defects4J Java projects to evaluate fault localisation techniques.
  • Compare SBFL (Ochiai, Dstar), MBFL (Metallaxis-based), SmartFL, and four ChatGPT configurations (ChatGPT-3.5/4 with Origin/Log prompts).
  • Employ function-level code context to fit token limits of LLMs, matching ChatGPT context to baselines.
  • Prompts include an origin version (target function only) and a log version (failure log and error messages in dialog).
  • Evaluate using TOP-N (TOP-1 to TOP-5) and average across five repeats; use Wilcoxon signed-rank tests for significance.
  • Extend analysis to StuDefects to test generalisability beyond Defects4J.

Experimental results

Research questions

  • RQ1RQ1. How does ChatGPT perform in fault localisation compared to state-of-the-art baselines?
  • RQ2RQ1.1 How does ChatGPT-3.5 and ChatGPT-4 perform on Defects4J using TOP-N metrics?
  • RQ3RQ1.2 How consistent is ChatGPT’s fault localisation across repeated experiments?
  • RQ4RQ2 How does prompt design (including or excluding components) affect ChatGPT’s fault localisation performance?
  • RQ5RQ3 How does the length of code context in prompts influence ChatGPT’s performance?

Key findings

  • ChatGPT-4 (Log) achieves the best mean TOP-1 of 23.13, outperforming SmartFL by 46.9% on Defects4J.
  • ChatGPT-4 (Log) shows higher TOP-N values across TOP-1 to TOP-5 compared to other configurations on Defects4J.
  • ChatGPT-4 (Log) exhibits the highest overlap with other methods and identifies many unique faults not captured by other baselines.
  • Expanding code context from function-level to class-level significantly reduces ChatGPT-4’s effectiveness, with a 49.9% drop in TOP-1 compared to SmartFL.
  • Incorporating error logs into prompts is the most impactful component, with a 25.6% decrease in accuracy if omitted.
  • The extended StuDefects evaluation yields results consistent with Defects4J, with ChatGPT-4 (Log) achieving around 52.9% superiority over the state-of-the-art in TOP-1.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.