Can you tell if code was written by AI?
Short answer
No AI code detector reliably shows who wrote code: a 2024 arXiv study by Suh and colleagues found existing detection tools all performed poorly on source code.
The same team's best purpose-built model reached an F1 score of 82.55, still a score with errors built in. A 2025 study of over a million samples found code-trained detectors fail to generalise beyond their training data, and a watermark exists only if the generator added one. What does show authorship is a record made at the time: commit history, an Assisted-by or Co-authored-by trailer, a pull request note. CodeLifter has not run its own detector test.
Six ways to check, compared
Reliability on code, from the cited sources, checked 2026-10-15| Method | Looks at | Works on code | Main limitation | Source |
|---|---|---|---|---|
| General AI text detectors | Word statistics of the text | Poorly | Built for prose; existing tools performed poorly on code in a 2024 study | arXiv 2411.04299 (Suh et al.) |
| Code-trained classifiers | Features learned from labelled code | Within their training data | Fail to generalise to other languages and coding domains | arXiv 2507.10583 (Orel et al.) |
| Watermark checks | A statistical mark added at generation | Only on marked output | Needs the generator to embed a mark; low-entropy code weakens standard marks | arXiv 2305.15060 (Lee et al.) |
| Public-code matching | Overlap with code in public repositories | Yes, for copied code | Shows where code also exists, not who wrote it; matches occur in under 1% of Copilot suggestions | GitHub Copilot code referencing docs |
| Hand review for tells | Imaginary APIs, prompt-like comments, style shifts | Sometimes | The same signs appear in hurried human code | GNOME Shell extension review guidelines |
| Records made at the time | Commit history, trailers, pull request notes | Yes, when kept | Only as honest as the person who wrote them | git-interpret-trailers (Git project) |
Why detectors struggle with code
An AI code detector takes a snippet and returns a score that claims to estimate whether a model wrote it. The published research does not support treating that score as an answer. In a 2024 arXiv study, Suh and colleagues tested existing AI detection tools on source code and reported that they all perform poorly and lack sufficient generalizability to be practically deployed. Their own best model reached an F1 score of 82.55 and beat the earlier code detector GPTSniffer. In a 2023 arXiv paper, Nguyen and colleagues had shown that GPTSniffer, a CodeBERT-based classifier, outperformed GPTZero and a general text classifier at spotting code written by ChatGPT, and that similar training data boosted its results.
That last point cuts both ways: a classifier does best on code that resembles what it was trained on. The 2025 DroidCollection paper by Orel and colleagues gathered over a million code samples in seven programming languages from 43 coding models, including human and AI co-authored code. The authors report that existing detectors fail to generalise to coding domains and languages outside their narrow training data, and that most are easily compromised by superficial prompting that makes output look more human. Real files are also mixed: a person writes part, accepts a suggestion, edits it and pastes a fix, and a single human-or-AI score does not describe that.
They all perform poorly and lack sufficient generalizability to be practically deployed.
What watermarks can and cannot show
A watermark is a hidden statistical pattern a generator places in its own output while writing it; a checker later looks for the pattern. In a 2023 arXiv paper, Lee and colleagues found that existing text watermarks fail to work properly on code because code has low entropy, and proposed SWEET, which marks only the higher-entropy parts. In practice watermarks have limits:
What counts as evidence of authorship
The strongest evidence is a record made while the work happened. The git-interpret-trailers manual describes trailers as key-value lines at the end of a commit message, after a blank line. A commit written with help from an assistant can say so in one line (an example written by the editors):
The Linux kernel asks AI-assisted contributions to carry an Assisted-by tag, and says AI agents must not add Signed-off-by; other projects use Co-authored-by or Generated-by. A pull request note saying which parts were generated and how you checked them does the same job for reviewers. None of these is tamper-proof, but each is a statement a person made and can be asked about, which a detector score is not. See disclosing AI help in commits.
Questions and answers
Can AI-generated code be detected?
Not reliably. In a 2024 arXiv study, Suh and colleagues found existing AI detection tools all performed poorly on source code, and their best purpose-built model reached an F1 score of 82.55.
Does GPTZero work on code?
Poorly, according to published research. In a 2023 arXiv paper, the code classifier GPTSniffer outperformed GPTZero at identifying code written by ChatGPT. GPTZero was built for prose.
Is there a free AI code detector that is accurate?
No detector, free or paid, has published evidence of reliable accuracy across languages and coding styles. The 2025 DroidCollection study found existing detectors fail to generalise outside their narrow training data. CodeLifter has not tested any detector.
Can a teacher or employer prove I used AI from the code alone?
Not from the code alone. A detector score is a guess. The strongest evidence either way is the history kept while writing: commits, drafts and notes, and a conversation about how the code works.
Do AI coding assistants watermark their code?
Watermarking for code exists in research, such as the SWEET method published on arXiv in 2023, but a watermark can only be found in output from a generator that embedded one. Do not assume any tool you use does.
Does GitHub Copilot tell you when code matches public code?
Yes, through code referencing. GitHub's documentation says accepted inline suggestions that match public code are logged with the matching file URLs and licence, and that such matches typically occur in under one percent of suggestions.
What should I record when I use an assistant?
Add a trailer such as Assisted-by to the commit message, as the Linux kernel asks, and say in the pull request which parts were generated and how you checked them.
What should I do if a pull request looks AI-generated?
Review it like any other pull request, then ask the contributor how it was made and whether they can explain it. Point to the project's written AI policy if it has one.
Will CodeLifter publish its own AI code detector test?
A test is planned but has not been run. Until results are published with the method and raw counts, CodeLifter reports only published research and makes no claim about any detector's accuracy.
Sources
Method note
Checked on 2026-10-15. 8 sources opened that day: the arXiv abstract pages of four papers (2411.04299, 2307.09381, 2507.10583, 2305.15060), GitHub's Copilot code referencing documentation, the GNOME Shell extension review guidelines, the git-interpret-trailers manual and the Linux kernel's AI Coding Assistants page. Figures come from the papers' abstract pages; we did not check figures that appear only in the full papers. CodeLifter has not run its own detector test and names no detector as best. Drafted with AI assistance; an editor checked every sentence against its source.


