识别并检测代码中低质量的LLM集成问题,提升AI代码可靠性
LLM Code Smells: A Taxonomy and Detection Approach
- 构建九类LLM代码异味的分类体系
- 在692个开源项目中发现73.5%存在此类问题,检测准确率达91.3%
- 提出SpecDetect4LLM工具,适合关注AI集成质量的开发者
大型语言模型(LLMs)因其多功能性和类人推理能力,正被广泛集成到软件系统中。然而,源码中不当的LLM推理集成会损害系统质量。为此,本文基于前期工作,系统化构建了自包含的代码异味分类体系,并提出九类LLM代码异味。同时开发了SpecDetect4LLM静态分析工具用于检测,对692个开源项目(共171,194个源文件)进行了大规模实证评估。结果表明,73.5%的系统存在此类问题,工具检测精度达91.3%,召回率为71.8%。
原文摘要 · Abstract (English)
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%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。