生产环境中AI生成C++代码的质量概况表征
Characterizing the Quality Profile of AI-Generated C++ in Production
August 6, 2026
作者: Michael Tran, Fred Lewis, Kun Yang, Saksham Thakur, Aditya Kini, Aditya Patil, Milad Hashemi, Parthasarathy Ranganathan
cs.AI
摘要
AI编程助手的广泛集成无疑提升了工程开发速度。然而,近期研究指出了日益显著的权衡问题,揭示了代码质量和可维护性方面持续存在的挑战。包括前沿AI实验室在内的行业领导者也表达了类似担忧。随着大语言模型越来越多地被用于编写生产代码,理解其对交付软件质量的影响已成为关键优先事项。然而,由于可观测性障碍,在工业工作流程中评估这些影响仍然困难。我们在一家运营全球产品、每天服务数十亿用户的大型企业中,研究了AI生成代码对生产质量的影响。出于这种规模和用户信任,该组织高度重视代码质量,并为部署到生产环境的每一行代码建立了全面的可观测性,从而使我们能够克服测量障碍来评估这些影响。
本研究对2025年4月至2026年4月期间的AI生成C++代码进行了大规模实证分析,跟踪了该企业既有代码库中的352万次代码变更。核心目的是在大规模生产环境中,理解AI生成代码与人类编写代码相比在质量、性能和维护方面的特征。我们发现,AI生成的C++代码具有鲜明的质量特征,表现为接口与耦合负担、拷贝与分配开销的发生率更高,并且更倾向于使用显式循环而非经过优化的标准API。这些问题会转化为切实可见的下游成本,包括评审工作量增加以及计算资源消耗上升5%至8%。然而,我们证明,向模型提供有针对性的、基于分类体系的反馈可以缓解这些影响,使目标静态分析警告减少11.1%,并提升计算效率。
English
The widespread integration of AI coding assistants offers undeniable boosts to engineering velocity. Yet, recent studies point to a growing trade-off, revealing persistent challenges with code quality and maintainability. Industry leaders, including frontier AI labs, echo these concerns. As large language models are increasingly relied upon to author production code, understanding their impact on shipped software quality has become a critical priority. However, assessing these effects in industrial workflows remains difficult due to observability barriers. We study the impact of AI-generated code on production quality within a large enterprise operating global products relied upon by billions of users daily. Driven by this scale and user trust, the organization values code quality and has built thorough observability for every line of code deployed into production, enabling us to overcome measurement barriers to assess these effects.
This study presents a large-scale empirical analysis of AI-generated C++ code from April 2025 to April 2026, tracking 3.52 million code changes across this enterprise's brownfield codebase. The core purpose is to understand the quality, performance, and maintenance characteristics of AI-generated code compared to human-written code in a production environment at scale. We find that AI-generated C++ code has a distinct quality profile, showing higher rates of interface and coupling burdens, copy and allocation overheads, and a reliance on explicit loops over optimized standard APIs. These issues translate into tangible downstream costs, including increased review effort and a 5-8% increase in compute resource consumption. However, we demonstrate that providing models with targeted, taxonomy-informed feedback can mitigate these effects, leading to an 11.1% reduction in targeted static analysis warnings and improved computational efficiency.