Software Engineering
DynaFix Improves AI-Powered Bug Repair by Tracking Runtime Behavior Across Fix Attempts
A new framework taps execution-level data at each iteration to guide LLM-based program repair, achieving higher fix rates while consuming less computing power.
When artificial intelligence systems attempt to fix buggy code, they typically rely on static analysis and test-pass/fail results—a crude feedback loop that leaves room for improvement. DynaFix, a new technique developed in research circles, takes a different approach by capturing detailed runtime information at each repair iteration and feeding that insight back into the fixing process.
How DynaFix Works#
The core innovation is continuous runtime feedback. Rather than treating execution data as a one-time input, DynaFix collects variable states, branch paths, and call stacks during program execution using a tool called ByteTrace. This information is then woven into the prompts sent to language models in each repair round. After a candidate patch is generated and tested, the updated traces from that execution inform the next iteration of repair attempts.
This closed-loop approach grounds patch suggestions in what actually happens when code runs, rather than relying solely on static code patterns or binary pass/fail signals.
Performance Gains#
Researchers evaluated DynaFix against two widely-used benchmarks—Defects4J v2.0 and the Real-World Benchmark—as well as a custom perturbation test suite called Defects4J-Trans. The results:
- Fixed 236 single-function bugs in Defects4J using GPT-4 and 186 with GPT-4o, including 23 cases not resolved by existing repair tools
- Outperformed ReinFix by 15.6%–32.1% on the perturbation benchmark
- Demonstrated greater robustness when code transformations preserve semantics
- Reduced token usage by 60%–70% relative to leading LLM-based repair methods
Wider Implications#
The findings suggest that iteratively harvesting and exploiting execution-level signals can make AI-driven program repair not only more effective at finding correct patches, but also cheaper and more resilient to code variations. This signals a shift away from pure static reasoning toward systems that treat running code as a source of ground truth.