CausalRepair: Bridging the Causality Gap in Large Language Model-Based Automated Program Repair via Dual-Slicing

📅 2026-08-11
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge that existing large language model (LLM)-based program repair approaches often struggle to accurately localize fault roots due to noisy or irrelevant code in the repair context. To overcome this limitation, the paper introduces CausalRepair, a novel framework that pioneers the concept of causal context by integrating context-aware static slicing with execution-trace-based dynamic slicing to construct minimal, causally relevant repair guidance. This refined context is then leveraged within an interactive dialogue mechanism to iteratively steer the LLM (DeepSeek-V3) toward effective repairs. Evaluated on multiple versions of Defects4J, CausalRepair successfully fixes 313 bugs, substantially outperforming state-of-the-art methods such as ReinFix and TSAPR, while achieving a remarkably low average repair cost of just \$0.029 per bug.
📝 Abstract
Automated Program Repair (APR) has recently benefited from Large Language Models (LLMs), yet their effectiveness heavily depends on repair context. Existing LLM-based APR methods suffer from a causality gap: test contexts can be noisy or incomplete, while source contexts derived from static analysis often contain irrelevant and unexecuted code, misleading LLMs from identifying the true root cause. To address this issue, we propose CausalRepair, a conversation-driven APR framework based on minimal causal context, i.e., the essential dependencies required to explain a failure. CausalRepair employs a dual-slicing strategy: context-aware static slicing purifies test semantics, while execution-trace-based dynamic slicing captures precise runtime dependencies in source code. Together, they construct compact, causally relevant contexts to guide iterative repair. We evaluate CausalRepair on Defects4J V1.2, V2.0, and Defects4J-Trans using DeepSeek-V3. CausalRepair correctly fixes 313 bugs on Defects4J, outperforming state-of-the-art approaches such as ReinFix and TSAPR, while reducing the average repair cost to $0.029 per bug.
Problem

Research questions and friction points this paper is trying to address.

CausalRepair
Automated Program Repair
Causality Gap
Large Language Models
Program Debugging
Innovation

Methods, ideas, or system contributions that make the work stand out.

causal context
dual-slicing
automated program repair
large language models
execution trace