Demystifying Faulty Code with LLM: Step-by-Step Reasoning for Explainable Fault Localization
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Fault localization is a critical process that involves identifying specific program elements responsible for program failures. Manually pinpointing these elements, such as classes, methods, or statements, which are associated with a fault is laborious and time-consuming. To overcome this challenge, various fault localization tools have been developed. These tools typically generate a ranked list of suspicious program elements. However, this information alone is insufficient. A prior study emphasized that automated fault localization should offer a rationale. In this study, we investigate the step-by-step reasoning for explainable fault localization. We explore the potential of Large Language Models (LLM) in assisting developers in reasoning about code. We proposed FuseFL that utilizes several combinations of information to enhance the LLM results which are spectrum-based fault localization results, test case execution outcomes, and code description (i.e., explanation of what the given code is intended to do). We conducted our investigation using faulty code from Refactory dataset. First, we evaluate the performance of the automated fault localization. Our results demonstrate a more than 30% increase in the number of successfully localized faults at Top-1 compared to the baseline. To evaluate the explanations generated by FuseFL, we create a dataset of human explanations that provide step-by-step reasoning as to why specific lines of code are considered faulty. This dataset consists of 324 faulty code files, along with explanations for 600 faulty lines. Furthermore, we also conducted human studies to evaluate the explanations. We found that for 22 out of the 30 randomly sampled cases, FuseFL generated correct explanations.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 8 of its 64 references that are in the map. First posted on arXiv 15 Mar 2024.
Builds on
8 of 64 references.
References · 8
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2023Keep the Conversation Going: Fixing 162 out of 337 bugs for 0.42 each using ChatGPTcited by 125
- 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
- 2023A Quantitative and Qualitative Evaluation of LLM-Based Explainable Fault Localizationcited by 50
- 2023ChatGPT for Vulnerability Detection, Classification, and Repair: How Far Are We?cited by 44
- 2023Large Language Models in Fault Localisationcited by 28
- 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
- 2021Does External Knowledge Help Explainable Natural Language Inference? Automatic Evaluation vs. Human Ratingscited by 9
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Exploring the Potential and Limitations of Large Language Models for Novice Program Fault Localization ↗
- 2026SemLoc: Structured Grounding of Free-Form LLM Reasoning for Fault Localization
- 2026Similar Pattern Annotation via Retrieval Knowledge for LLM-Based Test Code Fault Localization ↗
- 2025Enhancing LLM-based Fault Localization with a Functionality-Aware Retrieval-Augmented Generation Framework ↗
- 2025Assessing the Impact of Code Changes on the Fault Localizability of Large Language Models
- 2026RGFL: Reasoning Guided Fault Localization for Automated Program Repair Using Large Language Models
- 2026ConFL: Explainable Concurrent Fault Localization via Hierarchy-Guided LLM Reasoning
- 2024A Multi-Agent Approach to Fault Localization via Graph-Based Retrieval and Reflexion