arXiv:2605.02741cs.SEcs.AI2026-05被引 1

AI生成代码虽能正确运行,但越来越臃肿难维护。

AI-Generated Smells: An Analysis of Code and Architecture in LLM and Agent-Driven Development

论文配图:AI-Generated Smells: An Analysis of Code and Architecture in LLM and Agent-Driven Development
图 1 · 摘自论文原文
  • 发现大模型生成代码存在结构性缺陷,随能力提升愈发复杂
  • 代码量越大,架构质量越差,呈显著负相关关系
  • 功能正确无法避免代码臃肿,需引入架构预判机制

大型语言模型在自动化软件工程中的潜力常以功能正确性衡量,却忽视了长期可维护性问题。本文对AI生成软件中的技术债进行了系统性审计,发现AI并未消除缺陷,而是引入了独特的机器缺陷特征。从单文件算法任务到复杂代理生成系统,多尺度分析揭示了一个根本性的推理-复杂度权衡:模型能力越强,生成的代码越臃肿且耦合度越高。这种架构退化极为明显,我们建立了体积-质量逆定律,即代码体积几乎完美预测结构劣化。关键的是,功能正确性和详细提示均无法缓解此退化。研究挑战了当前以提示驱动生成的范式,将人工智能软件工程的核心问题从代码生成重新定义为架构复杂性管理。结论指出,未来进展依赖于赋予代理显式的架构前瞻能力,确保其构建的软件不仅功能正确,更具备可维护性。

原文摘要 · Abstract (English)

The promise of Large Language Models in automated software engineering is often measured by functional correctness, overlooking the critical issue of long term maintainability. This paper presents a systematic audit of technical debt in AI-generated software, revealing that AI does not eliminate flaws but rather introduces a distinct machine signature of defects. Our multi-scale analysis, spanning single-file algorithmic tasks and complex, agent generated systems, identifies a fundamental Reasoning-Complexity Trade-off: as models become more capable, they generate increasingly bloated and coupled code. This architectural decay is so pronounced that we establish a Volume-Quality Inverse Law, where code volume is a near perfect predictor of structural degradation. Crucially, we demonstrate that neither functional correctness nor detailed prompting mitigates this decay. These findings challenge the current paradigm of prompt-driven generation, reframing the central problem of AI-based software engineering from one of code generation to one of architectural complexity management. We conclude that future progress depends on equipping agents with explicit architectural foresight to ensure the software they build is not just functional, but also maintainable.

代码生成技术债架构设计LLM

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。