arXiv:2607.01867cs.SEcs.AI2026-07中稿 · The Journal of Sys…被引 2

分析大模型生成代码与注释的特征及真实缺陷关联性。

An Exploratory Study on LLM-Generated Code and Comments in Code Repositories

论文配图:An Exploratory Study on LLM-Generated Code and Comments in Code Repositories
图 1 · 摘自论文原文
  • 基于检测器分析2021-2025年开源与企业仓库中生成代码与注释
  • 生成代码随时间减少,多出现在测试用例中;注释语法正确率低
  • 企业仓库生成内容比例更高,但与真实缺陷关联度极低

大模型在软件开发中的应用日益广泛,涵盖代码生成与摘要等任务。大型科技公司报告称其代码中有约20%至30%由大模型生成。然而,人们对生成代码与注释的实际可用性仍存疑虑,例如调试耗时更长、注释不自然等问题。本文研究了被识别为可能由大模型生成的代码与注释的特征,对比了企业维护与社区维护仓库的差异,并探究了生成代码与缺陷之间的关联性。通过2021至2025年间活跃的企业及社区仓库,使用多种检测工具与技术进行广泛实验。基于检测器的代理分析结果显示,被识别为大模型生成的代码随时间呈下降趋势,且多出现于测试用例中;而注释的生成状态相对稳定。进一步发现,生成代码存在显著的同质代码片段(intra-repository code clones),而生成注释中语法正确的句子比例较低。此外,企业维护仓库中生成内容占比更高,但仅有极小比例的人工标注缺陷被判定与大模型生成代码相关。

原文摘要 · Abstract (English)

The use of LLMs in software development has become increasingly widespread on tasks such as code generation and summarization. Reports from large technology companies showed that around 20% to 30% of their code are generated by LLMs. However, there remains skepticism about the practical usage of LLM-generated code and comments, such as concerns on more time for debugging the generated code and the unnaturalness of the generated comments. In this paper, we study the code and comments detected as likely to be generated by LLMs and their characteristics, the differences between company- and community-maintained repositories, and how likely bugs are associated with LLM-generated code. We conduct extensive experiments on active company- and community-maintained repositories from 2021 to 2025 using various tools and techniques that detect code and comments generated by LLMs. Based on our detector-based proxy analysis, the results suggest that code detected as likely to be generated by LLMs decreased over time and appeared frequently in test cases, while that of comments remains relatively stable. Proxy results further suggest that code detected as likely to be generated by LLMs shows substantial intra-repository code clones, whereas comments exhibit a relatively low proportion of grammatically correct sentences. In addition, the company-maintained repositories show a higher percentage of code and comments detected as likely to be generated by LLMs, and only a small percentage of the human-labelled bugs are detected as being likely associated with LLM-generated code.

大模型代码代码生成缺陷分析

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