TL;DR
This paper introduces MDEVAL, the first massively multilingual benchmark for code debugging, covering 20 programming languages and three tasks: Automated Program Repair (APR), Bug Localization (BL), and Bug Identification (BI). They also release MDEVAL-INSTRUCT, a new instruction corpus for training debugging LLMs, and demonstrate a significant performance gap between open-source and closed-source LLMs on this challenging multilingual task.
What Problem Does This Paper Address?
Large Language Models (LLMs) have shown impressive capabilities in code generation and understanding, making them promising for code debugging. However, existing code debugging benchmarks are often limited to a few languages (primarily Python) and don't adequately capture the complexities of multilingual debugging. This oversight means that LLMs might perform well on common languages but struggle with the diverse syntax, semantics, and common error patterns found in less represented programming languages. This gap hinders the development of truly robust and universally applicable code debugging LLMs.
Methods
The authors introduce a comprehensive framework for multilingual code debugging, consisting of three main components:
- MDEVAL Benchmark: This is the core contribution, a new benchmark designed to evaluate LLMs on code debugging across 20 programming languages. It includes 3.9K test samples covering three tasks:
- Automated Program Repair (APR): Fixing buggy code snippets.
- Bug Localization (BL): Identifying the specific lines of code containing an error.
-
Bug Identification (BI): Classifying the type of error present in the code. The benchmark incorporates both generic and language-specific bug types.
-
MDEVAL-INSTRUCT Corpus: To facilitate training LLMs for debugging, the authors created this instruction corpus. It's generated using a technique called "xDebugGen," which involves injecting bugs into correct code snippets and their corresponding queries or solutions. This process creates pairs of buggy and correct code, suitable for instruction tuning.
- xDebugCoder Baseline: A multilingual debugger model fine-tuned on the MDEVAL-INSTRUCT corpus. This model serves as a strong baseline to demonstrate the effectiveness of their approach and to evaluate LLMs' transferability across different programming languages.
Datasets
- MDEVAL: The newly introduced benchmark dataset, containing 3.9K samples across 20 programming languages for APR, BL, and BI tasks.
- MDEVAL-INSTRUCT: A newly created instruction corpus for training debugging LLMs, derived from MDEVAL and augmented with bug injection techniques.
- Magicoder-Instruct: Used in conjunction with MDEVAL-INSTRUCT for training the xDebugCoder baseline, providing general instruction-following capabilities.
Key Insights and Ideas
- Language Diversity is Crucial: The performance gap between models on different languages highlights that simply training on Python isn't enough for robust multilingual debugging. Language-specific errors and nuances are significant challenges.
- Bug Localization is a Bottleneck: While LLMs are improving at fixing bugs (APR), their ability to accurately pinpoint the location of those bugs (BL) lags behind. This suggests that improving LLMs' understanding of code structure and context is critical for better repair.
- Closed-Source Models Lead, But Open-Source is Catching Up: There's a clear performance advantage for proprietary models like GPT-4o and Claude-3.5, but the authors' fine-tuned open-source model (xDebugCoder) shows competitive results, indicating the potential of targeted training.
- Instruction Tuning Matters: The MDEVAL-INSTRUCT corpus and the resulting xDebugCoder model demonstrate that specialized instruction tuning can significantly boost debugging performance, even with a relatively small dataset.
Key Results
- Performance Gap: Closed-source LLMs (e.g., GPT-4o, Claude-3.5) significantly outperform open-source models across most tasks and languages in MDEVAL. For instance, in Bug Identification, closed-source models achieve nearly 10 points higher accuracy.
- APR Performance: Models like GPT-4o, Claude-3.5-sonnet, and Qwen2.5-Coder-Instruct show strong performance in Automated Program Repair.
- xDebugCoder Baseline: The fine-tuned xDebugCoder model, despite being trained on a limited amount of data (16K samples from MDEVAL-INSTRUCT), demonstrates competitive performance, highlighting the effectiveness of the MDEVAL-INSTRUCT dataset.
- Bug Localization Difficulty: Accuracy in bug localization is consistently lower than in automated program repair for most models, suggesting this is a more challenging task for LLMs.
Limitations and Future Work
- Language Coverage: While MDEVAL covers 20 languages, many less common or niche languages are still excluded. Expanding the benchmark to include more languages is a future direction.
- Real-World Applicability: The current benchmark simulates realistic scenarios but may not fully capture the complexity and variability of real-world software development. Incorporating more diverse and complex projects is suggested.
- Instruction Tuning Data Quality: The MDEVAL-INSTRUCT corpus is generated via LLM-based bug injection. While promising, further improvements in the quality and diversity of this data could enhance training. Exploring advanced LLMs or real-world debugging feedback is proposed.
- Ethical Considerations: The authors highlight potential risks of incorrect program analysis or faulty repair, recommending the use of MDEVAL within a sandbox environment for safety.
- Future Work: The authors plan to continue expanding the number of languages in MDEVAL.
Summary updated