ChatPaper.aiChatPaper

코드에서 정확성으로: 계층적 디버깅을 통해 코드 생성의 마지막 단계를 완료하기

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

October 2, 2024
저자: Yuling Shi, Songsong Wang, Chengcheng Wan, Xiaodong Gu
cs.AI

초록

대형 언어 모델은 코드 생성에서 상당한 발전을 이루었지만, 생성된 코드의 통과율은 세심한 오류로 인해 병목 현상을 겪고 있으며, 특히 복잡한 문제의 경우 테스트 통과를 위해 인간의 개입이 종종 필요합니다. 기존의 LLM 기반 디버깅 시스템은 생성된 프로그램을 단일체로 취급하여 낮은 수준의 구문 오류부터 높은 수준의 알고리즘 결함까지 여러 수준의 세밀한 버그를 해결하지 못합니다. 본 논문에서는 다중 단계 디버거(MGDebugger)를 소개합니다. MGDebugger는 다양한 수준의 세밀한 버그를 분리, 식별 및 해결하는 계층적 코드 디버거입니다. MGDebugger는 문제가 있는 코드를 하위 함수의 계층적 트리 구조로 분해하고, 각 수준은 특정한 오류의 세밀도를 나타냅니다. 디버깅 중에는 각 하위 함수를 분석하고 하향식으로 버그를 반복적으로 해결합니다. 각 하위 함수를 효과적으로 테스트하기 위해, LLM 시뮬레이션된 Python 실행기를 제안하며, 이 실행기는 코드 실행을 추적하고 중요한 변수 상태를 정확하게 식별하여 오류를 찾아냅니다. 광범위한 실험 결과 MGDebugger가 기존의 디버깅 시스템을 능가하며, HumanEval에서 시드 생성에 비해 정확성이 18.9% 향상되었으며, HumanEvalFix에서 97.6%의 수리 성공률을 달성함을 보여줍니다. 또한 MGDebugger는 다양한 범주와 난이도 수준의 버그를 효과적으로 수정하여 그 견고성과 효과를 입증합니다.
English
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.

Summary

AI-Generated Summary

PDF338November 16, 2024