All articles
Technical skills

Can Claude or Gemini Detect AI-Written Code in a Take-Home Test? We Checked

No. Claude caught 0 of 24 verdicts on AI-written code, Gemini 7 of 24, and Gemini flipped on 3 of 18 reruns. Use five live-call questions instead.

  • Fairer hiring
  • Less legal risk
  • Better hires

Sep 11, 2026 · 4 min read

0 of 24. That is how many verdicts on AI-written code Claude Opus got right when we asked it, one function at a time, "human or AI?" (12 AI-written functions, each judged twice.) Gemini caught 7 of 24. Gemini also gave a different verdict to the same code on 3 of 18 identical reruns.

A take-home looks suspiciously tidy, so you paste it into an assistant and ask whether it's AI. Whatever comes back, "human, 85%" or "AI, 85%", is a number that feels like evidence and isn't.

What we ran

We took six short Python functions (median, mode, string capitalizing, and so on) and made three versions of each:

  • the real one from Python's own standard library, written by people before AI assistants existed
  • one written by Claude Opus from a one-line spec
  • one written by Claude Opus "the way a busy developer would in a hurry"

Then, in fresh sessions, each assistant judged each of the 18 samples twice with the same plain question.

Verdicts on AI-written code that said human
Claude OpusClaude Opus, run 1: called humanClaude Opus, run 2: called humanClaude Opus, run 3: called humanClaude Opus, run 4: called humanClaude Opus, run 5: called humanClaude Opus, run 6: called humanClaude Opus, run 7: called humanClaude Opus, run 8: called humanClaude Opus, run 9: called humanClaude Opus, run 10: called humanClaude Opus, run 11: called humanClaude Opus, run 12: called humanClaude Opus, run 13: called humanClaude Opus, run 14: called humanClaude Opus, run 15: called humanClaude Opus, run 16: called humanClaude Opus, run 17: called humanClaude Opus, run 18: called humanClaude Opus, run 19: called humanClaude Opus, run 20: called humanClaude Opus, run 21: called humanClaude Opus, run 22: called humanClaude Opus, run 23: called humanClaude Opus, run 24: called human24 of 24Gemini 3.8 FlashGemini 3.8 Flash, run 1: called humanGemini 3.8 Flash, run 2: called humanGemini 3.8 Flash, run 3: called humanGemini 3.8 Flash, run 4: called humanGemini 3.8 Flash, run 5: called humanGemini 3.8 Flash, run 6: called humanGemini 3.8 Flash, run 7: called humanGemini 3.8 Flash, run 8: called humanGemini 3.8 Flash, run 9: called humanGemini 3.8 Flash, run 10: called humanGemini 3.8 Flash, run 11: called humanGemini 3.8 Flash, run 12: called humanGemini 3.8 Flash, run 13: called humanGemini 3.8 Flash, run 14: called humanGemini 3.8 Flash, run 15: called humanGemini 3.8 Flash, run 16: called humanGemini 3.8 Flash, run 17: called humanGemini 3.8 Flash, run 18: caughtGemini 3.8 Flash, run 19: caughtGemini 3.8 Flash, run 20: caughtGemini 3.8 Flash, run 21: caughtGemini 3.8 Flash, run 22: caughtGemini 3.8 Flash, run 23: caughtGemini 3.8 Flash, run 24: caught17 of 24called humancaught

24 verdicts each: 12 AI-written functions, each judged twice. All AI code came from one generator, Claude Opus.

Source: our test, counted by script

Show the data
called humanTotal
Claude Opus2424
Gemini 3.8 Flash1724

Where it falls apart

Claude's reasons were honest about it, yet it still picked a side. On an AI-written median function it said:

...a competent person or an AI could equally have written it, so nothing in it reliably shows who wrote it and a 50% confidence is no better than a coin flip.

Claude Opus, judging a function Claude Opus had written

Gemini was more sure and less consistent. On one AI-written median function, run 1 said AI because it "mirrors standard LLM patterns, including sorting before validating emptiness". Run 2 said human because "sorting before checking for an empty list" and the error message "strongly suggests human code". Same function, same evidence, opposite verdict.

The human controls looked like a win: all 12 judgments said human, mostly with high confidence. But the reasons say why. Both tools recognized the standard library and said it was "copied verbatim". That is memory of famous code, not reading a style. Claude's confidence did sit lower on the AI-written code (25 to 55) than on the controls (60 to 90), but your candidate's code won't be famous, so that gap won't carry over.

Limits: short functions, one generator, two tools. Other studies agree. A 2023 whitepaper from UC Riverside and zyBooks (two authors work for a vendor) found OpenAI's own text detector rated all 30 test programs, 15 from ChatGPT and 15 from people, as likely AI. A 2023 study by Wang and colleagues found similarity checkers, GPTZero and instructors' hunches had "mixed success". Stanford researchers (Liang and colleagues, 2023) showed detectors misread non-native English writing. None of it is hiring data, but none of it supports a lie detector.

Skip the verdict, run a conversation

Even the tools say so. Claude, on one sample: "check authorship by asking the candidate to explain or extend it". On another: it "shouldn't be used as evidence against the candidate". Replace the verdict with a conversation.

If you suspect... Do this
The code is too polished Ask for a 30-minute walkthrough and one live change
They used AI against your rules Check the rules first: did the instructions say what was allowed? (see)
Everyone's code looks alike Change the task to one with your own data or a real constraint
You can't verify at all Allow AI, ask for a note on how it was used (see)
Five questions for the walkthrough (copy these):
1. Why did you choose this structure over a simpler one?
2. Which part took you longest, and what did you try first?
3. Change [requirement] live. What do you touch?
4. What would break if the input were empty or huge?
5. What would you do differently with another day?

The fair counter-argument: "Even a weak signal beats none." Not when the signal says "human" for AI code in 17 to 24 of 24 cases and flips on a rerun: that is sorting candidates with a coin. Rely on rules, a live call and your own judgment, and ask your lawyer about local rules on automated decisions (this is not legal advice).

This article is general information, not legal advice. Laws differ by country and change often, so consult your lawyer before you rely on it for your situation.

Keep reading