arXiv:2512.24635cs.SEcs.AI2025-12被引 6

用运行时动态信息迭代修复程序,提升自动修复成功率

DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information

  • 每轮修复收集变量状态、调用栈等执行信息,生成结构化提示指导LLM
  • 在Defects4J上修复186个缺陷,比现有方法多修38个未修复的错误
  • 仅需最多35次尝试即得正确补丁,搜索空间减少70%

自动程序修复(APR)旨在自动为有缺陷的程序生成正确补丁。近期基于大语言模型(LLMs)的方法虽有进展,但大多仅依赖静态分析,忽略运行时行为。部分方法尝试引入动态信号,但通常仅用于训练或一次性注入修复提示,未能迭代使用。现有迭代修复框架多依赖通过/失败结果等粗粒度反馈,无法有效利用细粒度执行信息,导致模型难以模拟人类逐步调试过程,限制了其在多步推理和复杂缺陷修复中的表现。为此,我们提出DynaFix,一种由执行级动态信息驱动的迭代式自动修复方法。每轮修复中,DynaFix捕获变量状态、控制流路径、调用栈等执行信息,转化为结构化提示以引导LLM生成候选补丁。若补丁验证失败,则重新执行修改后的程序,收集新执行信息进入下一轮。该迭代循环基于更新反馈逐步优化补丁,类似人类开发者的分步调试。我们在Defects4J v1.2和v2.0基准上评估DynaFix,成功修复186个单函数缺陷,较最先进基线提升10%,包含38个此前未被修复的缺陷。修复过程最多需35次尝试,相比现有方法将补丁搜索空间缩小70%,证明其在修复复杂缺陷上的有效性与效率。

原文摘要 · Abstract (English)

Automated Program Repair (APR) aims to automatically generate correct patches for buggy programs. Recent approaches leveraging large language models (LLMs) have shown promise but face limitations. Most rely solely on static analysis, ignoring runtime behaviors. Some attempt to incorporate dynamic signals, but these are often restricted to training or fine-tuning, or injected only once into the repair prompt, without iterative use. This fails to fully capture program execution. Current iterative repair frameworks typically rely on coarse-grained feedback, such as pass/fail results or exception types, and do not leverage fine-grained execution-level information effectively. As a result, models struggle to simulate human stepwise debugging, limiting their effectiveness in multi-step reasoning and complex bug repair. To address these challenges, we propose DynaFix, an execution-level dynamic information-driven APR method that iteratively leverages runtime information to refine the repair process. In each repair round, DynaFix captures execution-level dynamic information such as variable states, control-flow paths, and call stacks, transforming them into structured prompts to guide LLMs in generating candidate patches. If a patch fails validation, DynaFix re-executes the modified program to collect new execution information for the next attempt. This iterative loop incrementally improves patches based on updated feedback, similar to the stepwise debugging practices of human developers. We evaluate DynaFix on the Defects4J v1.2 and v2.0 benchmarks. DynaFix repairs 186 single-function bugs, a 10% improvement over state-of-the-art baselines, including 38 bugs previously unrepaired. It achieves correct patches within at most 35 attempts, reducing the patch search space by 70% compared with existing methods, thereby demonstrating both effectiveness and efficiency in repairing complex bugs.

程序修复大模型迭代修复动态分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。