Specification and Detection of LLM Code Smells

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Mahmoudi, Brahim, Chenail-Larcher, Zacharie, Moha, Naouel, Stiévenart, Quentin, Avellaneda, Florent
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914221183205376
author Mahmoudi, Brahim
Chenail-Larcher, Zacharie
Moha, Naouel
Stiévenart, Quentin
Avellaneda, Florent
author_facet Mahmoudi, Brahim
Chenail-Larcher, Zacharie
Moha, Naouel
Stiévenart, Quentin
Avellaneda, Florent
contents 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%.
format Preprint
id arxiv_https___arxiv_org_abs_2512_18020
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Specification and Detection of LLM Code Smells
Mahmoudi, Brahim
Chenail-Larcher, Zacharie
Moha, Naouel
Stiévenart, Quentin
Avellaneda, Florent
Software Engineering
Artificial Intelligence
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%.
title Specification and Detection of LLM Code Smells
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2512.18020