arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.27130cs.SE
收藏

对现实仓库中AI生成代码的大型实证研究

A Large-Scale Comprehensive Measurement of AI-Generated Code in Real-World Repositories

Luddy School of Informatics, Computing, and Engineering, Indiana University Bloomington(印第安纳大学布卢明顿分校卢迪信息学、计算与工程学院);College of Computing and Data Science, Nanyang Technological University(南洋理工大学计算机与数据科学学院)

Tianhao Mao, Dongfang Zhao, Haixu Tang, Xiaofeng Wang, Hang Zhang

AI总结:

本文通过大规模实证研究分析现实仓库中AI生成代码的特性,探讨AI辅助开发与传统人类开发的差异,为理解AI在软件开发中的实际影响提供依据。

摘要:

大型语言模型(LLMs)在软件开发中被越来越多地使用,生成从短片段到重要项目组件的代码。随着AI生成的代码在现实仓库中变得更加普遍,了解其与人类编写代码的不同以及AI辅助如何影响开发实践变得至关重要。然而,现有研究大多依赖于小规模或受控环境,对野外AI生成代码的理解有限。本文提出了一项对现实仓库中AI生成代码进行大规模实证研究,分析代码层面的特性,包括复杂性、结构特征和缺陷相关指标,以及提交层面的特性,如提交大小、活动模式和提交后演变。为支持本研究,我们开发了一个结合启发式过滤与LLM基于分类的检测管道,以识别AI生成代码并构建大规模数据集进行分析。本研究提供了对实际中AI生成代码特性的全面视图,并突显了AI辅助开发与传统人类驱动开发的差异。这些发现有助于更好地理解AI辅助编程在现实中的影响,并为未来关于AI生成软件的研究提供实证基础。

英文摘要:

Large language models (LLMs) are rapidly transforming software engineering by enabling developers to generate code ranging from small snippets to entire projects. As AI-assisted code becomes increasingly integrated into real-world systems, understanding its characteristics and impact is critical. Existing study on AI-generated code is usually limited in the lab setting with synthetic benchmarks and small-scale coding tasks and covers limited metrics. AI-assisted code's manifestation in real-world codebases and its differences between human-written one remain unclear. To close this gap, we perform a first large-scale measurement study of AI-assisted code, in comparison with the human-written, in real-world repositories. We study a comprehensive set of metrics including both code-level aspects (e.g., structural and graph-level complexity, coding style, security quality, etc.) and commit-level characteristics (e.g., commit size, frequency, post-commit stability, etc.). Our results provide new findings and insights: some contrast previous observations in the lab setting (e.g., we conclude that real-world AI-Human differences on code-level metrics are rather small instead of more pronounced), some extend prior results with finer-grained observations (e.g., the variance of security quality across different programming languages), yet more are presented for the first time on aspects not covered before (e.g., code duplication rate, commit size and stability, etc.). Based on these comprehensive real-world results, we also discuss the practical implications of AI-assisted programming.

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

↑