TL;DR
Large Language Models (LLMs) show promise in code debugging, but current evaluations often focus on single-function fixes. This paper introduces RepoDebug, a novel dataset and evaluation framework for repository-level debugging across multiple tasks and languages. Even state-of-the-art LLMs struggle with this complex task, highlighting the need for further research.
What Problem Does This Paper Address?
The field of code debugging with Large Language Models (LLMs) has seen rapid advancements, particularly in automatic program repair. However, existing benchmarks primarily evaluate LLMs on their ability to fix errors within isolated functions. This overlooks the more realistic and challenging scenario of debugging entire code repositories, which involves understanding interdependencies between files, managing larger codebases, and handling diverse error types and programming languages. This gap leads to an incomplete understanding of LLMs' true capabilities and limitations in real-world software development.
Methods
The authors introduce RepoDebug, a new dataset designed to evaluate LLMs on repository-level code debugging. The dataset is constructed by:
- Collecting repositories: They sourced projects from GitHub created after 2022, with at least 100 stars, to mitigate data leakage.
- Injecting bugs: Using Abstract Syntax Trees (ASTs) and the
tree-sitterlibrary, they systematically introduced 22 distinct error subtypes across 4 main categories (syntax, reference, logic, multiple errors) into code files. This AST-based approach allows for precise control over error injection and ensures structural validity. - Manual validation: All injected bugs were manually checked for accuracy, ensuring the error type, location, and the buggy/correct code pairs were valid.
The evaluation tasks for LLMs include:
- Bug Identification (BI): Predicting the error subtype.
- Bug Localization (BL): Identifying the line(s) containing the error(s).
- Automatic Program Repair (APR): Generating the corrected code.
Datasets
The primary contribution is the introduction of the RepoDebug dataset.
- RepoDebug: This dataset comprises 3 tasks (Bug Identification, Bug Localization, Automatic Program Repair), spans 8 programming languages (C, C#, Go, Java, JavaScript, Python, Ruby, and Rust), and includes 22 distinct error subtypes. It is built upon 63 GitHub repositories, with 46 for training and 17 for testing.
- Existing Benchmarks: The paper also reviews and compares RepoDebug against existing benchmarks like SWE-Bench, DebugBench, and DebugEval, highlighting their limitations in scope (function-level, limited languages/tasks) that RepoDebug aims to address.
Key Insights and Ideas
- Repository-level debugging is a significant challenge: Even the most advanced LLMs struggle to perform well on repository-level debugging tasks, indicating a substantial gap between current capabilities and real-world needs.
- Language matters: LLMs perform better on high-level languages like Java and JavaScript compared to lower-level or statically typed languages like C and Rust. This is attributed to the inherent complexity of low-level languages and potential biases in LLM training data.
- Error type complexity impacts performance: Syntax errors are the easiest for LLMs to handle, while multiple errors present the most significant challenge.
- Code length is a bottleneck: As code length increases, LLM performance generally degrades, suggesting limitations in their context window or processing capabilities for large codebases.
- Over-correction is a common issue: Models often identify more errors than actually exist or introduce spurious corrections, indicating a lack of precision in their debugging process.
Key Results
The paper evaluated 10 LLMs (7 open-source, 3 closed-source) on the RepoDebug dataset.
- Top Performer: Claude 3.5 Sonnet emerged as the best-performing model, showing strong capabilities in Bug Identification and Automatic Program Repair.
- Performance Gap: Despite Claude 3.5 Sonnet's lead, its performance on repository-level debugging is still considered insufficient.
- Language Performance: For example, Claude 3.5 Sonnet achieved 54.15% accuracy on syntax errors but only 3.66% on multiple errors in the Bug Identification task.
- Code Length Impact: For Claude 3.5 Sonnet, performance on short tokens (less than 500) was significantly better than for tokens between 500 and 1000. For instance, its accuracy dropped from 51.48% to 43.07% for BI.
- Error Number Impact: Increasing the number of errors from 1 to 2 significantly decreased accuracy for most models, though One Bug's Location (OBL) accuracy saw a marked increase.
Limitations and Future Work
- Model Limitations: The study highlights that current LLMs, even state-of-the-art ones, fall short in repository-level debugging, especially with increasing code complexity and error counts.
- Data Leakage: The authors observed that Claude 3.5 Sonnet performed worse on instances created after April 2024, suggesting potential data leakage as a factor influencing performance.
- Future Work: The authors hope RepoDebug will spur further research into LLM debugging capabilities, particularly in handling multi-task, multi-language, and repository-level scenarios. They suggest that advanced model architectures and improved handling of long-range contextual information are crucial for future progress.
Summary updated