Static Analysis as a Feedback Loop: Enhancing LLM-Generated Code Beyond Correctness

Large language models (LLMs) have demonstrated impressive capabilities in code generation, achieving high scores on benchmarks such as HumanEval and MBPP. However, these benchmarks primarily assess functional correctness and neglect broader dimensions of code quality, including security, reliability, readability, and maintainability. In this work, we systematically evaluate the ability of LLMs to generate high-quality code across multiple dimensions using the PythonSecurityEval benchmark. We introduce an iterative static analysis-driven prompting algorithm that leverages Bandit and Pylint to identify and resolve code quality issues. Our experiments with GPT-4o show substantial improvements: security issues reduced from >40% to 13%, readability violations from >80% to 11%, and reliability warnings from >50% to 11% within ten iterations. These results demonstrate that LLMs, when guided by static analysis feedback, can significantly enhance code quality beyond functional correctness.

Authors

Institutions

Publication Details

Published
2025-09-08
DOI
https://doi.org/10.1109/scam67354.2025.00017
Citations
2
Primary Topic
Mathematics, Computing, and Information Processing
Type
article
Field-Weighted Citation Impact
3.01
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Static Analysis as a Feedback Loop: Enhancing LLM-Generated Code Beyond Correctness

Sherlock A. Licorish, Markus Wagner, Christoph Treude, Scott Blyth
2 citations
Mathematics, Computing, and Information Processing
3.01
article

Static Analysis as a Feedback Loop: Enhancing LLM-Generated Code Beyond Correctness

Sherlock A. Licorish, Markus Wagner, Christoph Treude, Scott Blyth
article en
2 citations

Abstract

Large language models (LLMs) have demonstrated impressive capabilities in code generation, achieving high scores on benchmarks such as HumanEval and MBPP. However, these benchmarks primarily assess functional correctness and neglect broader dimensions of code quality, including security, reliability, readability, and maintainability. In this work, we systematically evaluate the ability of LLMs to generate high-quality code across multiple dimensions using the PythonSecurityEval benchmark. We introduce an iterative static analysis-driven prompting algorithm that leverages Bandit and Pylint to identify and resolve code quality issues. Our experiments with GPT-4o show substantial improvements: security issues reduced from >40% to 13%, readability violations from >80% to 11%, and reliability warnings from >50% to 11% within ten iterations. These results demonstrate that LLMs, when guided by static analysis feedback, can significantly enhance code quality beyond functional correctness.

Monash University (AU), Singapore Management University (SG), University of Otago (NZ)
Openalex Percentile: Top 7%
Mathematics, Computing, and Information Processing
3.01
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Static Analysis as a Feedback Loop: Enhancing LLM-Generated Code Beyond Correctness — Sherlock A. Licorish, Markus Wagner, et al. · (2025) | TGRS Research Map | TGRS