用自然语言做代码调试中间表示,提升复杂错误修复能力
NL-Debugging: Exploiting Natural Language as an Intermediate Representation for Code Debugging
- 将自然语言作为代码调试的中间表示,替代传统代码级分析
- 在多个基准上优于传统方法,支持基于执行反馈的直接修正
- 适合需要理解算法逻辑的复杂编程问题调试
调试是大模型编程能力的关键环节。早期方法多聚焦代码级分析,难以应对需深入理解算法逻辑的复杂错误。近期大语言模型的发展推动了利用自然语言推理提升代码任务的研究。但两个核心问题仍待解答:何种自然语言格式最适于调试?自然语言推理能带来哪些具体优势?本文提出NL-DEBUGGING框架,采用自然语言作为中间表示以改进代码调试。通过在自然语言层面进行调试,我们证明该方法优于传统手段,并可通过执行反馈引导的直接修正拓展修改空间。研究揭示了自然语言推理在自动化代码调试中的潜力,有助于解决复杂编程挑战。
原文摘要 · Abstract (English)
Debugging is a critical aspect of LLM's coding ability. Early debugging efforts primarily focused on code-level analysis, which often falls short when addressing complex programming errors that require a deeper understanding of algorithmic logic. Recent advancements in large language models (LLMs) have shifted attention toward leveraging natural language reasoning to enhance code-related tasks. However, two fundamental questions remain unanswered: What type of natural language format is most effective for debugging tasks? And what specific benefits does natural language reasoning bring to the debugging process? In this paper, we introduce NL-DEBUGGING, a novel framework that employs natural language as an intermediate representation to improve code debugging. By debugging at a natural language level, we demonstrate that NL-DEBUGGING outperforms traditional debugging methods and enables a broader modification space through direct refinement guided by execution feedback. Our findings highlight the potential of natural language reasoning to advance automated code debugging and address complex programming challenges.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。