On Developers’ Self-Declaration of AI-Generated Code: An Analysis of Practices
Syed Mohammad Kashif, Peng Liang, Amjed Tahir · 2025
Read On Developers’ Self-Declaration of AI-Generated Code: An Analysis of Practices by Syed Mohammad Kashif, Peng Liang, Amjed Tahir (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-16485.txt.
Introduction
When a developer lets an AI write code, should the commit say so? Syed Mohammad Kashif, Peng Liang, and Amjed Tahir studied that question in this 2025 paper. They mined GitHub for 613 snippets that developers had marked as AI-generated, then surveyed 111 practitioners about why they mark, or never mark, such code.
About three quarters said they always or sometimes declare AI help. Trackability for later review and debugging, plus ethics, drove the declarers. Those who never declare often had heavily rewritten the code, or saw the label as pointless. The authors close with guidelines meant to balance honesty about authorship with code quality.
Catalog record
| CREATOR | Syed Mohammad Kashif, Peng Liang, Amjed Tahir |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 115 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2504-16485
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
On Developers’ Self-Declaration of AI-Generated Code: An Analysis of Practices Syed Mohammad Kashif, Peng Liang, Amjed Tahir Abstract . 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. Journal: TOSEM Volume: 1 1 1 1 DOI: 10.1145/3771937 CCS: Software and its engineering Software development techniques 1. Introduction Artificial Intelligence (AI) techniques, especially those employing Machine Learning (ML) models and Large Language Models (LLMs), are revolutionizing software engineering practices. There has been increased adoption of these models to develop more accurate, faster, and scalable tools that assist software engineers in their development tasks ( Yellin, 2023 ; Hou et al., 2024 ) (e.g., AI-assisted coding ( Liang et al., 2024 ) ). One area that has been largely transformed with the advancement in LLMs is automatic code generation ( Chen et al., 2021 ; Hou et al., 2024 ) . Developers increasingly rely on AI code generation tools in their written code ( AIt, 2024 ; AIR, 2023 ) . The most recent Stack Overflow Developer Survey (2024) shows that there has been a significant adoption of code generation tools in practice ( SO-, 2024 ; SO-, 2025 ) . This is partially due to the widely available coding-specific tools (e.g., GitHub Copilot ( Cop, 2024 ) and CodeWhisperer ( Cod, 2024 ) ) and general-purpose LLMs (e.g., ChatGPT ( Cha, 2024 ) and Gemini ( Gem, 2024 ) ) that can generate a large amount of code with little human intervention, faster with high efficiency ( Dakhel et al., 2023 ; Tian et al., 2023 ) . Despite their usefulness and high potential ( Wang et al., 2024 ; Liang et al., 2024 ) , previous studies have shown that there are many quality ( Yetiştiren et al., 2023 ; Liu et al., 2024b ) , correctness ( Tambon et al., 2025 ; Vatai et al., 2024 ; Liu et al., 2024c ) , security ( Pearce et al., 2022 ; Majdinasab et al., 2024 ; Fu et al., 2025 ) and ethical ( Stalnaker et al., 2024 ) challenges associated with AI-generated code (i.e., code that is primarily generated with AI coding assistance tools). These challenges stress the need to distinguish AI-generated code from other human-written code ( Xu et al., 2025 ; Idialu et al., 2024 ) for code review and quality assurance purposes ( Xu et al., 2025 ) . To this end, we seek to study whether developers self-declare AI-generated code, explore the characteristics of self-declaration comments, and explore how and why developers self-declare (or not) AI-generated code. We derive our definition of self-declared AI-generated code from the well-established definition of self-admitted technical debt ( Potdar and Shihab, 2014 ) : a self-declared AI-generated code is code that has been explicitly acknowledged in the code comments by the developer as automatically generated by AI tools. A motivating example: We observed in many GitHub repositories that developers often include code comments indicating that certain lines of code or specific files were auto-generated using AI code generation tools. The study of Fu et al. collected a dataset of such code comments to investigate security weaknesses in AI-generated code ( Fu et al., 2025 ) . Other studies have also used a similar approach of collecting AI-generated code from GitHub repositories ( Yu et al., 2024 ; Tambon et al., 2025 ) . The authors used code comments from the GitHub repositories to identify AI-generated code. We refer to such comments as self-declaration comments. A sample self-declaration comment from an AI-generated code snippet is illustrated in Figure 1 . In this example, a developer acknowledges that the code file was written with the help of GitHub Copilot, an AI code generation tool. This observation motivated us to design a study to explore the practices of self-declaring AI-generated code among developers. Figure 1. An example of self-declaration comments of AI-generated code ( urban-fingerprinting ) This study aims to empirically investigate the practices of self-declaring AI-generated code. Specifically, we explore the ways developers self-declare AI-generated code and the reasons behind self-declaring (or not) the use of AI-generated code. We address the following Research Questions (RQs): • RQ1 : How do developers self-declare AI-generated code in their projects? • RQ2 : Do developers self-declare AI-generated code in practice? Why or why not? To address our RQs, we utilized a mixed-methods approach combining a repository mining study and a follow-up survey with developers. In the first phase of our study, we identified AI-generated code snippets from open-source projects hosted on GitHub. We collected 613 code files with self-declared AI-generated code snippets from 586 GitHub repositories. We then analyzed and classified those code snippets. Based on the results of the mining study, we conducted a follow-up survey with practitioners to explore the ways developers self-declare AI-generated code and understand the reasons behind their choice to self-declare (or not) their AI-generated code. The survey questionnaire consists of 12 questions, including demographic questions and questions related to self-declaration practices of AI-generated code. Through the survey, we collected valid responses from 111 developers with reasonable diversity (based on location, education, experience, application domains, professional roles, and AI tool preference). Our findings show that: (1) most developers sometimes self-declare AI-generated code, depending on the proportion of AI-generated code integrated into the project. (2) Developers use various ways to self-declare AI-generated code, ranging from simple self-declaration comments to detailed comments that include the prompt used to generate the code, an explanation of the functionality of the code, and other code quality indications. (3) Developers tend to self-declare their code if the AI-generated code was not substantially modified by humans. When they just use AI-generated code as a guide and then modify the code extensively, they may optionally self-declare AI-generated code. (4) As their reasons for self-declaring AI-generated code, developers reported the need for tracking and monitoring the code for future review and debugging, and also ethical considerations of using AI code generation