NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

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

Meng Yan (鄢萌), Zhili Huang, Ling Xu, Chao Liu, Weifeng Sun, Xu Zhang, Yan Lei, Meng Yan, Hongyu ZhangarXiv 2025 · DOI

Introduction

Automated Program Repair (APR) has long been a goal of software engineering, promising to fix bugs autonomously. While Large Language Models (LLMs) have advanced this field, they often struggle with complex logic because they lack "runtime intuition." Traditional APR tools rely heavily on static code analysis and coarse-grained feedback (e.g., "test failed"), which forces models into inefficient trial-and-error cycles.

DynaFix is a novel APR framework designed to bridge this gap. By providing LLMs with fine-grained, execution-level feedback—such as variable states, call stacks, and control-flow paths—DynaFix mimics the stepwise debugging process of human developers. This approach allows the model to reason about why a program fails at runtime, leading to more accurate and efficient repairs.

The Challenge of Coarse-Grained Feedback

Current LLM-based APR approaches face two primary "blind spots":

  1. Over-reliance on static information: Most tools analyze source code and compiler errors but ignore how data flows during execution.
  2. Lack of actionable feedback: When a patch fails, models are often given generic exception types rather than specific details about the failure point. This is akin to telling a student their math answer is wrong without identifying the specific calculation error.

Without runtime insights, LLMs cannot easily distinguish between a logically sound patch and one that introduces subtle runtime errors, making complex bugs nearly impossible to solve without an exhaustive search.

An example of the comprehensive information provided to the LLM, including the buggy program, static Javadoc/test cases, and dynamic execution traces.

Methodology: The DynaFix Framework

DynaFix introduces two core innovations to provide the necessary runtime context for effective debugging.

The four-step DynaFix framework: capturing execution info, prompt construction, patch verification, and layered progressive repair.

ByteTrace: Non-Intrusive Runtime Instrumentation

The first innovation is ByteTrace, a Java instrumentation tool that operates at the bytecode level. Unlike source-code instrumentation, ByteTrace does not modify the original code, ensuring that the execution environment remains as close to production as possible. It captures "execution-level dynamic information," including:

  • Local Variables: The values of variables at specific lines during execution.
  • Control Flow: The exact path taken through branches (if/else) and loops.
  • Call Stacks: The sequence of method invocations leading to a failure.

Layered Progressive Repair (LPR)

To manage the search space efficiently, DynaFix employs a two-phase Layered Progressive Repair (LPR) strategy:

  • Breadth Phase: The system generates a set of initial candidate patches based on the buggy code and initial failure reports.
  • Depth Phase: If a candidate patch passes some tests but fails others, it is flagged as "promising." DynaFix then enters a depth-first refinement mode. It re-executes the modified code, gathers new execution traces from the failing tests, and feeds this specific runtime data back to the LLM to "nudge" the patch toward full correctness.

Evaluation and Results

The researchers evaluated DynaFix using the Defects4J benchmark (versions 1.2 and 2.0), focusing on 483 single-function bugs and 347 multi-function bugs across 17 open-source repositories. DynaFix was compared against 11 state-of-the-art (SOTA) baselines, including both LLM-based and template-based tools.

Key Findings

  • Superior Effectiveness: DynaFix successfully repaired 186 single-function bugs, outperforming the strongest baseline (GIANTREPAIR) by 10%.
  • Unlocking "Unfixable" Bugs: The framework resolved 38 bugs that had never been fixed by any of the 11 SOTA baselines, demonstrating the power of dynamic feedback for complex logic.
  • High Efficiency: By providing precise data, DynaFix reduced the patch search space by 70% compared to the most efficient baseline (RepairAgent). It achieved its results with a maximum of only 35 attempts per bug.
  • Ablation Study: The LPR strategy proved critical, contributing to a 21.9% increase in the fix rate compared to a non-iterative approach.

Discussion: Why Dynamic Information Matters

The success of DynaFix highlights the importance of grounding LLM reasoning in runtime behavior. For instance, in floating-point precision bugs, a model might view the code as logically correct until it "sees" the actual runtime values (e.g., 1.0000001 vs. 1.0). This "Aha!" moment allows the model to adjust its logic to account for precision errors.

Furthermore, the iterative loop is essential. Much like a human developer using a debugger, the ability to re-examine the execution of a failed patch allows the model to progressively isolate the fault.

Limitations and Future Work

While DynaFix represents a significant step forward, it has limitations:

  • Language Support: Currently restricted to Java due to the JVM-based ByteTrace tool.
  • Multi-Location Bugs: While it showed promise with multi-function bugs, extending fine-grained tracing across complex, distributed systems remains a challenge.
  • LLM Dependency: The system's performance is inherently tied to the capabilities of the underlying model (GPT-4o).

Conclusion

DynaFix demonstrates that providing LLMs with a "window" into program execution significantly enhances their ability to repair software bugs. By combining bytecode-level tracing with a layered refinement strategy, DynaFix achieves state-of-the-art performance while maintaining high efficiency, paving the way for more robust and practical automated debugging tools.

Summary updated

BibTeX
@misc{2025dynafix,
  author = {Meng Yan (鄢萌) and Zhili Huang and Ling Xu and Chao Liu and Weifeng Sun and Xu Zhang and Yan Lei and Meng Yan and Hongyu Zhang},
  title = {{DynaFix: Iterative Automated Program Repair Driven by Execution-Level Dynamic Information}},
  year = {2025},
  eprint = {2512.24635},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.24635},
}
Figure