Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

Does AI-Generated Research Code Need to Be Disclosed?

AI-generated research code may require disclosure when it materially contributes to data processing, analysis, simulation, or published findings. Learn how to distinguish routine programming assistance from consequential AI-generated code, verify its correctness, and document its role in reproducible research.

581
Disclosing AI-Generated Research Code Guide 581 of 1196
01 · The Question

If AI Writes the Code but You Run the Analysis, Must You Disclose It?

A researcher uses ChatGPT to generate Python code for cleaning survey data, calculating descriptive statistics, and fitting regression models. The researcher reviews the script, corrects several errors, and executes it to produce the results reported in a manuscript.

Another researcher uses GitHub Copilot to complete routine programming statements while developing a simulation. A third asks an AI system to generate an entire algorithm used to classify research observations.

All three researchers have used AI to produce code, but the assistance differs considerably in its scope and potential consequences.

Should every AI-generated line be disclosed? Does the requirement change when the researcher substantially revises the code? What if the generated program works correctly but the researcher cannot explain how it produces the results?

These questions require distinguishing the origin of research software from the methodological decisions and computational procedures that the software implements.

02 · The Short Answer

Consequential AI-Generated Research Code May Require Disclosure

In Brief

AI-generated research code should be disclosed when required by the applicable journal, institution, or research agreement, particularly when it materially contributes to data processing, statistical analysis, simulations, computational models, or other procedures underlying published findings. Routine programming assistance may receive different treatment depending on the policy.

Researchers should accurately report the computational methods used, verify that generated code performs its intended function, and preserve sufficient information to support reproducibility. Human authors remain responsible for the validity of the research even when AI generated substantial portions of the software.

The relevant distinction is not simply whether AI produced code. It is whether that code contributed to the research process, how consequential its function was, and what the governing policy requires researchers to disclose.

03 · What You Need to Know

When AI-Generated Code Becomes a Reportable Research Contribution

What Counts as AI-Generated Research Code?

AI-generated research code includes software instructions produced or substantially modified through an artificial intelligence system and subsequently used in research activities.

Such code may be written in Python, R, MATLAB, JavaScript, SQL, or another programming language.

Researchers may use generative AI to create data-cleaning scripts, implement statistical procedures, automate document processing, develop simulations, or construct research applications.

The extent of assistance varies. An AI coding assistant might complete a short function, while a language model might generate an entire analytical pipeline from a natural-language description.

These activities should not automatically be treated as equivalent for disclosure purposes.

The appropriate assessment concerns what the code does, how it contributes to the research, and whether its generation falls within the applicable policy.

Is AI-Generated Code Different From Conventional Research Software?

Yes, although both may be used within the same computational workflow.

Conventional research software executes procedures implemented in its code. Generative AI coding assistants help researchers produce or modify the instructions that software subsequently executes.

For example, using an established R package to fit a regression model is different from asking ChatGPT to write an R script that specifies the model, prepares the variables, and generates the results.

In the second case, the AI system may influence how the procedure is implemented.

Research software use Using a software application, library, or computational environment to perform documented research procedures.
AI-assisted code generation Using an AI system to create, complete, debug, or modify the instructions that implement research procedures.

Both activities require appropriate methodological reporting. However, they may be subject to different AI-disclosure requirements.

What Do ICMJE and COPE Say About AI-Generated Research Code?

The International Committee of Medical Journal Editors (ICMJE) recommends disclosure of AI-assisted technologies used in producing submitted research and identifies AI use in data analysis as an activity to be described in the methods section.

The Committee on Publication Ethics (COPE) similarly emphasizes transparency about AI tools used in research activities and maintains that human authors remain responsible for submitted work.

Neither position should be interpreted as establishing a universal requirement to declare every individual line of code suggested by an AI assistant.

However, when generated code materially affects research analysis or findings, these policies provide a basis for reporting the assistance accurately.

Researchers should also examine journal-specific software availability, reproducibility, and computational reporting requirements.

Does Every Use of GitHub Copilot or ChatGPT for Coding Require Disclosure?

Not necessarily under every journal policy.

AI coding assistants can perform tasks ranging from completing a routine programming statement to generating substantial analytical procedures.

For example, accepting a suggestion that completes a familiar loop may have different methodological significance from accepting an AI-generated algorithm that determines the study's primary outcome.

Nevertheless, a journal may impose broader disclosure requirements that cover both activities.

Researchers should identify the functionality used and consult the relevant policy rather than assume that all coding assistance is exempt or reportable.

The name of the application alone does not determine the appropriate treatment.

Which Types of AI-Generated Code Are Most Consequential?

The significance of generated code depends on its role in producing, processing, or interpreting research evidence.

AI-Generated Code Potential Research Consequence Reporting Consideration
Routine formatting scripts Changes presentation without necessarily affecting findings. Policy-dependent; often lower methodological significance.
Data-cleaning scripts May remove, recode, or transform observations. Document consequential transformations and AI assistance.
Statistical analysis scripts Determine calculations, estimates, and reported results. Generally warrant methodological transparency.
Simulation code May determine model behavior and simulated outcomes. Report implementation, assumptions, and verification.
Machine-learning pipelines May influence training, validation, predictions, and evaluation. Provide sufficient methodological and computational detail.
Visualization scripts May change how results are represented. Verify data mappings, transformations, and relevant AI involvement.
Research data extraction scripts May determine which information enters the dataset. Document extraction logic, errors, and validation.

These distinctions are analytical considerations, not universal publisher classifications. The applicable reporting rules remain decisive.

Does AI-Generated Statistical Code Require Disclosure?

When generated code materially contributes to statistical analysis, disclosure may be required and methodological reporting is particularly important.

For example, a researcher may ask AI to generate Python code for logistic regression, repeated-measures analysis, or structural equation modeling.

The resulting script may execute successfully while implementing an unsuitable statistical procedure.

It may also mishandle missing values, specify incorrect variables, or report statistics inappropriately.

Researchers should verify both the implementation and the methodological justification.

The relationship between AI-assisted statistical analysis and disclosure is therefore broader than simply acknowledging that a coding assistant was used.

Does AI-Generated Data-Cleaning Code Need to Be Reported?

Data-cleaning code may materially influence the dataset and subsequent results.

For example, a generated script might remove duplicate records, convert missing values, exclude observations, or recode variables.

These operations can affect sample sizes, distributions, and estimated relationships.

Researchers should document consequential transformations and verify that the code implements the intended rules.

Where AI materially contributed to those procedures, its role may require disclosure under the applicable policy.

A script should not be considered methodologically harmless merely because its purpose was described as cleaning data.

Can AI-Generated Code Produce Correct-Looking but Invalid Results?

Yes. Computational output can appear plausible even when the underlying implementation is incorrect.

For example, a generated script might accidentally merge datasets using a nonunique identifier, creating duplicated observations without producing an obvious error message.

The resulting tables and statistical models could appear reasonable while being based on an incorrectly constructed dataset.

Similarly, a simulation might use an incorrect probability distribution while generating smooth and convincing plots.

Researchers should therefore distinguish successful execution from correct implementation and methodological validity.

The absence of programming errors does not establish that the research procedure was performed correctly.

What Does Verification of AI-Generated Code Require?

Verification should be proportionate to the function of the code and the consequences of errors.

For consequential research software, useful practices may include reviewing the code's logic, testing functions against known cases, checking input and output structures, and comparing results with independently established expectations.

Researchers may also use unit tests, integration tests, numerical checks, and reproducibility tests where appropriate.

However, passing tests does not automatically establish that the chosen analytical method is scientifically appropriate.

Verification must address both the implementation and the research assumptions underlying it.

For example, a correctly implemented statistical test can still be inappropriate for the data or study design.

Is Debugging AI-Generated Code Enough to Validate It?

No. Debugging typically addresses errors that prevent software from functioning as intended, but functioning software may still implement an incorrect research procedure.

A researcher may correct syntax errors in AI-generated code without examining whether the calculations are appropriate.

For example, a program may successfully calculate percentages using the wrong denominator.

The resulting values may look plausible and be reported without further scrutiny.

Researchers should therefore distinguish debugging from validation.

Debugging helps software execute. Validation concerns whether the implementation and its outputs are suitable for the intended research purpose.

Should Researchers Understand Every Line of AI-Generated Code?

Researchers should understand consequential code sufficiently to explain and defend the procedures it implements.

This does not necessarily require every author to possess identical programming expertise or independently examine every low-level software operation.

Collaborative research may involve qualified software developers, statisticians, and other specialists.

However, the research team should ensure that consequential computational procedures receive appropriate review.

Accepting an extensive AI-generated script without understanding its logic or obtaining qualified verification can undermine the defensibility of the findings.

Human accountability requires more than being able to execute a program and copy its outputs into a manuscript.

Can Researchers Claim the CRediT Software Role When AI Generated the Code?

Potentially, depending on their actual contributions and the journal's implementation of the Contributor Roles Taxonomy (CRediT).

The Software role concerns programming, software development, and related implementation activities.

A researcher who meaningfully designs, develops, adapts, tests, and maintains AI-assisted code may have made a substantive software contribution.

However, merely requesting code from an AI system does not automatically establish the same contribution.

CRediT describes research roles but does not independently determine authorship eligibility.

Researchers should report human contributions accurately and disclose AI assistance through the appropriate mechanism.

The distinction between AI assistance and author contribution statements is important when software development forms a substantial part of the research.

Does Human Modification Remove the Need to Disclose AI-Generated Code?

Not automatically.

A researcher may substantially revise generated code while retaining important elements of its original structure or analytical logic.

Whether disclosure remains required depends on the policy and the role of AI in the final implementation.

For example, a journal may require disclosure of generative AI assistance even when the output has been edited.

Researchers should not assume that modifying a certain percentage of code automatically eliminates reporting obligations.

There is no universal authorship or disclosure threshold based on the number of AI-generated lines retained.

What If AI-Generated Code Is Used Only for Preliminary Exploration?

Exploratory code that does not contribute to the final analysis may receive different treatment from code used to produce published findings.

For example, a researcher might ask AI to generate a preliminary visualization and later discard it.

Such an interaction may not require formal publication disclosure under a policy focused on consequential assistance.

However, a journal or institution may impose broader reporting requirements.

Researchers should also consider whether exploratory outputs influenced subsequent analytical decisions.

Code that was not retained may still have contributed to selecting a model, transforming variables, or developing the final research design.

Does AI-Generated Code Need to Be Shared With the Manuscript?

Code-sharing requirements are separate from AI-use disclosure, although both can support research transparency.

Some journals require authors to provide analytical code, software repositories, or sufficient computational details to reproduce the reported results.

Others encourage code availability subject to confidentiality, intellectual property, and institutional restrictions.

The fact that AI generated the code does not automatically determine whether it must be shared.

Researchers should follow the journal's code-availability requirements and verify that sharing is legally and ethically permissible.

Where code is made available, the released version should correspond to the procedures actually used to produce the reported findings.

What Is the Difference Between Reproducibility and AI Disclosure?

AI disclosure identifies the role of the AI system in developing or performing research activities.

Computational reproducibility concerns whether the reported results can be obtained from the documented data, code, environment, and procedures.

These requirements are related but distinct.

AI-use disclosure Explains which AI tools assisted with the code or research workflow and how their contributions were incorporated.
Computational reproducibility Provides sufficient information and materials, subject to applicable restrictions, to reproduce the reported computational results.

A manuscript can disclose AI coding assistance while providing insufficient information to reproduce the analysis.

Conversely, reproducible code may still require disclosure of AI assistance under the journal's policy.

Should Researchers Preserve AI Coding Prompts?

Prompts may be useful when they materially influenced the generation of research software.

For example, a prompt specifying a statistical model, data transformation, or simulation procedure may help explain how the code was developed.

However, reproducing an identical AI response from the same prompt may not be possible because models, settings, and service implementations can change.

The final tested code and its execution environment are therefore often more directly relevant to computational reproducibility than the prompt alone.

Researchers should preserve consequential prompts where appropriate while prioritizing records of the actual code used, validation performed, and analytical outputs produced.

Questions about preserving AI prompts should be considered alongside the broader research documentation requirements.

What Software Information Should Be Preserved?

For consequential computational research, useful records may include the final source code, software dependencies, package versions, configuration settings, random seeds, and execution instructions.

Where AI assistance is relevant, researchers may also record the tool or model used, the date of assistance, and the nature of generated contributions.

The appropriate information depends on the complexity of the research and the journal's requirements.

For example, a simulation using stochastic procedures may require documentation of random-number generation and computational settings.

A simple descriptive analysis may require less extensive infrastructure.

Researchers should avoid treating the AI model version as a substitute for documenting the software environment in which the final code was executed.

Can AI-Generated Code Introduce Security or Privacy Risks?

Yes. Generated code may contain insecure practices, inappropriate data handling, or dependencies that introduce vulnerabilities.

For example, a script might inadvertently write confidential participant information to an unprotected output file or transmit data to an external service.

Researchers should inspect code that processes restricted information and ensure that its execution complies with institutional and ethical requirements.

They should also review third-party dependencies and avoid executing unfamiliar code with unnecessary access to sensitive systems.

Disclosure in a manuscript does not retrospectively authorize insecure or prohibited data processing.

Code verification should therefore consider data protection and operational risks as well as computational correctness.

Can AI-Generated Code Raise Licensing or Intellectual Property Questions?

Potentially. Generated code may resemble existing implementations, incorporate suggested dependencies, or be used within projects governed by particular licensing arrangements.

The legal implications depend on the applicable jurisdiction, source material, software licenses, and terms of use.

Researchers should not assume that AI-generated code is automatically free of copyright or licensing considerations.

Where code is distributed publicly, appropriate review of dependencies and licensing obligations may be necessary.

These issues are separate from whether the AI assistance must be disclosed in the manuscript, although both may affect responsible research software management.

Where Should AI-Generated Research Code Be Disclosed?

When generated code materially contributes to research methods or results, the methods section or an equivalent computational methodology section is generally appropriate.

The manuscript may also include a software availability statement, code repository reference, or designated AI-use declaration.

The ICMJE's guidance concerning AI-assisted analysis supports methods reporting for consequential analytical assistance.

The appropriate location ultimately depends on the journal's instructions.

Researchers should avoid placing all AI coding assistance in acknowledgments when readers need methodological details to understand how the results were produced.

What Should an AI-Generated Research Code Disclosure Say?

A useful statement should identify the tool's role, the code's purpose, and the verification performed.

Illustrative Methods Disclosure

AI Assistance With Research Software Development

"ChatGPT (OpenAI) was used to assist with generating preliminary Python scripts for data cleaning and statistical analysis. The researchers reviewed and modified the generated code, tested its implementation against the intended analytical procedures, and verified the resulting outputs before incorporating them into the manuscript. Final analytical decisions remained with the research team."

This example should be used only if the described procedures actually occurred.

Researchers should provide relevant tool, software, version, and code-availability information where required.

A statement claiming comprehensive verification would be misleading if the researchers merely executed the code without examining its logic or results.

Does Disclosure Make AI-Generated Code Scientifically Valid?

No. Disclosure explains how AI contributed to the workflow but does not establish that the resulting software is correct or methodologically appropriate.

A researcher may fully disclose AI-generated code while using a flawed algorithm or inappropriate statistical procedure.

Likewise, a thoroughly tested implementation may still require AI disclosure under the journal's policy.

Researchers should therefore distinguish transparency, technical verification, methodological validity, and reproducibility.

Each addresses a different aspect of responsible computational research.

What If the Journal Has No Specific AI Coding Policy?

Researchers should examine the journal's broader AI-use instructions, methods reporting requirements, and software or code-availability policies.

Even without a dedicated AI coding rule, the manuscript must accurately describe the computational procedures used to produce its findings.

Where consequential AI assistance remains ambiguous under the policy, the editorial office may be consulted.

Researchers should explain the actual coding activity rather than asking only whether AI-generated code is permitted.

Policy silence does not eliminate the need to verify the code or provide sufficient methodological information.

04 · A Practical Example

When AI-Generated Code Produces an Incorrect Research Dataset

Hypothetical Example

An AI-Generated Data-Merging Script Duplicates Student Records

A researcher investigates the relationship between online learning engagement and academic performance.

The study uses two datasets: one containing student engagement scores and another containing academic performance records.

The researcher asks ChatGPT to generate Python code that merges the datasets using student identifiers.

The script executes without errors, but duplicate identifiers in one dataset cause some records to appear multiple times after merging.

The researcher initially proceeds with statistical analysis using the incorrectly merged dataset.

Inspect the merged dataset. The researcher discovers that the number of observations exceeds the expected number of students.
Identify the implementation problem. Duplicate identifiers and the selected merge operation are examined to determine why records were multiplied.
Correct the code. The merge procedure is revised to reflect the intended data relationships, with duplicate records investigated rather than automatically discarded.
Reproduce the analysis. The statistical procedures are rerun using the verified dataset, and the reported results are updated.
Document the workflow. The final code, verification procedures, and consequential AI assistance are recorded and disclosed as required.

The example illustrates why a script that runs successfully may still produce scientifically invalid results.

The problem originated in the computational implementation, but its consequences extended to the research dataset and statistical analysis.

The researcher remains responsible for verifying the data-processing procedure and ensuring that the final manuscript accurately reports the analysis performed.

Disclosure helps explain the development process, while code verification and reproducibility help establish the reliability of the results.

05 · What Researchers Often Get Wrong

Misconceptions About AI-Generated Research Code Disclosure

Misconception

Every AI-Generated Line of Code Must Always Be Disclosed

No universal line-by-line disclosure requirement applies across scholarly publishing. Requirements depend on the policy and the significance of the AI assistance.

Misconception

AI-Generated Code Does Not Need Disclosure if a Researcher Edits It

Human modification does not automatically erase the original AI contribution. Consequential assistance may remain reportable under the journal's policy.

Misconception

If the Code Runs Without Errors, It Must Be Correct

Executable code can implement incorrect transformations, assumptions, or algorithms. Technical execution is not equivalent to methodological validity.

Misconception

Sharing the Code Automatically Satisfies AI Disclosure Requirements

Code availability and AI-use disclosure serve different purposes. A reproducible script may still require a statement identifying consequential AI assistance.

Misconception

Using AI to Generate Code Automatically Makes the Researcher a Software Developer

Human software contributions should reflect actual development, adaptation, testing, and related work. Prompting alone does not necessarily establish a substantive contribution under the relevant taxonomy.

Misconception

Disclosing AI-Generated Code Proves That the Analysis Is Valid

Disclosure supports transparency but does not establish computational correctness, methodological suitability, or reproducibility. These require separate evaluation.

06 · What This Means for You

How Should You Decide Whether to Disclose AI-Generated Research Code?

Researchers should assess the code's function, its contribution to the research, and the extent of human verification.

The appropriate reporting should reflect the actual workflow rather than the number of generated lines.

A Practical Research Code Disclosure Framework

If AI completed routine programming statements
Check whether the journal requires disclosure of such assistance and verify that the code behaves as intended.
If AI generated data-cleaning or transformation code
Validate the changes to the dataset, document consequential procedures, and disclose material assistance where required.
If AI generated statistical or simulation code
Test the implementation, evaluate methodological assumptions, and report consequential AI involvement in the appropriate section.
If AI contributed to a machine-learning pipeline
Document the model development and evaluation procedures, verify the implementation, and comply with applicable AI disclosure requirements.
If the code is necessary to reproduce published results
Preserve the final tested code, relevant environment information, and execution instructions, subject to applicable sharing restrictions.

Researchers should also evaluate privacy, security, and licensing implications when generated code processes sensitive data or incorporates third-party dependencies.

Watch Out

Do not assume that AI-generated code is scientifically reliable because it executes successfully or produces plausible outputs. The program may implement an incorrect research procedure without generating an obvious technical error.

The appropriate standard is accurate reporting of AI assistance supported by verified, documented, and methodologically defensible computational procedures.

07 · A Quick Checklist

What to Verify Before Submitting Research Using AI-Generated Code

Before finalizing AI-assisted computational research, check:
Review the journal's AI-use, computational reporting, and code-availability requirements.
Identify which code components were generated or substantially modified with AI assistance.
Determine whether the generated code materially influenced research methods or findings.
Inspect and test consequential code for implementation errors.
Verify that data transformations, calculations, and outputs match the intended procedures.
Evaluate the methodological suitability of the implemented algorithms or statistical models.
Preserve final code, dependencies, settings, and execution instructions where appropriate.
Review security, confidentiality, and licensing considerations.
Disclose consequential AI coding assistance according to the applicable journal policy.
08 · Frequently Asked Questions

Frequently Asked Questions About AI-Generated Research Code

Do I need to disclose using ChatGPT to write Python or R code for research?

Disclosure may be required when generated code materially contributes to the research methods or results. The journal's policy determines the formal obligation, while researchers remain responsible for verifying the code.

Does using GitHub Copilot require disclosure in a research paper?

Not universally. The requirement depends on the functionality used, the significance of the generated code, and the applicable policy. Routine completion and substantive algorithm generation may be treated differently.

Must I disclose AI-generated code if I substantially rewrote it?

Possibly. Human revision does not automatically eliminate disclosure obligations. The relevant question is whether AI materially contributed to the final research workflow under the applicable policy.

Does AI-generated statistical code belong in the methods section?

Consequential code generation used for statistical analysis generally warrants methodological reporting. The journal may also require a separate AI-use statement.

Can I publish research using AI-generated code I do not fully understand?

Researchers should not rely on consequential code they cannot adequately evaluate or have appropriately verified. Qualified collaborators may assist, but the research team must be able to substantiate the computational procedures and findings.

Does sharing AI-generated code remove the need for disclosure?

No. Code availability supports reproducibility, while AI disclosure explains how the software was developed or used. The journal may require both.

Can I claim the CRediT Software role if ChatGPT generated most of the code?

Potentially, depending on your actual software contribution and the journal's requirements. Meaningful development, adaptation, and testing may support the role, but prompting alone does not automatically establish it.

Does disclosing AI-generated code prove that my analysis is correct?

No. Disclosure does not establish computational accuracy or methodological validity. The code and resulting analysis must be verified independently of the reporting statement.

09 · The Bottom Line

AI Can Generate the Code, but Researchers Must Validate the Computation

The Bottom Line

AI-generated research code may require disclosure when it materially contributes to data processing, analysis, simulation, or published findings. The reporting obligation depends on the applicable policy, while the responsibility for verifying the computational procedures remains with the human researchers.

Researchers should distinguish routine coding assistance from consequential methodological contributions, preserve reproducible code and relevant records, and report AI involvement accurately. The scientific reliability of research software depends on what it actually does, not on whether a human or an AI system originally wrote its instructions.

10 · Sources and Further Reading

Official Guidance on AI-Generated Research Code and Reproducibility

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes