AI
New Framework Pairs LLMs With Runtime Debugging to Fix Code Bugs More Accurately
A self-directed debugging approach helps language models understand why code fails, not just how it fails, dramatically improving automated bug repair rates.
Researchers have developed DebugRepair, a framework that equips large language models with intermediate runtime information to identify and fix bugs more reliably. Rather than relying solely on high-level error messages like stack traces, the method collects detailed execution traces that expose the actual state of a program when things go wrong.
The Core Problem#
Current automated program repair systems powered by LLMs typically work by examining test failures and iteratively proposing fixes. However, they often see only the symptom—a crash or failed assertion—without understanding what led to it. This gap between observable failure and root cause causes models to generate patches that happen to pass tests but don't actually address the underlying issue. The absence of intermediate runtime evidence forces LLMs to guess at bug origins, resulting in fragile or incorrect solutions.
How DebugRepair Works#
The framework combines three key components:
- Test semantic purification: Strips away noisy or irrelevant test context to focus repair efforts.
- Simulated instrumentation: Injects targeted debugging statements to gather runtime traces, with fallback rules for cases where static analysis isn't sufficient.
- Debugging-driven conversational repair: Uses accumulated runtime observations to guide LLMs through iterative refinement, learning from both successful and failed attempts.
Together, these elements allow the model to progressively understand what the code is actually doing at each step, then craft patches grounded in that evidence.
Benchmark Results#
Testing on three datasets spanning Java and Python, DebugRepair outperformed 15 competing approaches. With GPT-3.5, it fixed 224 bugs on the Defects4J benchmark—26.2% more than the previous best LLM-based method. Using DeepSeek-V3, it successfully repaired 295 Defects4J bugs, surpassing the second-best baseline by 59 bugs. Across five additional backbone models, the framework achieved an average performance gain of 51.3% over baseline repair performance. Ablation studies confirmed that each component meaningfully contributes to the results.
Why It Matters#
Automated program repair remains a challenging frontier in software engineering. By bridging the gap between what tests reveal and what models need to understand, DebugRepair demonstrates that richer runtime context can unlock substantially better repair accuracy. This approach suggests a path toward more reliable and interpretable automated fixes, potentially reducing manual debugging burden in real-world development workflows.

