# Specification and Detection of LLM Code Smells

arXiv: https://arxiv.org/abs/2512.18020 · HTML: https://mlsanity.com/paper/2512.18020/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 19 of its 52 references that are in the map.
- First posted on arXiv 19 Dec 2025.

## Builds on (most cited first, 19 of 19)

- [Why Do Multi-Agent LLM Systems Fail?](https://mlsanity.com/paper/2503.13657/) (2025)
- [Token-Budget-Aware LLM Reasoning](https://mlsanity.com/paper/2412.18547/) (2024)
- [A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systems](https://mlsanity.com/paper/2504.09037/) (2025)
- ["We Need Structured Output": Towards User-centered Constraints on Large Language Model Output](https://mlsanity.com/paper/2404.07362/) (2024)
- [Position is Power: System Prompts as a Mechanism of Bias in Large Language Models (LLMs)](https://mlsanity.com/paper/2505.21091/) (2025)
- [Defining and Detecting the Defects of the Large Language Model-based Autonomous Agents](https://mlsanity.com/paper/2412.18371/) (2024)
- [Are LLMs Correctly Integrated into Software Systems?](https://mlsanity.com/paper/2407.05138/) (2024)
- [Adaptively Robust LLM Inference Optimization under Prediction Uncertainty](https://mlsanity.com/paper/2508.14544/) (2025)
- [A Functional Software Reference Architecture for LLM-Integrated Systems](https://mlsanity.com/paper/2501.12904/) (2025)
- [RealHarm: A Collection of Real-World Language Model Application Failures](https://mlsanity.com/paper/2504.10277/) (2025)
- [A Taxonomy of Prompt Defects in LLM Systems](https://mlsanity.com/paper/2509.14404/) (2025)
- [BUMP: A Benchmark of Reproducible Breaking Dependency Updates](https://mlsanity.com/paper/2401.09906/) (2024)
- [Prompt Smells: An Omen for Undesirable Generative AI Outputs](https://mlsanity.com/paper/2401.12611/) (2024)
- [Understanding Defects in Generated Codes by Language Models](https://mlsanity.com/paper/2408.13372/) (2024)
- [I depended on you and you broke me: An empirical study of manifesting breaking changes in client packages](https://mlsanity.com/paper/2301.04563/) (2023)
- [Analyzing 16,193 LLM Papers for Fun and Profits](https://mlsanity.com/paper/2504.08619/) (2025)
- [Ensuring Reproducibility in Generative AI Systems for General Use Cases: A Framework for Regression Testing and Open Datasets](https://mlsanity.com/paper/2505.02854/) (2025)
- [Unboxing Default Argument Breaking Changes in 1 + 2 Data Science Libraries](https://mlsanity.com/paper/2408.05129/) (2024)
- [System Message Generation for User Preferences using Open-Source Models](https://mlsanity.com/paper/2502.11330/) (2025)

## Abstract (arXiv)

Large Language Models (LLMs) have gained massive popularity in recent years and are increasingly integrated into software systems for diverse purposes. However, poorly integrating them in source code may undermine software system quality. Yet, to our knowledge, there is no formal catalog of code smells specific to coding practices for LLM inference. In this paper, we introduce the concept of LLM code smells and formalize five recurrent problematic coding practices related to LLM inference in software systems, based on relevant literature. We extend the detection tool SpecDetect4AI to cover the newly defined LLM code smells and use it to validate their prevalence in a dataset of 200 open-source LLM systems. Our results show that LLM code smells affect 60.50% of the analyzed systems, with a detection precision of 86.06%.
