arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2407.19055cs.SEcs.AIcs.LG
收藏

使用最佳优先树搜索进行有效的大语言模型调试

Effective Large Language Model Debugging with Best-first Tree Search

NVIDIA(英伟达)

Jialin Song, Jonathan Raiman, Bryan Catanzaro

AI总结:

提出一种带自我反思的最佳优先树搜索算法(BESTER),使LLM能通过识别先前错误来调试代码,在三个基准上实现最先进的Pass@1,并提供了关于自我反思机制与有效性的深入分析。

摘要:

大语言模型(LLMs)在代码生成任务中展现出潜力。然而,其代码编写能力通常在范围上受限:虽然它们能成功实现简单函数,但在更复杂的任务中表现不佳。与人类程序员相比,LLM编写代码的一个根本区别在于它无法持续发现并修复错误。调试是程序员的关键技能,能实现迭代代码改进以达成正确实现。在本工作中,我们提出一种新算法,使LLM能够通过自我反思和搜索来调试代码,其中模型尝试识别其先前的错误。我们的核心贡献是:1)一种带有自我反思的最佳优先树搜索算法(BESTER),在三个代码生成基准上实现了最先进的Pass@1。当我们在衡量通过率时考虑树搜索产生的额外推理成本,BESTER仍保持其优越性。2)一项关于自我反思在错误程序中关注什么以及它们如何影响错误修复的新颖可解释性研究,为调试过程提供了更深入的理解。3)一项关于自我反思何时在发现错误中有效的广泛研究。

英文摘要:

Large Language Models (LLMs) show promise in code generation tasks. However, their code-writing abilities are often limited in scope: while they can successfully implement simple functions, they struggle with more complex tasks. A fundamental difference with how an LLM writes code, compared to a human programmer, is that it cannot consistently spot and fix bugs. Debugging is a crucial skill for programmers and it enables iterative code refinement towards a correct implementation. In this work, we propose a novel algorithm to enable LLMs to debug their code via self-reflection and search where a model attempts to identify its previous mistakes. Our key contributions are 1) a best-first tree search algorithm with self-reflections (BESTER) that achieves state-of-the-art Pass@1 in three code generation benchmarks. BESTER maintains its superiority when we measure pass rates taking into account additional inference costs incurred by tree search. 2) A novel interpretability study on what self-reflections attend to in buggy programs and how they impact bug fixes, which provides a deeper understanding of the debugging process. 3) An extensive study on when self-reflections are effective in finding bugs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑