Engineering · AI · Evaluation

Building Cereby's AI Text Detector: 1 in 6 Student Essays Flagged to 0

10 min read

How a frozen test set, a recalibrated score and a teacher model turned a detector that accused students into one we trust


At the start of last week, Cereby's AI detector called about one in six real student essays AI-written. Not drafts pasted from a chatbot: essays students wrote themselves, from public research collections, scored exactly as the AI Detector tab scores them.

Today it flags 0.0% of those essays, and it catches more of the AI writing students actually run into. This post is about how we got there: the lab that measures every candidate the same way, and the four versions of the detector it produced. The humanizer, which leans on this detector, has its own post, and where both models run is in the serverless-GPU post.

A lab where every experiment is a commit

Everything below came out of one setup, and it is the reason the numbers in this post can be compared at all.

An experiment is a small change to a run file on a lab branch. Pushing it starts a GPU job on a per-second cloud platform, which reads data from a shared volume, does its work, and commits its results back to the same branch as a JSON file and a log. Nothing runs on a laptop, nothing is remembered only in a terminal, and a run that went wrong can be read a week later exactly as it happened.

Two rules keep it honest. Test sets are frozen and never trained on: every training step skips their documents by group, so a paragraph cut from a test essay cannot leak in through a different window. And every number is the one the app would show. A detector is scored in the same paragraph mode, with the same calibration, the tab uses. A model that only looks good on a convenient metric never makes it out of the lab.

A test set built from real writing

The first job was a test set we could believe. We called it the Arena: 8,000 texts, with 2,246 human texts in its frozen test half, assembled from public collections with commercial-friendly licenses.

SourceWhat it adds
ASAP 2.0 and AIDE student essaysReal student writing, with English learners on purpose
RAIDHuman and AI text across eight domains and eleven generators
MAGETen more domains and 27 generators
Our own generated essaysAI text written for student-style tasks

Text is split into dev and test by a hash of its group, so one essay never sits on both sides. Thresholds are set on dev and measured on test. The headline number is the one that matters for a student: how much AI the detector catches while flagging at most 1% of human writing.

Most false alarms were the cut-off

Scored on the Arena, the detector we were running flagged 19.0% of human text at its 50 cut-off: 16.2% of student essays, 12.0% of English learners' essays, and more than half of short texts under 120 words. More than 1% of human texts scored exactly 100, so no cut-off on that scale could get down to 1%.

But the model itself was better than its score. Its raw probability, at a threshold set on dev, flagged 0.4% of student essays and still caught 98% of our generated essays. The problem was how a probability became a number on screen. So we mapped it through log-odds and fit the curve on dev text, so that a 50 means the same thing on every kind of writing:

Same model, test text, tab scoreBeforeCalibrated
Human text at 50+19.0%2.8%
Student essays at 50+16.2%0.6%
English learners at 50+12.0%0.2%
Human text in the Human band (0 to 20)60.9%91.1%
AI text at 50+96.1%87.9%

It costs some AI caught, mostly older-model and short text. We took that trade on purpose: a detector that wrongly accuses one student in six is worse than useless, whatever it catches.

A big teacher, a small student

Next we tried every ready-made open detector we could license for commercial use. The best of them caught 90.9% of AI at 1% of human text flagged, against our 86.3%, and was far better on the generators and short texts ours missed. It was also nine times slower on a CPU and much larger, which would have made every check slower for every student.

So we used it as a teacher instead. We took a student model the same size and shape as the one we served, and trained it on what the teacher believed about 78,600 pieces of 44,000 training documents, none of them in the Arena. Each document gives three views: a long window, a row the way the tab sends one, and a short cut of 40 to 120 words, so the student learns short text too.

Mixing the true label with the teacher's belief matters. The teacher is wrong on about 15% of views, and a student trained on its belief alone would copy those mistakes. The first student flagged 0.1% of student essays and 4.0% of short human texts (down from about one in five), and caught more AI than the model it replaced.

The two cheapest tricks there are

Then we tested it the way someone trying to beat it would. RAID ships eleven attacks on AI text, from paraphrasing to swapping letters. Against two of them our new student fell apart: with look-alike letters from other alphabets, or invisible zero-width spaces sprinkled through the text, it caught about one attacked AI text in seven.

Neither attack changes what a reader sees, so the fix was not a model. A normalizing step now maps every look-alike letter back to its plain one and strips invisible characters before any text is scored. With it, the student caught 96.3% of the look-alike texts and 95.8% of the invisible-space ones. The second version also trained on RAID's attacked text, and a stricter calibration for documents under 120 words brought short human texts flagged at 50+ down to 1.5%.

Writing like students write now

The second version was still tuned on text from older generators. Students use current ones, so the third version added 6,000 texts from six current chat models, 3,000 rewrites of those texts by a second model, 20,000 short human pieces, and 2,000 real essays with only their grammar fixed, labeled human, so polished writing is not mistaken for AI. To score it we added frozen slices beside the Arena, on topics never used in training.

The fourth version, trained this week, adds two kinds of human writing that were easy to over-flag, research-article passages and undergraduate essays from open collections, and AI text that had been asked to "sound human". Here is the share of current-model AI each version catches at 50+. Student essays flagged stayed at or under 0.1% throughout:

Test text, tab score at 50+v3v4
Student essays and English learners flagged0.0%0.0%
Research-article passages flagged6.2%1.4%
AI asked to "sound human", caught80.5%95.3%
AI rewritten by a second model, caught94.7%95.7%
Held-out RAID with every attack, caught94.3%94.7%
Short AI text, caught75.4%70.0%

The last row is the one v4 gives up, and it led to the last change.

Too short to judge

We broke short dev texts down by length and found the real risk was not false alarms. Short human text is rarely flagged at any length. Short AI text is the problem, and it fails in the comfortable direction: at 40 to 49 words, the detector put 65.7% of AI texts in the Human band. A student would read that as a clean bill of health it never earned. At 60 to 79 words the same number is 16.6%, and it keeps falling.

So the detector no longer scores anything under 60 words. Every place a student can run a check, in the app, on the free tool page and through the chat, now says the text is too short to judge instead of showing a number it cannot stand behind.

What this taught us

Measure the number the user sees. The detector's worst problem was never in the model's ranking of texts. It was in how a probability turned into a score on screen, and it took a test set of real student essays, scored exactly like the tab, to see it.

A teacher can be better than you can afford to serve. The best open detector was too slow and too large for every check, but every one of its judgments could still go into a student the size we could serve.

Attack your own model before anyone else does. The two tricks that broke our first student were the cheapest ones on the list, and the fix was a few lines of cleanup, not more training.

What's next

Detector v4 is rolling out this week. After that, the open problem is short AI text: the detector now refuses to score under 60 words, and the next versions aim to make the texts just above that line as reliable as longer ones.

All engineering posts