Repository-level automated program repair (APR) requires long-horizon reasoning over interdependent decisions. However, most LLM-based approaches reconstruct repair reasoning independently for each issue, failing to reuse successful patterns from prior repairs, even though real-world repositories contain many related issues with shared structure or constraints. Existing methods typically rely on forward exploration, which operates under outcome uncertainty, incurs substantial inference-time overhead, and can drift from the final correct patch. We propose Conditional Reasoning Distillation (ConRAD), which leverages in-repository resolved issues by reconstructing repair reasoning backward from verified patches and distilling outcome-consistent, stage-wise repair reasoning plans. Injected at inference time, these plans guide fault localization and patch generation, replacing open-ended exploration with constrained inference without fine-tuning or search. On SWE-Bench Lite, ConRAD improves Pass@1 by 10.4\% (GPT-4o), 8.6\% (DeepSeek-V3), and 10.3\% (GPT-5), demonstrating a scalable inference-time alternative to forward exploration for long-horizon APR.
翻译:仓库级自动程序修复(APR)需要对相互依赖的决策进行长程推理。然而,大多数基于大语言模型的方法为每个问题独立重构修复推理,未能复用先前修复中的成功模式,尽管现实世界的代码仓库包含许多具有共享结构或约束的相关问题。现有方法通常依赖正向探索,这种探索在结果不确定性下运行,会产生大量推理时间开销,并可能偏离最终正确补丁。我们提出条件推理蒸馏(ConRAD),它通过从经过验证的补丁反向重构修复推理,并蒸馏出结果一致、分阶段的修复推理计划,来利用仓库内已解决的问题。在推理时注入这些计划,可以指导缺陷定位和补丁生成,无需微调或搜索,将开放式探索替换为受限推理。在SWE-Bench Lite上,ConRAD将Pass@1分别提升10.4%(GPT-4o)、8.6%(DeepSeek-V3)和10.3%(GPT-5),展示了面向长程APR的正向探索的可扩展推理时替代方案。