Abstract
Automated Program Repair (APR) has traditionally relied on specialized templates or models trained on specific bug-fix datasets. This study investigates a paradigm shift toward using general-purpose Large Pre-trained Language Models (PLMs) for program repair. Evaluating nine models across Java, Python, and C, the researchers find that off-the-shelf PLMs significantly outperform state-of-the-art specialized tools. The study highlights the effectiveness of code infilling and the use of entropy for patch ranking, suggesting a new "one-size-fits-all" approach to software debugging.
Introduction
A recent study by researchers at UIUC explores a fundamental shift in software maintenance: the transition from specialized "bug-fixing" algorithms to general-purpose Large Pre-trained Language Models (PLMs). While traditional Automated Program Repair (APR) tools are often limited by rigid templates or the need for massive, curated bug-fix datasets, this research demonstrates that models trained on general code corpora—like Codex and GPT-Neo—can be remarkably effective at fixing real-world software bugs without any task-specific fine-tuning.
The Evolution of Automated Program Repair
Historically, APR has followed two main paths. Template-based approaches use human-defined rules to address common bug patterns, which makes them reliable but inflexible. Learning-based approaches treat bug fixing as a translation task, using Neural Machine Translation (NMT) to convert buggy code into fixed code. However, NMT models require high-quality datasets of bug-fix pairs, which are difficult to assemble and often lead to poor generalization on unseen bug types.
This paper proposes skipping specialized training entirely, leveraging the "raw" reasoning power of massive models trained on billions of lines of general code.
Methodology
The researchers evaluated nine different PLMs, ranging from 125 million to 20 billion parameters. These included generative models (e.g., GPT-Neo) and infilling models (e.g., InCoder and Codex). Three repair settings were tested:
- Complete Function Generation: Rewriting the entire function using few-shot prompting.
- Correct Code Infilling: Removing the buggy line and asking the model to fill the gap using surrounding context.
- Single Line Generation: Predicting a replacement for a specific buggy line.
A key innovation in their methodology is the use of entropy—a measure of how "natural" a piece of code appears to the model—to rank potential patches. By prioritizing patches that the model finds most probable, the researchers could significantly reduce the time spent on expensive test suite executions.
Experimental Setup and Benchmarks
The study utilized five diverse benchmarks across three programming languages:
- Defects4J (v1.2 and v2.0): Real-world Java bugs.
- QuixBugs (Java and Python): Classic algorithmic bugs.
- ManyBugs: Large-scale C bugs.
This multi-lingual approach marks a significant departure from traditional APR research, which typically focuses on a single language, usually Java.
Key Insights: Scaling and Context
The study yielded several critical findings:
- The Scaling Law of Repair: Larger models consistently performed better, fixing more bugs and producing more "natural" code.
- The Power of Suffixes: Infilling models, which consider the code following a bug (the suffix), vastly outperformed purely generative models. The suffix provides vital constraints that prevent the model from "hallucinating" irrelevant logic.
- Zero-Shot Superiority: General-purpose models like Codex fixed 32 more bugs on the Defects4J 1.2 dataset than the previous state-of-the-art specialized tool, AlphaRepair.
- Naturalness as a Filter: Correct patches almost always exhibited lower entropy than incorrect ones, validating the use of PLMs as effective rankers for candidate fixes.
Results and Performance
By combining different PLMs, the researchers achieved 109 correct fixes on Defects4J 1.2, a substantial improvement over the 67 fixes achieved by AlphaRepair. Furthermore, infilling-style repair led to higher compilation rates because the models were better at maintaining the syntactic flow of the surrounding code.
However, accuracy comes at a cost. The 20-billion-parameter GPT-NeoX was 71 times slower at generating patches than its 125-million-parameter counterpart, highlighting a significant trade-off between speed and performance.
Limitations and Future Directions
While the results are promising, several challenges remain. The authors addressed concerns regarding "data leakage" by showing that 66% of generated fixes differed from the original developer patches, suggesting the models are reasoning about logic rather than just memorizing.
Future work will likely focus on:
- Fault Localization: Integrating these models with tools that can automatically identify the buggy location.
- Efficiency: Distilling large models into smaller, faster versions optimized for repair tasks.
- Hybrid Approaches: Combining the creative potential of LLMs with the reliability of human-designed repair templates.
Overall, this research suggests that the era of specialized program repair tools may be giving way to a more general, language-agnostic approach powered by large-scale pre-training.
Summary updated