DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information
Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Meng Yan, Hongyu Zhang · 2025
Read DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information by Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Meng Yan, Hongyu Zhang (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-24635.txt.
Introduction
Zhili Huang and five colleagues repair buggy programs with live execution data. Automated program repair has leaned on language models lately. Most systems read code statically and guess. Runtime behavior stays invisible to them. Feedback, when used, is coarse: pass or fail, or an exception type. Human debugging works differently, step by step through execution.
Their method, DynaFix, copies that loop. Each round captures variable states, control-flow paths, and call stacks. That dynamic record becomes a structured prompt for the model. Candidate patches are generated and validated. Failures trigger a re-run that harvests fresh execution data. The loop refines patches incrementally. On the Defects4J benchmarks, DynaFix fixed more single-function bugs than leading baselines. Dozens had never been repaired before. The patch search space shrank by about seventy percent.
Catalog record
| CREATOR | Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Meng Yan, Hongyu Zhang |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 54 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2512-24635
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Meng Yan, Hongyu Zhang Abstract . Automated Program Repair (APR) aims to generate correct patches for buggy programs automatically. Recent approaches leveraging large language models (LLMs) have shown promise but face notable limitations. Most existing methods rely solely on static analysis, ignoring the runtime behaviors of programs. Although some studies attempt to incorporate dynamic signals, most methods either restrict it to the training or fine-tuning phase, or inject it only once into the repair prompt, without leveraging it iteratively throughout the repair process. This limited usage fails to fully capture program execution. In addition, current iterative repair frameworks typically rely on coarse-grained feedback, such as pass/fail results or exception types, without effectively utilizing fine-grained execution-level information. This makes it difficult for models to simulate the stepwise debugging process of human developers, resulting in limited 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 detailed 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, which informs the next repair attempt. This iterative loop incrementally improves patches based on updated execution-level 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. 1. Introduction Software systems underpin virtually every critical domain of modern society, such as manufacturing, aerospace, energy, and healthcare. As these systems grow in scale and complexity, they inevitably introduce a large number of bugs. Program repair is essential for maintaining stability and security throughout the software lifecycle. Prior studies show that developers spend 35%–50% of their time fixing bugs manually ( 42 ) . To reduce this cost, researchers have extensively investigated APR techniques, which aim to automatically generate patches that automatically correct faulty code ( 12 ) . Traditional APR approaches can be broadly categorized into heuristic-based ( 24 ; 25 ; 35 ; 56 ; 58 ; 49 ; 17 ) , constraint-based ( 60 ; 26 ; 34 ; 39 ) , and template-based methods ( 38 ; 33 ; 15 ; 31 ; 13 ; 16 ) . Heuristic methods search a large patch space but often suffer from efficiency degradation as the space expands. Constraint-based methods provide formal guarantees but struggle to scale to complex programs. Template-based methods, which are widely regarded as the most representative ( 1 ; 13 ; 32 ) , depend on high-quality templates that are costly to construct and limit general applicability. To address these limitations, deep learning–based APR methods have emerged, typically formulating patch generation as a neural machine translation (NMT) task ( 46 ) , trained on large corpora of bug–fix pairs ( 65 ) . However, their effectiveness heavily relies on training data quality and drops significantly when encountering previously unseen bug types ( 11 ; 53 ; 10 ) . The rapid progress of LLMs has opened new opportunities for APR ( 55 ; 22 ; 63 ) . Recent approaches adopt an iterative paradigm, where the LLM is guided by feedback from previous repair attempts. Beyond this, several studies have further explored incorporating dynamic execution information, leveraging runtime traces or behavioral signals to improve fault localization and patch generation ( 61 ; 6 ; 3 ; 8 ) . Although these methods achieve state-of-the-art (SOTA) performance on benchmarks, they still face two key challenges: 1) Over-reliance on static information and insufficient use of dynamic information. Despite the strong capabilities of LLMs in code generation and modification, their effectiveness in APR remains limited because they rely predominantly on static code artifacts (e.g., exception messages, test outcomes, or code comments), which provide only partial insight into the actual execution that causes failures. Recent studies ( 14 ; 61 ; 6 ; 3 ; 8 ) showed that dynamic information (i.e., execution traces) can help LLMs understand runtime behaviors and support patch generation for complex software bugs. However, the use of dynamic information in existing work remains limited—most methods either restrict it to the training or fine-tuning phase ( 61 ; 3 ; 8 ) , or inject it only once into the repair prompt ( 14 ) , without leveraging it iteratively throughout the repair process. Because execution traces are only superficially or sporadically exploited, models cannot fully capture program behaviors or identify underlying causes in complex or multi-step bugs. This insufficient and non-iterative use of dynamic information, in turn, constrains their ability to localize faults and generate effective patches accurately. 2) Coarse-grained feedback in iterative repair without execution-level insights. The SOTA LLM-based APR approaches employ iterative repair strategies ( 55 ; 63 ; 2 ; 64 ) , where the model is repeatedly re-prompted by feedback from test results or bug reports after each repair attempt. However, such feedback is typically coarse-grained, often limited to the result level (e.g., pass/fail outcomes, exception types, or aggregated bug summaries). By contrast, effective real-world debugging depends on the fine-grained examination of runtime behaviors, including variable states, control-flow paths, and call stacks, to refine hypotheses and iteratively isolate the fault. The absence of execution-level insights constrains existing iterative methods, limiting their ability to handle complex bugs that require multi-step reasoning and progressive repair. To address these limitations, we propose DynaFix, an LLM-based APR method that integrates execution-level dynamic information feedback into an iterative repair workflow. The key insight is that execution traces, which includes variable states, control-flow paths, and call stacks, provide essential behavioral evidence for understanding program faults and uncovering their root causes. To collect this information, we develop ByteTrace, a non-intrusive tool for collecting program execution traces, which collects precise and context-rich dynamic information to support DynaFix. In each repair iteration, DynaFix executes the buggy program, records its execution traces via ByteTrace, and augments the repair prompt with the captured dynamic information. The LLM then generates candidate patches. If a patch fails validation, DynaFix re-executes the program, collects updated execution traces, and refines for the next iteration. This closed-loop process continuously grounds the LLM’s reasoning in the latest runtime behaviors, resembling how human developers iteratively debug with feedback. By sustaining iterative and fine-grained exploitation of dynamic information, DynaFix enables more accurate fault localization and more effective patch generation. We conducted a comprehensive evaluation of DynaFix on the widely used Defects4J benchmark. On the 483 single-function bugs in Defects4J v2.0, DynaFix successfully repaired 186 bugs, comprising 100 from v1.2 and 86 from v2.0, and resolved 38 bugs that were not fixed by any of the selected baselines. Compared with LLM-based methods that rely solely on exception message prompts, DynaFix repaired 116 more