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

InspectCoder: Dynamic Analysis-Enabled Self Repair through interactive LLM-Debugger Collaboration

Yunkun Wang, Yue Zhang, Guochang Li, Chen Zhi, Binhua Li, Fei Huang, Yongbin Li, Shuiguang DengarXiv 2025 · DOI

Introduction

Large Language Models (LLMs) have revolutionized automated code generation, yet they frequently introduce subtle logic bugs that are difficult to resolve through standard prompting. Current approaches to automated repair typically rely on static analysis or log-augmented debugging, both of which have significant limitations. This paper introduces InspectCoder, a novel agentic system that enables LLMs to perform interactive dynamic analysis using a live debugger, mirroring the systematic root-cause diagnosis employed by human developers.

The Limitations of Current Debugging

Most existing LLM-based repair agents operate in a "blind" fashion. Static Debugging involves the model examining the code and attempting to guess the error based on syntax or simple semantic patterns. Log-Augmented Debugging attempts to provide more context by injecting print statements, but this often results in massive, overwhelming execution logs that obscure the actual root cause.

Comparison of Static and Log-Augmented Debugging approaches, highlighting their failure to resolve complex logic bugs.

As shown in Figure 1, these methods often fail because they lack the ability to interactively probe the program's state. Static analysis may conclude that functionality matches requirements even when a bug exists, while log-based methods can drown the agent in irrelevant data, making it difficult to pinpoint the error.

The InspectCoder Framework

InspectCoder addresses these challenges through a dual-agent architecture supported by a specialized middleware layer.

1. Program Inspector

The Program Inspector is responsible for identifying the root cause of a failure. It interacts with a live debugger to set breakpoints, step through execution, and inspect nested variables in real-time. By testing hypotheses on the fly, it generates a comprehensive "root cause report."

2. Patch Coder

The Patch Coder utilizes the insights from the root cause report to generate a precise fix. This separation of concerns ensures that the repair is based on a verified understanding of the bug rather than a superficial guess.

3. InspectWare Middleware

The core innovation enabling this interaction is InspectWare. Debuggers are complex state machines; a single out-of-order command can corrupt a session. InspectWare abstracts state management, filters terminal noise, and prevents invalid commands. Crucially, it allows "what-if" testing by modifying runtime states in memory without altering the source code, providing a safe environment for exploration.

Experimental Evaluation

The system was evaluated on two contamination-free benchmarks: BigCodeBench-R (607 tasks) and LiveCodeBench-R (151 tasks). These datasets focus on deep semantic and logic bugs rather than trivial syntax errors.

Example of a logic bug resulting in an AssertionError, illustrating the type of complex semantic errors handled by InspectCoder.

Figure 2 illustrates the type of complex logic bugs found in these benchmarks, where subtle errors in timestamp calculations lead to assertion failures that are difficult to diagnose without inspecting runtime variables.

Key Results and Insights

InspectCoder demonstrated significant improvements in both accuracy and efficiency:

  • Performance: It achieved a 67.87% resolve rate on BigCodeBench-R and a 12.58% rate on LiveCodeBench-R, representing a 60.37% relative improvement over the strongest baselines on the latter.
  • Efficiency: By identifying root causes before patching, InspectCoder solved 1.67x to 2.24x more bugs per hour than competing methods.
  • Reversible Exploration: The ability to test fixes in memory proved to be a "superpower," allowing the agent to learn from failed hypotheses without permanently corrupting the codebase.
  • Middleware Necessity: Experiments showed that without InspectWare, LLMs struggle to maintain the strict state-machine requirements of raw debuggers, leading to a significant drop in performance.

Conclusion

InspectCoder shifts the paradigm of automated code repair from trial-and-error to systematic dynamic analysis. By empowering LLMs with the tools of a human developer—interactive debuggers and real-time state inspection—the system achieves a new state-of-the-art in software self-repair. Future work will focus on extending this framework to repository-level debugging and multi-language support.

Summary updated

BibTeX
@misc{wang2025inspectcoder,
  author = {Yunkun Wang and Yue Zhang and Guochang Li and Chen Zhi and Binhua Li and Fei Huang and Yongbin Li and Shuiguang Deng},
  title = {{InspectCoder: Dynamic Analysis-Enabled Self Repair through interactive LLM-Debugger Collaboration}},
  year = {2025},
  eprint = {2510.18327},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.18327},
}
Figure