Do AI detectors work on code (GitHub Copilot, programming assignments)?
I TA a writing course, but this term I also picked up grading for an introductory Python course and I have run into something I do not know how to think about.
Cite
Global 100 Forum, "Do AI detectors work on code (GitHub Copilot, programming assignments)?", https://forum.global100.org/q/do-ai-detectors-work-on-code-github-copilot-programming-assignments/, accessed 2026-10-11.The instructor wants to run submissions through an AI detector because she suspects widespread Copilot use. I tried it on a handful of submissions I know were written by hand (I watched one student write theirs in office hours). The results were all over the place: one came back "likely AI", two came back "human", and one would not process at all because the file was too short.
My question is whether any of these tools are meaningful for code at all. Prose detectors look at word choice and sentence variation. Code for a "write a function that reverses a string" assignment is going to look nearly identical from thirty students whether or not a model wrote it. Is there any research on detecting AI-generated code specifically? And if the detectors are not meaningful, what do CS departments actually do? I would rather tell the instructor "this does not work and here is what does" than just "no".
6 more replies
Most helpful first- Sam WhitlockMember ·
Short version: the detectors you tried were built for prose and you are feeding them something that is not prose. The signal those tools look for is roughly "how predictable is the next token", and well-written code is extremely predictable by design. Conventions, idioms, standard library names, the same loop structure everyone learns in week three. A clean human solution to a small exercise looks exactly like a model's solution because both are converging on the one obvious answer. So you get noise, which is what you observed.
From a threat model view the more interesting question is what you are actually trying to detect. Copilot completing a line is different from pasting a whole assignment from a chatbot. Pick the behaviour you care about first, then ask whether any tool can see it. For most intro assignments the answer is no, and the department has to fall back on process.
- Hana SatoMember ·
There is research on AI-generated code detection, but I would be careful about reading it as "it works". The published approaches mostly retrain a classifier on pairs of human and model-written solutions to the same problems, and they report decent numbers inside their own benchmark. The caveats are the ones Sam raised: short solutions carry very little signal, conventional code looks model-like, and results drop sharply once code is reformatted, renamed or lightly edited. None of that is surprising. Code has far fewer degrees of freedom than an essay.
It is also worth knowing that Turnitin, which is what most institutions already pay for, says plainly in its AI writing FAQ that its model "does not reliably detect AI-generated text in the form of non-prose, or code," and in the same document that it is "not pursuing ChatGPT code detection at this time." If the biggest vendor in the space is not claiming to do it, a free prose checker is not quietly doing it either.
- Priya N.Member ·
@Hana Sato thank you, the Turnitin line is exactly what I needed, because the instructor trusts that vendor more than she trusts me. A follow-up: several people have mentioned "process". For a Python course, does that mean asking students to submit a git history? We do not currently require it, and I am not sure first-years could manage git on top of the course.
- Tobias K.Member ·
I will address the process question from the policy side, since that is where it belongs. The departments I work with have largely stopped trying to detect assistant use in code and have instead defined it. The syllabus states which tools are permitted for which assignments, what must be disclosed, and that any student may be asked to explain any submitted line in a short oral check. That last clause does most of the work. It is not an accusation; it is announced in advance and applied to a sample of students each week.
Requiring a git history is defensible for upper-level courses and awkward for first-years. A lighter alternative is to have the course environment save snapshots automatically, which several teaching platforms do without the student touching version control. Whatever you adopt, write it down before the term starts. Retrofitting a rule after a suspicion is where most appeals succeed.
- Sam WhitlockMember ·
@Jules I would not trust that number in either direction, and I say that gently because it is a very common move. Those tools are trained on natural language. Code is not natural language, so the model is scoring something outside what it learned, and the result is close to arbitrary. Your nephew's 90% human reading is as meaningless as the "likely AI" reading Priya got on a hand-written file. If he wrote it, the thing that protects him is being able to explain it, not a percentage from a tool that was never built for the job.
Write something first.
Give people something to work with: at least 30 words on what happened and what you tried.
That is too long. Keep it under 6,000 characters.
Write the question as the title, 15 to 140 characters, no links.
Pick a category.
Add a name (2 to 40 characters, no links).
That email address does not look right.
That was quick. Read the thread, then try again.
The form expired. Reload the page and post again.
Something went wrong with the form. Reload and try again.
Please complete the check and post again.
Limit reached for now. Try again later.
This thread is closed to new replies.
This thread no longer accepts replies.
Something went wrong with the form. Reload and try again.
Post a reply or question first (name and email), then this browser can vote, edit and accept answers.
You cannot vote on your own post.
Only the author (within 30 days) or the forum team can do that.
That email belongs to a forum team account. Use your sign-in link instead.
New accounts are paused for the moment. Try again later.
That was already posted.