DynaFix:基于执行级动态信息的迭代自动程序修复
DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information
AI总结:
DynaFix通过迭代利用运行时动态信息改进程序修复,利用变量状态、控制流路径和调用栈等结构化提示引导LLM生成候选补丁,有效提升修复效率和准确性。
摘要:
自动程序修复(APR)旨在自动为有缺陷的程序生成正确的补丁。最近利用大语言模型(LLMs)的方法展示了潜力,但存在局限。大多数方法仅依赖静态分析,忽略运行时行为。一些尝试整合动态信号,但这些通常局限于训练或微调,或仅一次注入到修复提示中,无法迭代使用。这无法充分捕捉程序执行。当前迭代修复框架通常依赖粗粒度反馈,如通过/失败结果或异常类型,未能有效利用细粒度执行级信息。因此,模型难以模拟人类逐步调试,限制了其在多步推理和复杂缺陷修复中的有效性。为解决这些问题,我们提出DynaFix,一种基于执行级动态信息的APR方法,通过迭代利用运行时信息来完善修复过程。在每次修复轮次中,DynaFix捕获执行级动态信息,如变量状态、控制流路径和调用栈,将其转化为结构化提示以引导LLM生成候选补丁。如果补丁验证失败,DynaFix重新执行修改后的程序以收集新的执行信息用于下一次尝试。这种迭代循环逐步改进补丁,类似于人类开发人员的逐步调试实践。我们在Defects4J v1.2和v2.0基准上评估了DynaFix。DynaFix修复了186个单功能缺陷,比现有最先进基线提高了10%,包括38个此前未修复的缺陷。它在最多35次尝试内生成正确补丁,与现有方法相比将补丁搜索空间减少了70%,从而在修复复杂缺陷方面展示了有效性和效率。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。