TY - GEN
T1 - Specification and Detection of LLM Code Smells
AU - Mahmoudi, Brahim
AU - Chenail-Larcher, Zacharie
AU - Moha, Naouel
AU - Stiévenart, Quentin
AU - Avellaneda, Florent
N1 - Publisher Copyright:
© 2026 Copyright held by the owner/author(s)
PY - 2026/7/8
Y1 - 2026/7/8
N2 - 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%.
AB - 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%.
KW - Code Smells
KW - Large Language Models
KW - LLM Integration
KW - LLMs
UR - https://www.scopus.com/pages/publications/105044794268
U2 - 10.1145/3786582.3786835
DO - 10.1145/3786582.3786835
M3 - Contribution to conference proceedings
AN - SCOPUS:105044794268
T3 - Proceedings - 2026 IEEE/ACM 48th International Conference on Software Engineering: New Ideas and Emerging Results, ICSE-NIER 2026
SP - 181
EP - 185
BT - Proceedings - 2026 IEEE/ACM 48th International Conference on Software Engineering
PB - Association for Computing Machinery, Inc
T2 - 48th International Conference on Software Engineering: New Ideas and Emerging Results, ICSE-NIER 2026
Y2 - 12 April 2026 through 18 April 2026
ER -