Fault Localization: Techniques & Trends
- Fault Localization is the process of pinpointing program elements or system components most likely responsible for failures, effectively reducing the debugging search space.
- It employs diverse methodologies—from spectrum-based and IR-based techniques to probabilistic and LLM-based approaches—to rank and isolate fault candidates.
- Evaluation metrics such as EXAM scores and Top-k accuracy demonstrate its significant impact on improving debugging efficiency in software, cloud, and network systems.
Fault localization (FL) denotes the task of identifying the program elements, system components, fault types, or physical locations that are most likely responsible for an observed failure. In software debugging, FL typically returns a ranked list of suspicious statements, lines, methods, or files after a failing behavior is observed; in cloud and distributed systems, it can identify which faults and cloud components are most likely responsible for service degradation; in electrical networks, it can estimate the location of a fault along a transmission-line segment or network edge (Nakao et al., 2024, R et al., 2021, Selvaratnam et al., 7 Apr 2025). Across these settings, FL serves as a search-space reduction mechanism for debugging, mitigation, self-healing, or repair.
1. Scope, granularity, and problem formulations
In software engineering, FL is commonly framed as the activity of helping developers find where in the source code a fault resides once failing behavior has been observed. The localization target may be a statement, line, method, function, class, file, or module, and the output is usually a ranking rather than a single deterministic answer (Nakao et al., 2024, Yang et al., 2023, Shi et al., 24 Sep 2025). Several recent formulations make this explicit: line-level FL predicts buggy lines, method-level FL ranks functions or methods, and project-level FL narrows an entire repository from files to elements before repair (Yang et al., 2023, Shi et al., 24 Sep 2025, Sepidband et al., 25 Jan 2026).
The same term is used more broadly outside conventional source-code debugging. In cloud systems, FL is framed as identifying which faults, and hence which cloud components, are most likely responsible for a failure. The key modeling decision there is that faults themselves, rather than components, become graph nodes, giving a one-to-many mapping from a component to fault types (R et al., 2021). In deep learning systems, FL targets high-level configuration and design choices such as learning rate, batch size, loss function, optimizer, activation functions, layer structure, initialization, or data preprocessing (Kim et al., 3 Jun 2025). In infinite-dimensional electrical networks, the objective is to estimate a continuous fault location along a known faulty edge by exploiting frequency-domain network models and sensor measurements (Selvaratnam et al., 7 Apr 2025).
This diversity suggests that FL is better understood as a family of localization problems parameterized by observability, artifact type, and granularity, rather than as a single statement-ranking technique.
2. Evidence sources and formal representations
A central representation in software FL is the pair , where is a coverage matrix and is an error vector. Here, is the number of test cases, is the number of statements, indicates that test executed statement 0, and 1 indicates that 2 failed (Lei et al., 2023). Spectrum-based methods derive per-statement counts
3
then compute suspiciousness scores such as Ochiai, DStar, or Barinel from those counts (Lei et al., 2023).
IR-based FL uses a different representation: the bug report becomes a query and source files become documents. Techniques such as BugLocator build TF-IDF-like representations of bug reports and code, compute direct relevance between a new bug report and source files, and optionally add indirect relevance via historical bug reports linked to past fixes. GloBug extends this by replacing project-local statistics with models pre-trained on global cross-project data from 51 Java projects, 61,431 files, and 9,459 bug reports (Miryeganeh et al., 2021).
Cloud FL uses a probabilistic directed fault graph
4
where nodes represent distinct fault types and edges encode fault propagation. Each directed edge 5 carries an impact factor 6, and each node has an independent probability of occurrence 7 estimated from logs, IDS output, anomaly detection, or defaults (R et al., 2021). Electrical-network FL uses an admittance representation
8
where 9 is analytic in a right half-plane, depends on the candidate location 0, and may exhibit exponential growth in 1 to accommodate propagation delays and infinite-dimensional edge dynamics (Selvaratnam et al., 7 Apr 2025).
LLM-based and test-free FL add further representations. LLMAO extracts per-line representations from newline token states of a frozen code LLM and predicts a vector 2 of per-line bug probabilities (Yang et al., 2023). BAP treats FL as an attention-probing problem over frozen LLM representations, then aggregates token scores into line scores 3 by summing attention within each line (Stein et al., 19 Feb 2025). Educational FLAME avoids direct line-number prediction and instead asks the LLM to annotate faulty code lines with // @@ explanations, followed by fuzzy matching back to the original program (Liu et al., 30 Sep 2025).
3. Classical, probabilistic, and retrieval-oriented methodologies
The classical software FL literature is dominated by spectrum-based fault localization (SBFL) and mutation-based fault localization (MBFL). SBFL computes suspiciousness scores from passing-versus-failing execution spectra using formulas such as Ochiai, Tarantula, DStar2, and Jaccard; MBFL perturbs the program with mutants and uses the resulting test behavior to assign suspiciousness (Nakao et al., 2024). FL performance in this setting is often evaluated by the EXAM score,
4
where smaller is better (Nakao et al., 2024).
A second major family is IR-based FL. BugLocator combines direct similarity between a new bug report and source files with indirect similarity mediated by historical bug reports; GloBug shows that replacing local TF-IDF statistics with globally trained ones improves BugLocator on average by 6.6% in MRR and 4.8% in MAP, with over 14% improvement in a majority of projects (Miryeganeh et al., 2021). The same study reports that a Word Embedding-based global solution using Doc2Vec did not further improve the results, indicating that richer semantic embeddings do not automatically dominate lexical weighting in IRFL (Miryeganeh et al., 2021).
Probabilistic reformulations also appear. “Effective Fault Localization using Probabilistic and Grouping Approach” states that the method derives the association between statement coverage information and test-case execution results using conditional probability statistics, then refines the ranking sequence using grouping; over eleven open-source data sets, the proposed CGFL method is reported as 24.56% more effective than D*, Tarantula, Ochiai, Crosstab, BPNN, RBFNN, DNN, and CNN (Srivastava et al., 2024). At the meta-level, FL technique selection itself has been formulated as a multi-armed bandit problem: each FL technique is an arm, each module is a round, and BA-avg-EXAM dynamically selects among MBFL + Ochiai, SBFL + Tarantula, SBFL + DStar2, and SBFL + Ochiai, achieving relative error below 10% against the best single technique on average EXAM (Nakao et al., 2024).
4. Learning-based, generative, and LLM-based FL
Learning-based FL augments or replaces hand-crafted suspiciousness formulas with learned representations. CGAN4FL addresses class imbalance in test suites by computing a failure-inducing context via dynamic slicing, training a context-aware GAN on failing rows of the context matrix, synthesizing minority-class failing spectra, and augmenting the raw data before running SFL or DLFL. On Defects4J, CGAN4FL improves MLP-FL by 200.00%, 25.49%, and 17.81% under Top-1, Top-5, and Top-10, and improves six FL approaches by 125.34%, 56.32%, and 59.71% on average for Top-1, Top-5, and Top-10 (Lei et al., 2023). Multi-objective feature-fusion FL further combines spectrum-based, mutation-based, and text-based features, uses NSGA-II, MOPSO, or MODE for feature selection, and feeds the result into MLP-FL or GRU-based RNN-FL; on Defects4J with 434 faults, this approach reports a 78.2% reduction in processing time versus single-objective methods, a 94.2% improvement in localization accuracy versus traditional FL methods, and a 7.67% improvement over DeepFL (Hu et al., 2024).
LLM-based FL spans several subfamilies. Test-free line-level models include LLMAO, which fine-tunes bidirectional adapter layers on top of frozen CodeGen representations and, on Defects4J v1.2.0, reaches Top-1/3/5 of 22.3%/37.7%/46.3% with the 16B model (Yang et al., 2023). Sequence-generation LLMC approaches fine-tune encoder, encoder-decoder, and decoder models to emit faulty line numbers and content directly; on 1,291 Defects4J methods, the best model localizes 50.6%, 64.2%, and 72.3% of faults in Top-1, Top-3, and Top-5 (Ji et al., 2024). BAP learns FL without direct localization labels by training an attention probe only for bug detection, then interpreting attention as localization; averaged across eight datasets, it improves Top-1 by 34.6% over the strongest baseline and by 93.4% over zero-shot prompting GPT-4o (Stein et al., 19 Feb 2025).
A second LLM strand emphasizes repository navigation and explanation. AutoFL uses LLM function calls to inspect coverage-relevant classes and methods, then outputs both a natural-language root-cause explanation and culprit method signatures; on 353 Defects4J bugs, it achieves the best standalone method-level acc@1 with 149 correctly localized bugs (Kang et al., 2023). AgentFL scales this idea to project-level context with a multi-agent pipeline for comprehension, navigation, and confirmation, localizing 157 out of 395 bugs within Top-1 at an average cost of 0.074 dollars and 97 seconds per bug (Qin et al., 2024). FaR-Loc introduces functionality-aware retrieval-augmented generation for method-level FL, using LLM functionality extraction, semantic dense retrieval, and LLM reranking; on Defects4J v1.2.0, it reaches Top-1/3/5 of 228/284/304 over 381 bugs and reduces API cost to \$0.019 per bug (Shi et al., 24 Sep 2025).
A third strand prioritizes explainability and hierarchical reasoning. FLAME, designed for programming assignments, prompts multiple LLMs to annotate faulty lines with explanations and aggregates them by weighted voting; on PADefects5, it localizes 207 more faults at Top-1 than the best-performing baseline, and on a 408-bug Defects4J subset it reaches Top-1/3/5/10 of 53.7%/72.8%/77.9%/79.4% (Liu et al., 30 Sep 2025). For project-scale APR, RGFL introduces hierarchical reasoning over files and elements, improving file-level Hit@1 on SWE-bench Verified from 71.4% to 85% and element-level Exact Match under top-3 files from 36% to 69% (Sepidband et al., 25 Jan 2026). For Linux kernel FL, CoHiKer combines contrastive reasoning over mutated passing and failing test cases with hierarchical context analysis, improving Top-1 localization accuracy by up to 26.07% at file level and 56.85% at method level over state-of-the-art LLM-based baselines while reducing token consumption (Wang et al., 1 Jul 2026).
5. Evaluation regimes and reported empirical patterns
Different FL settings use different metrics because the localization target, inspection process, and downstream action differ materially.
| Setting | Common metrics | Representative reported result |
|---|---|---|
| Software code FL | Top-6, EXAM, MAR, MFR, AUC, Hit@7, Exact Match | LLMC fine-tuning reaches 50.6%/64.2%/72.3% Top-1/3/5 on 1,291 Defects4J methods (Ji et al., 2024) |
| IR-based FL | MRR, MAP, Top-N | Global TF-IDF improves BugLocator on average by 6.6% MRR and 4.8% MAP (Miryeganeh et al., 2021) |
| Cloud FL | Accuracy of identifying vulnerable modules at thresholds | Alpha centrality yields 96.37, 93.8, and 93.17 accuracy at thresholds 0.6, 0.7, and 0.8 (R et al., 2021) |
| DL-system FL | Recall, Precision, 8 with 9 | GPT-4 reaches 0, 1, 2; with alternative ground truths, 3, 4, 5 (Kim et al., 3 Jun 2025) |
| Electrical-network FL | Non-convex scalar optimization over 6 using 7 or 8 | In the known-impedance case, the true fault location is the single global minimum across 9 (Selvaratnam et al., 7 Apr 2025) |
Several cross-cutting empirical patterns recur. First, Top-0 remains the dominant software FL evaluation because developers often inspect only a few high-ranked candidates (Shi et al., 24 Sep 2025). Second, many recent studies treat localization quality as a downstream bottleneck for repair: RGFL’s counterfactual analysis on SWE-bench Verified shows that replacing wrong files with ground-truth files resolves 14 of 28 file-level misses, while ground-truth elements rescue 29 of 111 element-level misses and ground-truth lines rescue 33 of 175 line-level misses (Sepidband et al., 25 Jan 2026). Third, some domains require multi-ground-truth evaluation. In DL-system FL, neutrality analysis produced on average 69 alternative ground truths per artificial fault and 28 per real fault, materially changing apparent recall and precision (Kim et al., 3 Jun 2025).
6. Limitations, controversies, and open directions
FL is not confined to statement ranking in conventional programs, but nearly every formulation inherits strong assumptions. Coverage-based techniques assume executable code, usable tests, and informative failing-versus-passing spectra; this becomes problematic when there are few tests, no passing tests, or severe class imbalance between passing and failing cases (Lei et al., 2023, Nakao et al., 2024). Graph-based cloud FL assumes sufficient monitoring and logging, reasonably estimated impact factors, and stationarity of node and edge probabilities; missing or incorrect edges degrade centrality accuracy, and scaling from 1 faults to large microservice topologies remains unproven (R et al., 2021). Electrical-network FL assumes an accurate model 2, a known faulty edge, linear time invariance, and suitable smoothness and sensing conditions; modeling uncertainty, noise, nonlinearities, and edge-identification remain open (Selvaratnam et al., 7 Apr 2025).
LLM-based FL introduces a different set of controversies. Test-free methods can operate without compilation or coverage, but they are sensitive to context length, grounding quality, benchmark contamination, and the gap between explanation and causality (Yang et al., 2023, Stein et al., 19 Feb 2025). Numeric line prediction is particularly brittle for LLMs; FLAME reports that asking the model to output line numbers directly yields Top-1 of 15.8% on PADefects3 and 8.3% on PADefects4, versus 62.7% and 42.4% with annotation-based localization (Liu et al., 30 Sep 2025). Project-level agentic methods reduce this brittleness via retrieval, tool use, and hierarchical reasoning, but they incur nontrivial cost and still depend on prompt design, candidate generation, and LLM judgment stability (Qin et al., 2024, Shi et al., 24 Sep 2025, Sepidband et al., 25 Jan 2026, Wang et al., 1 Jul 2026).
The current literature also shows that “better localization” is not a single scalar notion. Some techniques optimize Top-1 precision, others maximize recall-heavy objectives such as 5, others minimize EXAM, and some, such as cloud FL and electrical-network FL, solve continuous or graph-optimization problems rather than discrete ranking. This suggests that future work will likely remain pluralistic: contextual bandits for dynamic FL-technique selection, deep-learning-plus-centrality hybrids, online graph updates in cloud FL, richer structure-aware retrievers, tighter FL–APR coupling, and broader multi-ground-truth evaluation all appear explicitly in recent agendas (Nakao et al., 2024, R et al., 2021, Shi et al., 24 Sep 2025, Kim et al., 3 Jun 2025, Sepidband et al., 25 Jan 2026).