loc bengaluru, ist | local --:-- srijanshukla18@gmail.com →
[post]/ai/ai-text-detection-is-a-style-classifier

training an AI detector on my own blog (and beating it)

/ 4 min read· ai

Two generic detectors failed on my content. So I built my own on my own ground truth: pre-2026 posts are human, 2026 posts are machine-written. It scored 44 for 44. Then I attacked it for an evening, drove its verdict on this very post down to 0.313, and packaged the attack as a skill.

Fun experiment from last week: built an AI text detector trained on my own blog, coz off-the-shelf detectors are completely useless on my writing.

Ran LLM-DetectAIve across my posts and it flagged 8 of my old handwritten posts as AI at 0.95 confidence. To catch 1 actual LLM post it threw 23 false positives. Tried Binoculars next and got the opposite - zero separation, old posts and LLM posts totally mixed together in the same score range.

Makes sense when you think about it: generic detectors are just style classifiers. My natural writing in tech posts is short sentences, fragments, bullet lists, jumping straight to the point, which confuses detectors trained on essays.

Nice thing about testing on my own blog is the dataset labels itself:

  • pre-2026 = written by me by hand (28 posts)
  • 2026 = drafted with LLMs (16 posts)

44 posts total, didn’t have to label a single file manually.

Couldn’t see his face coz he was driving and I am sitting behind. He was happy, he told me he was happy.

Stuff like that (from the post about my dad), the 2018 marathon fail, the old k8s debugging notes -> human bucket. The 2026 agent posts and newsletters -> machine bucket.

What worked

Two tiers of features.

First tier: basic stylometrics - sentence length distribution, vocab diversity, punctuation counts, how much sentence openers vary. That alone hit 0.886 leave-one-out (LOO) accuracy.

Second tier is what gave the real lift. I stopped asking “does this look like generic AI text?” and asked “does this look closer to my old posts or my 2026 AI posts?” Computed TF-IDF vectors, cosine similarity to both class centroids, and a 5-nearest-neighbors vote. Human posts averaged ~0.83 same-class neighbors, machine posts averaged 0.075.

Adding that pushed LOO from 0.886 to 0.909, and then 0.932 after dropping a bad feature. AUROC hit 0.964. On the full scan, every machine post scored 0.85 to 1.00 and every human post scored <= 0.11. Runs locally on 4 CPU threads in a couple seconds.

Two things I expected to help actually made it worse:

  • Perplexity (via local Qwen): textbook theory says AI = low perplexity, human = high perplexity. On my blog it’s backwards! My old notes are super blunt and simple so they get lower perplexity than the LLM drafts.
  • Normalized Compression Distance (NCD): looked fine until it hit my 2018 marathon post where I repeat words a lot (“walk and walk and walk”, “pain”). Repetitive text compresses well so NCD called my marathon story AI. Dropped NCD and LOO jumped to 0.932.

Beating my own detector

Once it worked, obviously I had to see how hard it is to fool.

First I had an LLM read two old posts and write fake ones copying their exact style.

Let the service name be ‘banana’. Let the pods be of the service ‘pineapple’.

Copied that opening style from K8s DNS fail and the detector scored the fake at 0.005 (100% human). Wrote another fake copying my musings-alone style, scored 0.015. The kNN + TF-IDF layer just measures how close the text sits to my pre-2026 posts.

Then I took a post the detector had flagged at 0.942 and spent an evening dragging it under 0.5 using the detector’s own feature breakdown. Took 13 rounds. What actually moved the score:

  1. Dropping in verbatim quotes from my old posts - even 2-3 real sentences flipped the 5-NN vote from 0/5 to 3/5 human neighbors.
  2. Fixing repeated sentence starters (the LLM draft started like 20 sentences in a row the same way).
  3. Adding ? and ! - my handwritten posts have ~9 question marks per 1000 words, LLM drafts had basically zero.
  4. Using my actual words (k8s, cpu, stuff, well, very, don't, coz, gotta) and stripping words that only showed up in the 2026 AI centroid.

Funny quirk: words appearing in fewer than 2 posts (min_df=2 in TF-IDF) are completely invisible to the vocab layer.

After 13 rounds the score dropped from 0.942 to 0.313. And tbh the edited version read way better than the first draft anyway. Packaged those 4 steps into a skill called byline-beater (to pair with remove-ai-smell).

Prose-only AI detection has a hard ceiling. Give a frontier LLM 20+ of someone’s old posts and it can match their sentence lengths, punctuation habits, and vocab closely enough that any text-only classifier folds. Still useful as a local linter for my own drafts though - tells me fast when something sounds like default ChatGPT/Claude slop instead of me.