SmellBench: Evaluating LLM Agents on Architectural Code Smell Repair
作者: Ion George Dinu, Marian Cristian Mihăescu, Traian Rebedea
分类: cs.SE, cs.CL
发布日期: 2026-05-07
备注: Preprint. 11 pages, 3 figures. Submitted to the 41st IEEE/ACM International Conference on Automated Software Engineering (ASE 2026)
💡 一句话要点
提出SmellBench评估框架,量化评估大模型智能体在架构级代码异味修复中的能力
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大模型智能体 软件重构 架构代码异味 自动化软件工程 代码质量评估 提示词工程
📋 核心要点
- 架构级代码异味涉及跨模块设计意图,现有大模型智能体在处理此类全局性重构任务时缺乏有效的评估基准与推理能力。
- 论文构建了SmellBench框架,通过特定异味优化提示词与迭代式多步执行机制,实现对架构异味修复过程的自动化管理与评估。
- 实验表明,当前模型在修复架构异味时存在“修复激进性”与“代码质量”的权衡冲突,最佳修复率仅为47.7%,且易引入新的异味。
📝 摘要(中文)
架构级代码异味(Architectural Code Smells)严重影响软件可维护性,且因涉及跨模块设计意图推理,修复难度远超局部代码缺陷。尽管大模型智能体在代码修复方面表现出色,但其在架构级重构中的能力尚属空白。本文提出了首个针对该问题的实证评估框架SmellBench,包含针对特定异味类型的优化提示词、迭代式多步执行机制,以及涵盖修复有效性、误报识别和代码库影响的综合评分体系。研究评估了来自GPT、Claude、Gemini和Mistral四个系列的11种智能体配置,针对scikit-learn项目中65个高严重性架构异味进行了测试。结果显示,专家验证发现63.1%的检测结果为误报,表现最好的智能体修复率仅为47.7%。研究揭示了当前模型在跨模块架构理解与局部代码转换能力之间的显著差距,为自动化软件工程领域提供了重要的基准测试工具。
🔬 方法详解
问题定义:论文旨在解决架构级代码异味修复问题。与局部Bug不同,架构异味(如循环依赖、上帝类等)需要跨模块的全局设计理解,现有工具难以有效识别并修复,且缺乏针对大模型智能体在该领域表现的量化评估标准。
核心思路:引入SmellBench框架,将修复过程建模为任务编排问题。通过针对特定异味类型的提示词工程引导模型进行多步推理,并建立多维度的评分指标,以平衡修复有效性与代码库的整体健康度。
技术框架:框架包含三个核心模块:一是任务编排引擎,支持迭代式多步执行;二是针对特定异味类型的优化Prompt库;三是综合评估系统,分别计算修复成功率、误报识别准确度以及对代码库产生的副作用(如引入新异味)。
关键创新:首次将架构级代码异味修复作为大模型智能体的基准测试任务;提出了包含误报识别与副作用评估的综合评价体系,揭示了模型在修复过程中可能导致代码质量下降的“激进性”问题。
关键设计:利用PyExamine进行异味检测,并结合专家验证作为Ground Truth。在评估指标上,引入了Cohen's κ系数衡量模型与专家在误报识别上的一致性,并量化了修复操作对代码库产生的负面影响(即引入新异味的数量)。
🖼️ 关键图片
📊 实验亮点
实验覆盖了4个模型家族的11种配置,针对scikit-learn的65个高严重性异味进行测试。结果显示,模型在误报识别上表现良好(专家一致性κ高达0.94),但在修复阶段表现受限,最高修复率为47.7%。此外,研究发现修复行为越激进,引入新异味的风险越高(最高达140个),揭示了模型在架构重构中的局限性。
🎯 应用场景
该研究可应用于自动化软件重构工具的开发,辅助开发者识别并修复复杂的架构缺陷。其评估框架为软件工程领域提供了基准,有助于评估大模型在复杂系统设计与维护中的实际效能,推动AI辅助软件工程(AI4SE)向更高层次的架构治理演进。
📄 摘要(原文)
Architectural code smells erode software maintainability and are costly to repair manually, yet unlike localized bugs, they require cross-module reasoning about design intent that challenges both developers and automated tools. While large language model agents excel at bug fixing and code-level refactoring, their ability to repair architectural code smells remains unexplored. We present the first empirical evaluation of LLM agents on architectural code smell repair. We contribute SmellBench, a task orchestration framework that incorporates smell-type-specific optimized prompts and supports iterative multi-step execution, together with a scoring methodology that separately evaluates repair effectiveness, false positive identification, and net codebase impact. We evaluate 11 agent configurations from four model families (GPT, Claude, Gemini, Mistral) on 65 hard-severity architectural smells detected by PyExamine in the Python project scikit-learn, validated against expert judgments. Expert validation reveals that 63.1% of detected smells are false positives, while the best agent achieves a 47.7% resolution rate. Agents identify false positives with up to $κ= 0.94$ expert agreement, but repair aggressiveness and net codebase quality are inversely related: the most aggressive agent introduces 140 new smells. These findings expose a gap between current LLM capabilities in localized code transformations and the architectural understanding needed for cross-module refactoring. SmellBench provides reusable infrastructure for tracking progress on this underexplored dimension of automated software engineering. We release our code and data at https://doi.org/10.5281/zenodo.19247588.