Investigating The Smells of LLM Generated Code
Not on the map. Why?
Abstract (arXiv)
Context: 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. Objectives: In this study, we propose a scenario-based method of evaluating the quality of LLM-generated code to identify the weakest scenarios, for which the quality of LLM-generated code should be improved. Methods: The method measures code smells, an important indicator of code quality, and compares them with a baseline formed from reference solutions of professionally written code. The test dataset is divided into various subsets according to the topics of the code and complexity of the coding tasks to represent different scenarios of using LLMs for code generation. We will also present an automated test system for this purpose and report experiments with the Java programs generated in response to prompts given to four state-of-the-art LLMs: Gemini Pro, ChatGPT, Codex, and Falcon. Results: We find that LLM-generated code has a higher incidence of code smells compared to reference solutions. Falcon performed the least badly, with a smell increase of 42.28%, followed by Gemini Pro (62.07%), ChatGPT (65.05%) and finally Codex (84.97%). The average smell increase across all LLMs was 63.34%, comprising 73.35% for implementation smells and 21.42% for design smells. We also found that the increase in code smells is greater for more complex coding tasks and for more advanced topics, such as those involving object-orientated concepts. Conclusion: In terms of code smells, LLMs' performances on various coding task complexities and topics are highly correlated to the quality of human-written code in the corresponding scenarios. However, the quality of LLM-generated code is noticeably poorer than human-written code.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Builds on 14 of its 62 references that are in the map. First posted on arXiv 3 Oct 2025.
Builds on
14 of 62 references.
References · 14
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 78
- 2022Automated Repair of Programs from Large Language Modelscited by 71
- 2024Benchmarks and Metrics for Evaluations of Code Generation: A Critical Reviewcited by 19
- 2020Code Smells and Refactoring: A Tertiary Systematic Review of Challenges and Observationscited by 18
- 2024How Propense Are Large Language Models at Producing Code Smells? A Benchmarking Studycited by 6
- 2024User Centric Evaluation of Code Generation Toolscited by 4
Built on by
Citing papers per year: 2026: 9.
9 papers.
- 2026Model Context Protocol (MCP) Tool Descriptions Are Smelly! Towards Improving AI Agent Efficiency with Augmented MCP Tool Descriptionscited by 15
- 2026What to Cut? Predicting Unnecessary Methods in Agentic Code Generationcited by 5
- 2026What Breaks When LLMs Code? Characterizing Operational Safety Failures of Agentic Code Assistantscited by 3
- 2026To What Extent Does Agent-generated Code Require Maintenance? An Empirical Studycited by 2
- 2026Can AI Agents Generate Microservices? How Far are We?cited by 1
- 2026Is Agent Code Less Maintainable Than Human Code?cited by 1
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoringcited by 0
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Codecited by 0
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Codecited by 0
- 2026What is the Difference Between Me and You? Benchmarking the Quality Gap Between Human-Written and AI-Generated Code11 Sep 2026
- 2026Do These Violent Delights Have Violent Ends? Measuring the Post-Merge Fate of Agentic Code10 Jul 2026
- 2026Is Agent Code Less Maintainable Than Human Code?19 Jun 2026
- 2026What Breaks When LLMs Code? Characterizing Operational Safety Failures of Agentic Code Assistants29 May 2026
- 2026To What Extent Does Agent-generated Code Require Maintenance? An Empirical Study7 May 2026
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoring1 May 2026
- 2026Can AI Agents Generate Microservices? How Far are We?9 Mar 2026
- 2026What to Cut? Predicting Unnecessary Methods in Agentic Code Generation19 Feb 2026
- 2026Model Context Protocol (MCP) Tool Descriptions Are Smelly! Towards Improving AI Agent Efficiency with Augmented MCP Tool Descriptions16 Feb 2026