arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2406.19544cs.SE
收藏

大型语言模型在 GitHub 上生成的自认代码在哪里?

Where Is Self-admitted Code Generated by Large Language Models on GitHub?

Zhejiang University(浙江大学);Xi’an Jiaotong University(西安交通大学);Wuhan University(武汉大学)

Xiao Yu, Lei Liu, Xing Hu, Jin Liu, Xin Xia

AI总结:

本研究通过分析 GitHub 上开发者自认使用 LLM 生成代码的注释,揭示了 ChatGPT 和 Copilot 在真实项目中的使用特征、代码规模与修改情况,为研究者和从业者提供了实证依据。

摘要:

大型语言模型(LLMs)在软件开发中的日益广泛应用引起了研究者对其代码生成能力和局限性的广泛关注。然而,现有研究大多集中于 HumanEval 等受控数据集,这些数据集无法充分反映 LLM 生成代码在真实开发场景中的特征。为弥补这一不足,本研究调查了 GitHub 上由 LLM 生成的自认代码,特别关注星级超过五颗的项目中开发者通过代码注释承认使用 LLM 生成代码的实例。研究发现揭示了几个关键见解:(1)ChatGPT 和 Copilot 在代码生成中占据主导地位,其他 LLM 的贡献极少。(2)包含 ChatGPT/Copilot 生成代码的项目主要出现在由小型团队主导、持续演进的中小型项目中。(3)ChatGPT/Copilot 生成的代码通常只占项目的一小部分,主要生成短到中等长度、低复杂度的代码片段(如算法与数据结构代码、文本处理代码)。(4)ChatGPT/Copilot 生成的代码通常只经历少量修改,与缺陷相关的改动比例在 4% 到 12% 之间。(5)大多数代码注释仅说明使用了 LLM,只有少数包含提示词、人工编辑或代码测试状态等细节。基于这些发现,我们讨论了其对研究者和从业者的启示。

英文摘要:

The increasing use of Large Language Models (LLMs) in software development has garnered significant attention from researchers evaluating the capabilities and limitations of LLMs for code generation. However, much of the research focuses on controlled datasets such as HumanEval, which do not adequately capture the characteristics of LLM-generated code in real-world development scenarios. To address this gap, our study investigates self-admitted code generated by LLMs on GitHub, specifically focusing on instances where developers in projects with over five stars acknowledge the use of LLMs to generate code through code comments. Our findings reveal several key insights: (1) ChatGPT and Copilot dominate code generation, with minimal contributions from other LLMs. (2) Projects containing ChatGPT/Copilot-generated code appears in small/medium-sized projects led by small teams, which are continuously evolving. (3) ChatGPT/Copilot-generated code generally is a minor project portion, primarily generating short/moderate-length, low-complexity snippets (e.g., algorithms and data structures code; text processing code). (4) ChatGPT/Copilot-generated code generally undergoes minimal modifications, with bug-related changes ranging from 4% to 12%. (5) Most code comments only state LLM use, while few include details like prompts, human edits, or code testing status. Based on these findings, we discuss the implications for researchers and practitioners.

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

↑