NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Empirical Evaluation of Large Language Models in Automated Program Repair

Jiajun Sun, Fengjie Li, Xinzhu Qi, Hongyu Zhang, Jiajun Jiang · DOI

Abstract

The increasing prevalence of software bugs has made automated program repair (APR) a key research focus. Large language models (LLMs) offer new opportunities for APR, but existing studies mostly rely on smaller, earlier-generation models and Java benchmarks. The repair capabilities of modern, large-scale LLMs across diverse languages and scenarios remain underexplored. To address this, we conduct a comprehensive empirical study of four open-source LLMs—CodeLlama, LLaMA, StarCoder, and DeepSeek-Coder—spanning 7B to 33B parameters, diverse architectures, and purposes. We evaluate them across two bug scenarios (enterprise-grade and algorithmic), three languages (Java, C/C++, Python), and four prompting strategies, analyzing over 600K generated patches on six benchmarks. Key findings include: (1) model specialization (e.g., CodeLlama) can outperform larger general-purpose models (e.g., LLaMA); (2) repair performance does not scale linearly with model size; (3) correct patches often appear early in generation; and (4) prompts significantly affect results. These insights offer practical guidance for designing effective and efficient LLM-based APR systems.

Introduction

Automated Program Repair (APR) is often considered the "holy grail" of software maintenance: the ability for a system to automatically find and fix bugs without human intervention. While early APR relied on rigid rules or templates, the rise of Large Language Models (LLMs) has opened a new frontier.

However, most existing research has focused on older, smaller models or has been limited almost exclusively to Java. This study fills that gap with a rigorous, multi-dimensional evaluation of modern, massive open-source models—ranging from 7 billion to 33 billion parameters—across different programming languages (like C++ and Python) and different types of bugs (complex enterprise issues vs. algorithmic errors).

Experimental Methodology

The researchers evaluated four heavy-hitting open-source models: CodeLlama, LLaMA-2, StarCoder, and DeepSeek-Coder. To understand the impact of context, they tested four distinct prompting strategies.

Prompting strategies used in the study, including zero-shot and analysis-augmented guidance.

These strategies included:

  1. Two-shot: Providing two examples of bug-fix pairs.
  2. One-shot: Providing one example.
  3. Zero-shot: Asking for a fix with no examples.
  4. Analysis-augmented: Asking the model to first analyze the bug (Chain-of-Thought style) before attempting a fix.

The evaluation used a two-stage validation process. First, a patch had to pass all existing test cases (making it "plausible"). Then, the authors manually inspected these plausible patches to ensure they were semantically identical to the ground-truth developer fix (making it "correct").

Benchmarks and Datasets

The study utilized six diverse benchmarks covering 2,309 bugs:

  • Enterprise-grade Projects: Defects4J (Java) and BugsCpp (C/C++), representing real-world, complex software systems.
  • Algorithmic Assignments: IntroClass (C and Java) and ConDefects (Java and Python), featuring logic-heavy bugs from student submissions or competitive programming.

Key Insights and Results

Specialization Beats Sheer Scale

One of the most striking findings was that CodeLlama-7B (a model fine-tuned for code) consistently outperformed the much larger LLaMA-2-13B (a general-purpose model). This suggests that for APR, domain-specific training is more valuable than just adding more parameters.

Model Complementarity

Smaller models often fixed unique bugs that larger models missed. This implies that the best APR system might not be one giant model, but an ensemble of different models working together. The overlap of fixed bugs varies significantly across benchmarks and versions.

Venn diagrams showing the overlap of bugs fixed by different LLMs on Defects4J v1.2 and v2.0.

The "Early Bird" Patch and Prompting Power

Most correct patches are generated very early in the process. For StarCoder on Java assignments, over 95% of correct fixes appeared within the first 30 attempts. Furthermore, the way you prompt a model can be just as important as the model's size. On the Python dataset, adding a single example to the prompt increased CodeLlama’s success rate by a staggering 206.7%.

Performance Champions and the Enterprise Gap

DeepSeek-Coder was the overall champion, achieving a repair rate of 45.45% on algorithmic benchmarks. However, real-world enterprise bugs remain a massive challenge. While models fixed nearly half of the algorithmic bugs, the repair rate for enterprise C++ bugs (BugsCpp) was a sobering 5.66%.

Discussion and Future Work

The authors acknowledge the persistent shadow of data leakage: because these models are trained on public GitHub data, they may have "memorized" some of the bugs and fixes in the benchmarks.

Furthermore, the study assumed "perfect fault localization," meaning the models were told exactly which function was broken. Future work needs to integrate LLMs into the full pipeline, from identifying the buggy file to verifying the fix in complex environments. The authors also call for more research into "cost-aware" APR to balance the high computational price of LLMs with the need for fast, reliable fixes.

Summary updated

BibTeX
@misc{sun2025empirical,
  author = {Jiajun Sun and Fengjie Li and Xinzhu Qi and Hongyu Zhang and Jiajun Jiang},
  title = {{Empirical Evaluation of Large Language Models in Automated Program Repair}},
  year = {2025},
  eprint = {2506.13186},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.13186},
}
Figure