Skip to content
#software testing Open access

Project-Scale Statement-Level Fault Localization via Multi-view Semantic Learning and Pairwise Reranking

Oct 2026 · Proceedings of the ACM on Software Engineering · Vol 3, pp. 4811 - 4833 · 0 citations · 48 references

TL;DR

FaultScape is a novel LLM-based framework for project-scale, statement-level FL that formulates FL as a multi-view semantic learning and reasoning problem and shows that combining multi-view fault semantics with contrastive, failure-guided reasoning substantially improves the effectiveness and robustness of statement-level fault localization.

Abstract

Statement-level fault localization (FL) is critical for effective software debugging, as it enables developers to precisely identify faulty lines of code. While traditional spectrum-based, mutation-based, and deep learning-based FL techniques have achieved notable progress, they remain limited in modeling rich fault semantics. Recent advances in large language models (LLMs) offer new opportunities for FL due to their strong capacity for semantic understanding and reasoning over bugs. However, existing LLM-based FL approaches largely treat fault localization as isolated, code-centric prediction, limiting their ability to perform the holistic fault reasoning required for precise statement-level localization. In this paper, we propose FaultScape, a novel LLM-based framework for project-scale, statement-level FL that formulates FL as a multi-view semantic learning and reasoning problem. FaultScape addresses the limitations of existing approaches through three key components. First, we introduce a joint contrastive fine-tuning strategy that trains LLMs on large-scale bug-fix data to explicitly learn fault semantics from multiple complementary views. View-specific fault semantics, including code semantics, fault type, root cause, and repair intent, are learned via supervised binary classification, while cross-view semantic consistency is enforced through contrastive learning. These two objectives are jointly optimized within a unified training loss. The fine-tuned models extract multi-view fault likelihoods as semantic features for each suspicious statement. Second, we adopt a dynamic feature integration module that combines these semantic features with spectrum-based and mutation-based execution features, producing an initial suspiciousness statement ranking. Third, we design an LLM-based, test-guided pairwise re-ranking strategy that explicitly compares highly suspicious candidate statements using failing-test context. By estimating relative fault likelihoods through pairwise comparison rather than independent scoring, the model produces a refined statement-level ranking. We evaluate FaultScape on Defects4J v1.2.0, where it localizes 112/171/196 bugs at Top-1/3/5 out of 395, outperforming state-of-the-art DL-based and LLM-based baselines. On leakage-free benchmarks, FaultScape further localizes 11/18/20 bugs at Top-1/3/5 on ConDefects (31 bugs) and 12/21/22 bugs on GHRB (34 bugs), demonstrating strong generalization to unseen projects. These results show that combining multi-view fault semantics with contrastive, failure-guided reasoning substantially improves the effectiveness and robustness of statement-level fault localization.Statement-level fault localization (FL) is critical for effective software debugging, as it enables developers to precisely identify faulty lines of code. While traditional spectrum-based, mutation-based, and deep learning-based FL techniques have achieved notable progress, they remain limited in modeling rich fault semantics. Recent advances in large language models (LLMs) offer new opportunities for FL due to their strong capacity for semantic understanding and reasoning over bugs. However, existing LLM-based FL approaches largely treat fault localization as isolated, code-centric prediction, limiting their ability to perform the holistic fault reasoning required for precise statement-level localization. In this paper, we propose FaultScape, a novel LLM-based framework for project-scale, statement-level FL that formulates FL as a multi-view semantic learning and reasoning problem. FaultScape addresses the limitations of existing approaches through three key components. First, we introduce a joint contrastive fine-tuning strategy that trains LLMs on large-scale bug-fix data to explicitly learn fault semantics from multiple complementary views. View-specific fault semantics, including code semantics, fault type, root cause, and repair intent, are learned via supervised binary classification, while cross-view semantic consistency is enforced through contrastive learning. These two objectives are jointly optimized within a unified training loss. The fine-tuned models extract multi-view fault likelihoods as semantic features for each suspicious statement. Second, we adopt a dynamic feature integration module that combines these semantic features with spectrum-based and mutation-based execution features, producing an initial suspiciousness statement ranking. Third, we design an LLM-based, test-guided pairwise re-ranking strategy that explicitly compares highly suspicious candidate statements using failing-test context. By estimating relative fault likelihoods through pairwise comparison rather than independent scoring, the model produces a refined statement-level ranking. We evaluate FaultScape on Defects4J v1.2.0, where it localizes 112/171/196 bugs at Top-1/3/5 out of 395, outperforming state-of-the-art DL-based and LLM-based baselines. On leakage-free benchmarks, FaultScape further localizes 11/18/20 bugs at Top-1/3/5 on ConDefects (31 bugs) and 12/21/22 bugs on GHRB (34 bugs), demonstrating strong generalization to unseen projects. These results show that combining multi-view fault semantics with contrastive, failure-guided reasoning substantially improves the effectiveness and robustness of statement-level fault localization.

Read PDF

Similar papers

#software testing Open access Sep 2026

SeqRankFL: Sequence-Aware Ranking of LLM-Based Code Representations for Statement-Level Fault Localization

Software reliability is an important part of reliability assurance for complex engineering systems, and timely fault diagnosis supports safe and continuous operation. After a test failure, statement-level fault localization ranks source-code lines for early inspection. Representation-based approaches can operate withou...

D. An, Shi-Hai Wang, Bin Liu et al. · 0 citations
Book Open access Oct 2026

CodeFault: Predicting Fault Risks from Code Changes via Multi-modal Learning

Just-In-Time defect prediction identifies fault-inducing code changes but relies solely on static code properties, missing runtime fault patterns. Meanwhile, log-based anomaly detection captures runtime behaviors but lacks visibility into causal code modifications. This disconnect delays fault identification and compli...

Yi-Fan Xiao, Shi-Jie Li, Yu Huang · 0 citations
Open access Sep 2026

DuaLoc: Dual-Encoder Bug Localization with Bug-Report-Conditioned Attention and Contrastive Learning

DuaLoc combines two pre-trained language models: UniXcoder for the semantic understanding of source code and GraphCodeBERT for awareness of data-flow structure and fine-tuned with a contrastive objective that shapes the embedding space around the localization task.

Amany AlBatlaa, M. Abdullah-Al-Wadud · 0 citations
Book Open access Oct 2026

ChangeWiki: Repository-Level Change Summarization Augmented with Architecture Semantics

Understanding software evolution at the repository level is essential for tasks such as release management, code review, and regression testing. However, existing change summarization techniques are largely confined to single commits or functions, failing to capture cross-commit evolutionary context, while recent repos...

Zi-Jun Wang, Wu-Xia Jin, Jia-Le Li et al. · 0 citations
Open access Oct 2026

TGAR-HB: A Taxonomy-Guided Retrieval Framework for Java Fault Localization via Evolutionary Testing and LLMs

Accurate fault localization plays a critical role in reducing software maintenance costs. Although LLMs exhibit strong code comprehension capabilities, their effectiveness remains limited when applied to large-scale software projects, primarily due to the lack of runtime execution information and insufficient retrieval...

Fei Xu, Chen-Han Wu, Rui Xu · 0 citations

Related blog posts

Microsoft Research Blog Oct 12, 2026

Simulating student learning for better AI tutoring

StudentSim is a research system for evaluating and improving AI tutoring tools before they are tested with learners. It models how individuals may engage with tutors, giving feedback to improve tutor performance across subjects like chess, writing, and mathematics. The post Simulating student learning for better AI tutoring appeared first on Microsoft Research.

MIT News · Artificial Intelligence Oct 2, 2026

Documenting the tech worker movement

Writing as a participant and researcher, PhD student JS Tan SM ’22 has co-authored a new book about the rise of tech worker protests and the employer backlash that followed.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.