GraphLocator: New AI System Uses Causal Reasoning to Pinpoint Software Bugs
In a significant advance for automated software engineering, researchers have introduced GraphLocator, a novel Large Language Model (LLM)-based system that dramatically improves the accuracy of issue localization—the critical task of mapping a natural language bug report to the exact lines of code requiring modification.
Current automated systems often struggle because they treat issue localization as a simple semantic matching problem, failing to bridge the crucial “semantic gap” between abstract user descriptions and concrete code implementations.
This gap manifests in two primary ways: first, the symptom-to-cause mismatch, where the bug report describes an observable failure (a symptom) rather than the deeper, underlying root cause. For instance, a report stating “separability matrix does not compute correctly” is merely a symptom; the actual defect might be three dependencies deep in a core calculation function. Second, the one-to-many mismatch occurs when a single issue requires coordinated changes across multiple, interdependent files and functions—such as optimizing an endpoint, which might require modification to the configuration handler, the database query function, and multiple related utility methods.
GraphLocator addresses these challenges by embedding LLM reasoning within a structural framework based on causality.
Mapping the Code’s Causal Dependencies
The heart of the system is the Causal Issue Graph (CIG). Unlike traditional approaches that search for code snippets based on keyword similarity, the CIG explicitly models the causal dependencies between “sub-issues” derived from the original bug report, linking them directly to associated code entities within the repository.
To build this structure, GraphLocator first maps the entire codebase into a Repository Dependency Fractal Structure (RDFS)—a heterogeneous graph representing directories, files, classes, and methods, along with their hierarchical and structural connections (like function calls or inheritance).
Starting from the initial symptom identified in the RDFS, an LLM-driven agent iteratively constructs the CIG. It performs abductive reasoning—reasoning backward from the effect (symptom) to the most plausible cause—and uses a priority queue to ensure the system expands the sub-issue most likely to reveal the root defect. This process naturally enables dynamic issue disentangling, breaking down complex, intertwined problems into smaller, causally coherent components.
Improved Accuracy and Disentangling
Testing GraphLocator on three real-world Python and Java datasets (SWE-bench Lite, LocBench, and Multi-SWE-bench Java) showed it consistently outperformed both embedding-based and procedural LLM baselines.
In function-level localization—the most precise and challenging granularity—GraphLocator achieved an average absolute improvement of +19.49% in recall (finding all relevant changes) and +11.89% in precision (avoiding irrelevant changes).
The system proved especially robust in complex scenarios:
- Symptom-to-Cause Mismatches: Localization recall improved by +16.44% when the root cause was several dependency hops away from the symptom described.
- One-to-Many Mismatches: Recall improved by +19.18% when multiple functions required coordinated changes.
Furthermore, the structured CIG proved beneficial for subsequent automation. When integrated into a downstream issue-resolving framework, the disentangled causal structure generated by GraphLocator led to a 28.74% relative increase in the overall success rate of resolving the issue—confirming that understanding why code needs changing is as vital as knowing where.
The researchers conclude that leveraging explicit causal structure is essential for bridging the semantic gap in automated software maintenance, leading to more accurate and interpretable localization results.
Chat about this paper
To chat about this paper, you'll need a free Gemini API key from Google AI Studio.
Your API key will be stored securely in your browser's local storage.