# Frustrated with Code Quality Issues? LLMs can Help!

**Authors:** Nalin Wadhwa, Jui Pradhan, Atharv Sonwane, Surya Prakash Sahu, Nagarajan Natarajan, Aditya Kanade, Suresh Parthasarathy, Sriram Rajamani  
**arXiv:** [2309.12938](https://arxiv.org/abs/2309.12938)  
**Date:** 2023-09-22  
**Summary page:** https://www.summarizepaper.com/en/paper/2309.12938v1/

## Key points

- Large language models (LLMs) can assist developers in improving code quality
- Code quality impacts reliability, maintainability, and security of software projects
- Static analysis tools are commonly used to identify code quality issues
- CORE (COde REvisions) is a tool that uses LLMs to generate candidate code revisions based on recommendations from static analysis tools
- CORE includes a proposer LLM and a ranker LLM
- The proposer LLM generates candidate revisions, which undergo static quality checks
- The ranker LLM evaluates the changes made by the proposer using an acceptance criteria rubric similar to what a human developer would enforce
- CORE ranks the candidate revisions based on scores assigned by the ranker LLM before presenting them to developers
- CORE revised 59.2% of Python files across 52 quality checks to pass scrutiny by both a tool and a human reviewer
- The ranker LLM reduced false positives by 25.8%
- CORE produced revisions that passed static analysis tools in 76.8% of Java files across 10 quality checks, comparable to a specialized program repair tool's success rate of 78.3%
- CORE achieved these results with significantly less engineering effort

## Summary

explores the use of large language models (LLMs) to assist developers in improving code quality. The quality of code is crucial as it impacts the reliability, maintainability, and security of software projects. To identify code quality issues, static analysis tools are commonly used in developer workflows. However, addressing these issues requires additional effort from developers. In response to this challenge, the authors propose a tool called CORE (COde REvisions), which utilizes a pair of LLMs - a proposer and a ranker. The proposer LLM takes recommendations from static analysis tools and generates candidate code revisions based on them. These candidates undergo static quality checks, and those that pass are retained. However, there is a possibility that the proposer LLM may introduce unintended functionality changes that go undetected by static analysis. To address this concern, the ranker LLM evaluates the changes made by the proposer using an acceptance criteria rubric similar to what a human developer would enforce. CORE leverages the scores assigned by the ranker LLM to rank the candidate revisions before presenting them to developers. The results show that CORE was able to revise 59.2% of Python files across 52 quality checks so that they passed scrutiny by both a tool and a human reviewer. Additionally, the ranker LLM reduced false positives by 25.8% in these cases. Furthermore, CORE produced revisions that passed static analysis tools in 76.8% of Java files across 10 quality checks, comparable to a specialized program repair tool's success rate of 78.3%. Notably, CORE achieved these results with significantly less engineering effort. Overall, this research demonstrates how LLMs can be effectively utilized to assist developers in resolving code quality issues and improving software reliability and maintainability while reducing false positives generated by static analysis tools.
