paperbot · PL 论文追踪

全部论文 待读 收藏

P2 From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging

从代码到正确性:用层次化调试打通代码生成的最后一公里
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 4/10 · 论文聚焦用 LLM 对生成代码做层次化调试与修复,属于 LLM4SE/程序修复方向,与“用 LLM/Agent 改进静态分析或形式化验证”仅间接相关;不涉及静态分析、浮点程序分析、贝叶斯程序分析,也不是针对 Agentic 程序的静态分析。引用 60 inbox
Yuling Shi, Songsong Wang, Chengcheng Wan, Min Wang, Xiaodong Gu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出层次化调试器 MGDebugger,通过子函数分解与自底向上排错,显著提升 LLM 生成代码的修复成功率。

大语言模型在代码生成上进步显著,但生成代码常因细微错误而无法通过测试,现有基于 LLM 的调试系统将程序视为整体,难以处理从底层语法错误到高层算法缺陷的多粒度问题。本文提出 MGDebugger,将待调试代码分解为子函数层次树,每一层对应不同错误粒度,并以自底向上方式迭代定位和修复缺陷。为测试各子函数,作者提出 LLM 模拟的 Python 执行器,跟踪执行过程与关键变量状态以精确定位错误。实验表明,MGDebugger 在 HumanEval 上相较种子生成最高提升 18.9% 准确率,在 HumanEvalFix 上达到 97.6% 修复成功率;在 Defects4J v1.2 和 v2.0 上分别修复 129 和 64 个真实缺陷,超越当前最优程序修复方法 13.2% 和 8.5%。

问题
LLM 生成的代码常因细微错误无法通过测试,现有调试系统把程序当作整体,无法处理从语法错误到算法缺陷的多粒度 bug。
方法
MGDebugger 将问题代码分解为子函数层次树,逐层分析并以自底向上方式修复;同时用 LLM 模拟的 Python 执行器跟踪执行和变量状态以定位错误。
评估
在 HumanEval、HumanEvalFix 以及 Defects4J v1.2/v2.0 上,用开源和商用 LLM 评估调试与修复效果,并与现有调试系统和程序修复方法比较。
原文摘要(Abstract)

While large language models have made significant strides in code generation, the pass rate of the generated code is bottlenecked on subtle errors, often requiring human intervention to pass tests, especially for complex problems. Existing LLM-based debugging systems treat generated programs as holistic units, failing to address bugs at multiple levels of granularity, from low-level syntax errors to high-level algorithmic flaws. In this paper, we introduce Multi-Granularity Debugger (MGDebugger), a hierarchical code debugger that isolates, identifies, and resolves bugs at various levels of granularity. MGDebugger decomposes problematic code into a hierarchical tree structure of subfunctions, with each level representing a particular granularity of error. During debugging, it analyzes each subfunction and iteratively resolves bugs in a bottom-up manner. To effectively test each subfunction, we propose an LLM-simulated Python executor, which traces code execution and tracks important variable states to pinpoint errors accurately. Extensive experiments with both open-source and commercial LLMs demonstrate that MGDebugger significantly outperforms existing debugging systems, achieving up to 18.9% improvement in accuracy over seed generations in HumanEval and a 97.6% repair success rate in HumanEvalFix. Furthermore, MGDebugger effectively generalizes to real-world software defects, fixing 129 bugs in Defects4J v1.2 and 64 bugs in Defects4J v2.0, outperforming state-of-the-art program repair approaches by 13.2% and 8.5% respectively. These results demonstrate MGDebugger’s robustness and effectiveness across different scenarios, establishing it as a powerful tool for closing the last mile of code generation.1

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2410-01215,
  title = {From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging},
  author = {Yuling Shi and Songsong Wang and Chengcheng Wan and Min Wang and Xiaodong Gu},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773255}
}