InspectCoder:通过交互式 LLM-Debugger 协作实现支持动态分析的自修复
InspectCoder: Dynamic Analysis-Enabled Self Repair through interactive LLM-Debugger Collaboration
AI总结:
本文提出 InspectCoder 双智能体框架,让 LLM 通过交互式调试器开展有状态动态分析与根因诊断,并在两个自修复基准上显著提升准确率和修复效率。
摘要:
大型语言模型(LLM)经常生成带有复杂逻辑错误的错误代码,而这些错误很难诊断。尽管现有的基于 LLM 的自修复方法会进行密集的静态语义分析,或依赖表面的执行日志,但它们遗漏了往往能够揭示缺陷根本原因的深入运行时行为——缺少使人类调试有效的交互式动态分析能力。我们提出 InspectCoder,这是首个通过交互式调试器控制使 LLM 能够主动开展动态分析的智能体式程序修复系统。我们的双智能体框架支持在有状态调试器会话内进行策略性断点放置、有针对性的状态检查以及增量式运行时实验。与遵循固定日志收集流程的现有方法不同,InspectCoder 在运行时自适应地检查并扰动相关中间状态,并利用来自调试器反馈的即时过程奖励来指导多步推理,从而将 LLM 调试范式从盲目的试错转变为系统化的根本原因诊断。我们在两个具有挑战性的自修复基准 BigCodeBench-R 和 LiveCodeBench-R 上进行了全面实验。InspectCoder 的修复准确率相比最强基线实现了 5.10%-60.37% 的相对提升,同时分别带来 1.67 倍至 2.24 倍更优的缺陷修复效率。我们还贡献了 InspectWare,这是一个开源中间件,可抽象调试器复杂性,并在主流 Python 测试框架之间维护有状态调试会话。我们的工作为交互式 LLM-调试器系统提供了可执行的洞见,展示了 LLM 驱动的动态分析在自动化软件工程中的巨大潜力。
英文摘要:
Large Language Models (LLMs) frequently generate buggy code with complex logic errors that are challenging to diagnose. While existing LLM-based self-repair approaches conduct intensive static semantic analysis or reply on superficial execution logs, they miss the in-depth runtime behaviors that often expose bug root causes-lacking the interactive dynamic analysis capabilities that make human debugging effective. We present InspectCoder, the first agentic program repair system that empowers LLMs to actively conduct dynamic analysis via interactive debugger control. Our dual-agent framework enables strategic breakpoint placement, targeted state inspection, and incremental runtime experimentation within stateful debugger sessions. Unlike existing methods that follow fixed log collection procedures, InspectCoder adaptively inspects and perturbs relevant intermediate states at runtime, and leverages immediate process rewards from debugger feedback to guide multi-step reasoning, transforming LLM debugging paradigm from blind trial-and-error into systematic root cause diagnosis. We conduct comprehensive experiments on two challenging self-repair benchmarks: BigCodeBench-R and LiveCodeBench-R. InspectCoder achieves 5.10%-60.37% relative improvements in repair accuracy over the strongest baseline, while delivering 1.67x-2.24x superior bug-fix efficiency respectively. We also contribute InspectWare, an open-source middleware that abstracts debugger complexities and maintains stateful debugging sessions across mainstream Python testing frameworks. Our work provides actionable insight into the interactive LLM-debugger systems, demonstrating the significant potential of LLM-driven dynamic analysis for automated software engineering.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。