Effective Large Language Model Debugging with Best-first Tree Search
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 35 of its 41 references that are in the map. First posted on arXiv 26 Jul 2024.
Builds on
35 of 41 references.
References · 35
- 2023GPT-4 Technical Reportcited by 18,132
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,155
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
23 more
- 2024Mixtral of Expertscited by 1,785
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2022Large Language Models Can Self-Improvecited by 656
- 2023WizardMath: Empowering Mathematical Reasoning for Large Language Models via Reinforced Evol-Instructcited by 618
- 2023Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Modelscited by 551
- 2020Captum: A unified and generic model interpretability library for PyTorchcited by 542
- 2023Logic-LM: Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoningcited by 379
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2022Reasoning with Language Model Prompting: A Surveycited by 251
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
- 2023MathPrompter: Mathematical Reasoning using Large Language Modelscited by 236
- 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
- 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 150
- 2024OpenMathInstruct-1: A 1.8 Million Math Instruction Tuning Datasetcited by 143
- 2023LLMs cannot find reasoning errors, but can correct them given the error locationcited by 85
- 2023Coupling Large Language Models with Logic Programming for Robust and General Reasoning from Textcited by 59
- 2024Prompting Large Language Models to Tackle the Full Software Development Lifecycle: A Case Studycited by 40
- 2024Nemotron-4 15B Technical Reportcited by 36
- 2023Using Captum to Explain Generative Language Modelscited by 33
Built on by
Citing papers per year: 2026: 1.
1 paper.