HackerPapers

arXiv:2410.01215cs.CL

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

Yuling Shi, Songsong Wang, Chengcheng Wan, Min Wang, Xiaodong Gu

HN submission. Found in a submission link or body. Submitters do not count as commenters in the main ranking; a submission is not an endorsement.

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 monolithic 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 by isolating, identifying, and resolving 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 demonstrate that MGDebugger outperforms existing debugging systems, achieving an 18.9% improvement in accuracy over seed generations in HumanEval and a 97.6% repair success rate in HumanEvalFix. Furthermore, MGDebugger effectively fixes bugs across different categories and difficulty levels, demonstrating its robustness and effectiveness.

arXiv comments
Accepted to ICSE 2026. Code and data available at https://github.com/YerbaPage/MGDebugger
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.AIArtificial Intelligence cs.PLProgramming Languages cs.SESoftware Engineering

On Hacker News

No comments linking this paper were found in the collected sources. Found in 1 HN submission from Nov 2024 to Nov 2024. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments0 threads

No comments linking this paper were found in the collected sources. Open submission discussions.

Submitted to Hacker News

  • Ask HN: LLM Performance on ADA and Haskell

    I've been wondering for a while if LLMs perform better on languages that are more restrictive than Python out-of-the-box. Is anyone using Claude, GPT, Cursor, Aider etc for ADA or functional languages and do they create less errors than code generated in Python, even if it's subjective? The question is a little inspired by this paper: https://arxiv.org/pdf/2410.01215 FROM CODE TO CORRECTNESS: CLOSING THE LAST MILE OF CODE GENERATION WITH HIERARCHICAL DEBUGGING. Sometimes LLMs are fantastic and…

Connected through shared HN threads, not inferred similarity or a recommendation.