想搞LLM自动修bug的可以看看,CausalRepair用双切片把上下文搞干净了,修复数比ReinFix多,成本还低。
CausalRepair是一个基于对话的自动程序修复框架,通过双切片策略构建最小因果上下文。静态切片净化测试语义,动态切片基于执行轨迹捕获精确运行时依赖。在Defects4J V1.2、V2.0和Defects4J-Trans上使用DeepSeek-V3评估,正确修复313个缺陷,优于ReinFix和TSAPR,平均修复成本降至0.029美元。
CausalRepair: Bridging the Causality Gap in Large Language Model-Based Automated Program Repair via Dual-Slicing
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.