arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.22976cs.SEcs.AI
收藏

LLM 代码异味:分类与检测方法

LLM Code Smells: A Taxonomy and Detection Approach

École de technologie supérieure;Université du Québec à Montréal

Zacharie Chenail-Larcher, Brahim Mahmoudi, Naouel Moha, Quentin Stiévenart, Florent Avellaneda

AI总结:

本文提出并完善了LLM代码异味的概念,构建了包含9种异味的分类体系,开发了静态检测工具SpecDetect4LLM,并在692个开源项目中验证了其检测效果(精确率91.3%,召回率71.8%),发现73.5%的项目存在此类异味。

摘要:

大型语言模型(LLM)因其多功能性、灵活性以及在某种程度上模拟人类推理的能力,越来越多地被集成到软件系统中用于各种目的。然而,源代码中LLM推理的糟糕集成可能会损害软件系统的质量。因此,必须记录不充分的LLM集成编码实践,以帮助开发者缓解此类问题。基于我们先前关于LLM代码异味的工作,本文通过呈现一个自包含的分类体系和包含九种LLM代码异味的目录,巩固并完善了这一概念。我们还创建了SpecDetect4LLM,一个用于检测这些异味的静态源代码分析工具,并对其检测效果(精确率和召回率)以及LLM代码异味在692个开源软件项目(171,194个源文件)中的普遍性进行了广泛的实证评估。结果表明,LLM代码异味影响了73.5%的被分析系统,检测精确率为91.3%,召回率为71.8%。

英文摘要:

Large Language Models (LLMs) are increasingly integrated into software systems for diverse purposes, due to their versatility, flexibility, and ability to simulate human reasoning to some extent. However, poor integration of LLM inference in source code can undermine software system quality. Therefore, inadequate LLM integration coding practices must be documented to help developers mitigate such issues. Following our earlier work on LLM code smells, this paper consolidates and refines the concept by presenting a self-contained taxonomy and a catalog of nine LLM code smells. We also create SpecDetect4LLM, a static source code analysis tool for their detection, and conduct extensive empirical evaluations of its detection effectiveness (precision and recall) as well as the prevalence of LLM code smells across 692 open-source software projects (171,194 source files). Our results show that LLM code smells affect 73.5% of the analyzed systems, with a detection precision of 91.3% and a recall of 71.8%.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑