From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging
Yuling Shi, Songsong Wang, Chengcheng Wan, Min Wang, Xiaodong Gu
摘要
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 Hu-manEvalFix. 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
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper12
- FEA-Bench: A Benchmark for Evaluating Repository-Level Code Generation for Feature ImplementationWei Li, Xin Zhang, Zhongxin Guo, Shaoguang Mao 等ACL 2025 · 被引用 40 次
- Execution Guided Line-by-Line Code GenerationBoaz Lavon, Shahar Katz, Lior WolfNeurIPS 2025 · 被引用 13 次
- PGS: Effective LLM Code Refinement via Property-Oriented and Structurally Minimal FeedbackLehan He, Zeren Chen, Zhe Zhang, Xiang Gao 等ICML 2026 · 被引用 4 次
- Navigating Massive Visual Context in Retrieval-Augmented Generation via Multimodal Memory GraphQiuchen Wang, Shihang Wang, Yu Zeng, Qiang Zhang 等ICML 2026 · 被引用 2 次
- SWE-Debate: Competitive Multi-Agent Debate for Software Issue ResolutionHan Li, Yuling Shi, Shaoxin Lin, Xiaodong Gu 等ICSE 2026 · 被引用 2 次
它引用的顶会 Paper39
- Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning 等NeurIPS 2023 · 被引用 10,924 次
- Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan 等NeurIPS 2023 · 被引用 5,828 次
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code GenerationJiawei Liu, Chunqiu Steven Xia, Yuyao Wang, Lingming ZhangNeurIPS 2023 · 被引用 2,317 次
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 被引用 1,085 次
- Weak-to-Strong Generalization: Eliciting Strong Capabilities With Weak SupervisionCollin Burns, Pavel Izmailov, Jan Hendrik Kirchner, Bowen Baker 等ICML 2024 · 被引用 443 次
相关 Paper
- UniDebugger: Hierarchical Multi-Agent Framework for Unified Software DebuggingCheryl Lee, Chunqiu Steven Xia, Longji Yang, Jen-tse Huang 等EMNLP 2025
- NL-Debugging: Exploiting Natural Language as an Intermediate Representation for Code DebuggingWeiming Zhang, Qingyao Li, Xinyi Dai, Jizheng Chen 等EMNLP 2025 · 被引用 1 次
- InspectCoder: Dynamic Analysis-Driven Self Repair through Interactive LLM-Debugger CollaborationYunkun Wang, Yue Zhang, Guochang Li, Chen Zhi 等OOPSLA 2026 · 被引用 1 次
- A Deep Dive into Large Language Models for Automated Bug Localization and RepairSoneya Binta Hossain, Nan Jiang, Qiang Zhou, Xiaopeng Li 等FSE 2024 · 被引用 60 次
- ChatDBG: Augmenting Debugging with Large Language ModelsKyla Levin, Nicolas van Kempen, Emery D. Berger, Stephen N. FreundFSE 2025 · 被引用 3 次
