分析开发者如何声明自动生成代码,揭示实际做法与原因。
On Developers' Self-Declaration of AI-Generated Code: An Analysis of Practices
- 通过挖掘GitHub代码片段与问卷调研,发现76.6%开发者会自我声明。
- 未声明主要因代码修改多、认为声明无意义,声明则出于追踪与伦理考量。
- 提出实用指南,帮助团队应对生成代码的可追溯性与责任问题。
AI代码生成工具在开发者中广受欢迎,但实际开发中区分生成代码与人工代码至关重要,需明确声明。本研究通过两阶段混合方法:首先从GitHub提取613个代码片段,其次开展面向开发者的问卷调查,获得111份有效回复。结果显示,76.6%的开发者会时常或始终自我声明生成代码;23.4%表示从不声明。前者多出于代码追踪、调试与伦理需求;后者则因代码被大量修改,或认为声明无必要。研究最终提出开发者自我声明的实践指南,兼顾代码质量与责任伦理。
原文摘要 · Abstract (English)
AI code generation tools have gained significant popularity among developers, who use them to assist in software development due to their capability to generate code. Existing studies mainly explored the quality, e.g., correctness and security, of AI-generated code, while in real-world software development, the prerequisite is to distinguish AI-generated code from human-written code, which emphasizes the need to explicitly declare AI-generated code by developers. To this end, this study intends to understand the ways developers use to self-declare AI-generated code and explore the reasons why developers choose to self-declare or not. We conducted a mixed-methods study consisting of two phases. In the first phase, we mined GitHub repositories and collected 613 instances of AI-generated code snippets. In the second phase, we conducted a follow-up practitioners' survey, which received 111 valid responses. Our research revealed the practices followed by developers to self-declare AI-generated code. Most practitioners (76.6%) always or sometimes self-declare AI-generated code. In contrast, other practitioners (23.4%) noted that they never self-declare AI-generated code. The reasons for self-declaring AI-generated code include the need to track and monitor the code for future review and debugging, and ethical considerations. The reasons for not self-declaring AI-generated code include extensive modifications to AI-generated code and the developers' perception that self-declaration is an unnecessary activity. We finally provided guidelines for practitioners to self-declare AI-generated code, addressing ethical and code quality concerns.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。