Statement-Level Fault Localization for Program Repair

25 concepts19 papers1 proposal

Automated Program Repair (APR) and Automated Vulnerability Repair (AVR) systems aim to fix software defects without human intervention. However, a repair engine cannot fix what it cannot find. Before a tool can generate a patch, it must know exactly where the code is broken—a process known as Fault Localization (FL).

Historically, information retrieval and spectrum-based FL techniques operated at a coarse granularity, identifying a problematic file or method. As noted by Manish Motwani et al. in Better Automatic Program Repair by Using Bug Reports and Tests Together, file- or method-level localization is far too imprecise for automated repair systems. To generate a valid patch, an engine needs to pinpoint the exact statement or line of code that contains the defect. Consequently, statement-level fault localization has emerged as a critical prerequisite and a primary focus of research in automated software engineering.

The Search Space Explosion

Why is statement-level precision so vital? The core issue is the combinatorial explosion of the patch search space. If a repair tool is given an entire method to fix, it must consider modifications to every variable, operator, and expression within that block. In a systematic assessment of 16 Java repair systems, Kui Liu et al. demonstrated in On the efficiency of test suite based program repair: A Systematic Assessment of 16 Automated Repair Systems for Java Programs that even minor inaccuracies in fault localization cause an order-of-magnitude increase in the number of candidate patches generated. This forces the engine to explore irrelevant code areas, making the repair process computationally intractable for large-scale software.

Furthermore, an oversized search space leads to the generation of "plausible but incorrect" patches—code modifications that pass the immediate test suite but fail to fix the underlying logic or introduce new errors. As shown by Yukun Dong et al. in Quality Evaluation Method of Automatic Software Repair Using Syntax Distance Metrics and Simón Gutiérrez Brida et al. in Bounded Exhaustive Search of Alloy Specification Repairs, patch evaluation and mutation-based searches become highly unreliable or computationally impossible when the initial fault localization step is imprecise.

The "Perfect Fault Localization" Bias

In academic research, this bottleneck is often obscured by an artificial setup: the "perfect fault localization" assumption. Many benchmarks evaluate repair tools by feeding them the exact buggy line directly. However, Kui Liu et al. revealed in You Cannot Fix What You Cannot Find! An Investigation of Fault Localization Bias in Benchmarking Automated Program Repair Systems that this assumption creates severe biases, as providing precise bug locations can double the success rate of the same repair algorithm. The authors argue that many perceived improvements in repair techniques actually stem from superior search space narrowing rather than better patch generation.

When deployed in realistic scenarios where fault localization is imperfect, tools designed around this assumption quickly degrade. As Chunrong Fang et al. point out in GAMMA: Revisiting Template-based Automated Program Repair via Mask Prediction and Fengjie Li et al. observe in Hybrid Automated Program Repair by Combining Large Language Models and Program Analysis, automated tools frequently propagate localization errors, causing subsequent patch generation attempts to fail entirely. This realization has driven the field to treat statement-level localization not as an external input, but as an integrated, high-precision component of the repair pipeline (Zhen Li 0027 et al. in SoK: Automated Vulnerability Repair: Methods, Tools, and Assessments).

Mechanisms for Statement-Level Precision

To narrow down defects to individual lines or statements, researchers have developed several distinct strategies that leverage structural, semantic, and contextual information:

  • Flow-Sensitive Graph Neural Networks: Treating code as flat text ignores the complex interactions between statements. In MVD, Sicong Cao et al. address this by mapping source code and interprocedural control/data flow into a Flow-Sensitive Graph Neural Network (FS-GNN). By framing vulnerability detection as a node-level classification problem, the model pinpoints the exact statement responsible for memory flaws, drastically reducing manual debugging overhead.
  • Granularity Refinement via Intermediate Representations: Source code contains syntactic noise that can confuse deep learning models. In VulDeeLocator: A Deep Learning-Based Fine-Grained Vulnerability Detector, Zhen Li 0027 et al. analyze compiler intermediate code (LLVM IR) instead. They use a neural network designed for granularity refinement to narrow vulnerabilities down to an average of fewer than four lines, transforming automated detectors into highly practical tools.
  • Weakly Supervised Multiple Instance Learning: Training statement-level models typically requires expensive, line-by-line manual annotations. To circumvent this, Wenchao Gu et al. developed WAVES in Weakly Supervised Vulnerability Localization via Multiple Instance Learning. By using Multiple Instance Learning (MIL), the system learns to isolate specific vulnerable statements using only coarse, function-level labels.
  • Program Slicing and Contextual Filtering: Static analysis can also be used to prune irrelevant code before repair begins. Xiaoguang Mao et al. show in Fault Localization Using Failure-Related Contexts for Automatic Program Repair that using program slicing to filter out code lacking data or control dependencies to the failure reduces repair time and invalid patch generation by nearly 40%.
  • Boundary-Aware Generative Models: For generative models like Transformers, recognizing where one statement ends and another begins is crucial. In Dynamically Relative Position Encoding-Based Transformer for Automatic Code Edit, Shiyi Qi et al. introduced dynamically relative position encodings to teach models statement boundaries, improving their ability to locate lines to edit by up to 46%. Similarly, Xueyang Li et al. in TransRepair: Context-aware Program Repair for Compilation Errors emphasize that combining compiler diagnostics with a context analyzer helps models look beyond the error line to find the true root cause.

Generality Across Domains

The push for statement-level precision is not confined to standard imperative code. In smart contract security, Lili Wei et al. demonstrate in Combatting Front-Running in Smart Contracts: Attack Mining, Benchmark Construction and Vulnerability Detector Evaluation that pinpointing exact vulnerable code snippets drastically reduces the amount of code flagged, achieving the high precision necessary to cover exploited attack vectors without overwhelming developers.

Even in declarative languages like Alloy, where code consists of mathematical constraints rather than sequential instructions, fine-grained localization is possible. In Fault Localization for Declarative Models in Alloy, Kaiyuan Wang et al. adapted mutation testing and spectrum analysis to relational logic. By localizing faults at the level of individual abstract syntax tree (AST) nodes, their approach identifies specific faulty operators or variables within complex logical constraints.

Conclusion

Ultimately, statement-level fault localization bridges the gap between theoretical patch-generation capabilities and real-world software maintenance. By shifting from coarse-grained blocks to fine-grained statements, techniques like pattern mining (Jiajun Jiang et al. in Boosting Redundancy-Based Automated Program Repair by Fine-Grained Pattern Mining) can operate effectively even when initial localization is noisy, making automated repair a practical reality.

Key Foundational Work

You Cannot Fix What You Cannot Find! An Investigation of Fault Localization Bias in Benchmarking Automated Program Repair Systems (2018) — contributed 1 concept elements to this direction.
Fault Localization Using Failure-Related Contexts for Automatic Program Repair (2015) — contributed 1 concept elements to this direction.
Fault Localization for Declarative Models in Alloy (2018) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_statement_level_fault_localization_31793bac,
  title = {statement-level fault localization},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/statement-level-fault-localization/rdr_31793baccb6445c3b24dec51a262936e},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-19},
}

This exact version (version 1, frozen text):

@misc{lacuna_statement_level_fault_localization_31793bac_v1,
  title = {statement-level fault localization},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/statement-level-fault-localization/rdr_31793baccb6445c3b24dec51a262936e/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-19},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake