Abstract
As software projects progress, code quality assumes paramount importance, affecting reliability, maintainability, and security. Static analysis tools are commonly used to flag quality issues, but developers must still invest significant effort into manual revisions. We present CORE (COde REvisions), a framework architected using a duo of Large Language Models (LLMs): a proposer and a ranker. The proposer LLM utilizes natural language fix recommendations from tool documentation to generate candidate revisions. Candidates that pass static checks are then evaluated by a ranker LLM using a rubric to ensure minimal, intent-preserving changes. CORE successfully revised 59.2% of Python files across 52 quality checks to pass both tool and human scrutiny. In Java, CORE achieved a 76.8% fix rate, comparable to specialized program repair tools but with significantly less engineering effort.
Introduction
Static analysis tools like CodeQL and SonarQube are essential for identifying bugs and security vulnerabilities early in the development lifecycle. However, identifying an issue is only half the battle; the manual effort required to fix these "smells" remains a bottleneck. Existing Automated Program Repair (APR) techniques typically rely on complex, hand-written rules or massive datasets of buggy-vs-fixed code pairs, both of which are difficult to scale across languages and issue types.
CORE addresses this by leveraging the general-purpose reasoning of instruction-following LLMs. Instead of hard-coded rules, CORE "reads the manual," using the natural language documentation provided by tool developers to guide its revisions.
System Architecture
CORE operates as a multi-stage pipeline designed to automate the revision process without extensive fine-tuning. The architecture is divided into offline documentation of issues and online automated detection and mitigation.
- Prompt Construction: When an issue is flagged, CORE extracts the natural language description and fix recommendation from the tool's documentation.
- The Proposer: A GPT-3.5-Turbo model acts as the "coder," taking the constructed prompt to generate multiple candidate revisions.
- Pruning: Candidates are re-run through the static analysis tool. Revisions that still trigger the error or introduce syntax errors are discarded.
- The Ranker: A GPT-4 model acts as a "senior reviewer." It evaluates the remaining candidates against a rubric to ensure the fix is minimal and does not introduce unintended semantic changes or delete necessary code.
Documentation as Code
A key innovation of CORE is its ability to transform static documentation into actionable instructions. By feeding the LLM the same advice a human developer would receive, the model can apply complex logic without pre-defined symbolic rules.
Results and Evaluation
The researchers evaluated CORE on two primary benchmarks: CQPy (765 Python files across 52 CodeQL checks) and SQJava (483 Java files across 10 SonarQube checks).
- Python Performance: CORE successfully revised 81.57% of files to pass static analysis. After the Ranker's evaluation, 76.21% of these were deemed "high quality." The Ranker proved essential, reducing false positives (plausible but incorrect fixes) by 25.8%.
- Java Performance: CORE achieved a 76.8% fix rate. This is remarkably close to the 78.3% rate of Sorald, a state-of-the-art tool specifically engineered for these Java bugs over two years. In contrast, CORE was configured for these checks in just a few days.
- Human Acceptance: In a user study with 15 professional developers, CORE provided at least one acceptable revision for 70.64% of the files reviewed.
Conclusion
CORE demonstrates that LLMs can effectively bridge the gap between issue detection and resolution by utilizing existing documentation. While limitations remain—such as context window constraints for very large files and the potential for subtle semantic bugs—the system offers a highly scalable and efficient alternative to traditional rule-based repair tools. Future work will focus on closed-loop systems that incorporate feedback from test suites to further refine automated fixes.
Summary updated