RGFL: Reasoning Guided Fault Localization for Automated Program Repair Using Large Language Models CCS: Software and its engineering Software testing and debugging

Melika Sepidband, Hamed Taherkhani, Hung Viet Pham, Hadi Hemmati · 2026

Read RGFL: Reasoning Guided Fault Localization for Automated Program Repair Using Large Language Models CCS: Software and its engineering Software testing and debugging by Melika Sepidband, Hamed Taherkhani, Hung Viet Pham, Hadi Hemmati (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2601-18044.txt.

Introduction

Melika Sepidband, Hamed Taherkhani, Hung Viet Pham, and Hadi Hemmati improve how AI repair tools find the bug before fixing it. Their 2026 preprint presents RGFL, a reasoning-guided fault localization method. Fault localization is the step that pinpoints where code is wrong. It has grown in importance as language model agents take on program repair. Real projects span millions of tokens, far past what a model can read at once.

Guided reasoning helps the model hunt through that sprawl in stages. It can rule areas out and zoom in with a plan. Better localization means repairs start from the right lines. The work targets project-level repair, where search, not typing, is the bottleneck.

Catalog record

CREATORMelika Sepidband, Hamed Taherkhani, Hung Viet Pham, Hadi Hemmati
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE66 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2601-18044

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

RGFL: Reasoning Guided Fault Localization for Automated Program Repair Using Large Language Models CCS: Software and its engineering Software testing and debugging Melika Sepidband, Hamed Taherkhani, Hung Viet Pham, Hadi Hemmati Abstract . Fault Localization (FL) is a critical step in Automated Program Repair (APR), and its importance has increased with the rise of Large Language Model (LLM)-based repair agents. In realistic project-level repair scenarios, software repositories often span millions of tokens, far exceeding current LLM context limits. Consequently, models must first identify a small, relevant subset of code, making accurate FL essential for effective repair. We present a novel project-level FL approach that improves both file- and element-level localization. Our method introduces a hierarchical reasoning module that (i) generates structured, bug-specific explanations for candidate files and elements, and (ii) leverages these explanations in a two-stage ranking scheme combining LLM-based and embedding-based signals. We further propose a counterfactual upper-bound analysis to quantify the contribution of each localization stage to repair success. We evaluate our approach on Python and Java projects from SWE-bench Verified, Lite, and Java. Compared to state-of-the-art baselines, including Agentless and OpenHands, our method consistently improves localization accuracy. On SWE-bench Verified, file-level Hit@1 improves from 71.4% to 85%, and MRR from 81.8% to 88.8%. At the element level, Exact Match under top-3 files increases from 36% to 69%. Integrating our localization into Agentless yields a 12.8% end-to-end repair success improvement. 1. Introduction With the rise of Large Language Models (LLMs), new opportunities have emerged for leveraging their contextual understanding in software engineering tasks, including Automated Program Repair (APR). ( 7 ; 38 ; 11 ) Nowadays LLM-based APRs ( 41 ; 42 ) can resolve real issues reported in GitHub repositories of well-known products and libraries, where a fix requires patching multiple files across the repository. One of the major challenges in this type of complex APR task is to find the relevant code for the LLM to focus on, since providing the entire codebase to the model is impossible. For instance, the largest repository in the well-known SWE-bench Verified ( 17 ) APR benchmark is nearly 12M tokens, in the SymPy project. These sizes far exceed the context limits of current LLMs. Even in cases where a repository could technically fit into the context window, presenting the entire codebase is usually inefficient and often counterproductive, since the model becomes overwhelmed with irrelevant details, making it difficult to focus on the root cause of the bug. This perfectly motivates the necessity of an accurate Fault Localization(FL), not only as a way to reduce the search space for APR, but also as a practical mechanism to adapt LLMs to large, real-world software systems. By directing the model’s attention to the most suspicious files and elements, localization ensures that the limited context budget is spent on the most relevant information. In general, FL is a critical step in APR, which guides the repair system to the parts of the codebase most likely to contain the root cause of a bug. ( 24 ; 39 ) However, traditional FL techniques, including static analysis ( 51 ) , classic information retrieval (IR) ( 52 ; 32 ) , and spectrum-based methods ( 18 ) , often fail to capture deeper semantic links between the bug report and the code. These techniques typically rely on shallow heuristics, which may overlook the actual cause when the bug stems from subtle logic errors or domain-specific behavior. Some recent work has explored the use of LLMs for FL by prompting them to identify relevant parts of the code based on their similarity to the bug report ( 40 ) or by generating predictions directly from code context ( 23 ) . However, these approaches typically rely on textual matching or LLM-based retrieval without explicitly asking the model to reason about why a particular code is relevant. As a result, their potential for supporting semantic or logically relevant code to an issue is limited. Bug Report Summary Issue: HTML output ignores the formats argument. Symptom: Formatted values appear correctly in CSV and RST outputs, but HTML shows full-precision values. Expected: HTML output should respect user-supplied formatting functions. Agentless Localization Localized Elements: • HTML.__init__ • HTMLOutputter.__call__ Why: Selected based on surface relevance to HTML output and table processing. Limitation: These elements do not apply column formats, leading to incorrect patches. Our Reasoning-Guided Localization Localized Elements: • class: HTML • function: write (GT) Why: Reasoning reveals that HTML.write bypasses the standard formatting pipeline and ignores formats . Outcome: Correct element localization enables insertion of missing formatting logic and produces the correct patch. Figure 1 . Motivating example from SWE-bench Verified (Astropy library) showing that reasoning-guided element localization identifies the true fault-inducing method ( HTML.write ), while Agentless selects only superficially related elements. Consider figure 1 , which illustrates a real bug report from the SWE-bench dataset ( 17 ) which is from Astropy’s HTML table writer. The bug report states that when exporting a table to HTML, the user-supplied formats argument is ignored: values appear with full precision in HTML output, while the same formats argument works correctly for other writers such as CSV and reStructuredText. The ground-truth patch confirms that the fault lies in the HTML writing path: the fix adds two missing initialization steps inside HTML.write , namely setting self.data.cols = cols and invoking self.data._set_col_formats() , ensuring that column formatting is properly configured before generating the HTML cells. This issue is challenging for element localization because the bug report does not explicitly name the faulty method; it describes a semantic discrepancy between formats that “respect” formats and HTML that does not. In Agentless ( 40 ) , element localization is performed by directly asking an LLM to list functions related to the bug report, without requiring an explicit rationale tied to code behavior. In this example, Agentless selects HTML.__init__ and HTMLOutputter.__call__ . While these elements appear contextually relevant (initializing HTML options and processing column structures), they are not the causal point where formats should be applied. As a result, the localized context emphasizes superficially related components, making it harder for the repair model to identify that the missing formatting logic must be introduced in the HTML writer itself. In contrast, we propose a reasoning-guided approach that first elicits element-level reasoning (what each candidate element does and how it relates to the observed symptom) and then uses this reasoning to guide element selection. For the same bug, our localized elements include class: HTML and, crucially, function: write , which matches the ground-truth faulty element. The generated reasoning explicitly links the symptom to the implementation: HTML.write constructs the HTML table body by iterating over col.info.iter_str_vals() , a pathway that formats values using the column’s default settings and bypasses the writer’s centralized formatting mechanism. This reasoning makes clear that the writer never applies the formats dictionary provided to Table.write , explaining why HTML output ignores formatting while other writers behave as expected. This example illustrates why reasoning is valuable for localization: it shifts the model from selecting elements that merely sound related to selecting elements that are responsible for the failure. By making the causal chain explicit, our approach reliably surfaces HTML.write as the fault-inducing element, enabling the repair model

Read the complete text