NobleBlocks

Research indexConference paper

Does LLM Generated Code Smell?

Paul, Zhu, Bayley

International Conference on Cloud and Big Data Computing (ICCBDC)14 Aug 2025

NobleIDark:/48914/w1/20261105/44B69C82DOI10.1109/iccbdc67784.2025.00017

Paywalled

The full text is at the publisher

You can read the abstract here, or open it at the publisher.

Read at the publisher

Abstract

Large Language Models (LLMs) are increasingly being used to generate program code. Much research has been reported on the functional correctness of generated code, but there is far less on code quality. In this study, we evaluate the code smells, an important indicator of code quality, of the Java programs generated in response to prompts given to four state-of-the-art LLMs: Gemini Pro, ChatGPT, Codex, and Falcon. We find that LLM-generated code has a higher incidence of code smells compared to reference solutions and this number increases with coding task complexity. We also find that the types of code smells vary with both programming topic and the choice of model. Falcon performed best, followed by Gemini Pro and ChatGPT. Codex performed worst, increasing by$\mathbf{1 0 9 \%}$the average number of violations of coding rules. The quality of LLM-generated code tends to be worse in advanced topics such as encapsulation, abstract class and generics, polymorphism and inheritance, etc. The worst types of code smells in the baseline were also the worst in the LLM-generated code. On average across all LLMs, the implementation smells increase by 81 % and design smells by 64 %.

Discussion

Citations

More

Suggest a correction or report