Every week someone asks us the same question: "How does an AI detector actually know?" Teachers ask it about essays, recruiters about cover letters, and developers about the content flowing through their apps.
The honest answer is that no detector knows. It estimates. In this post we'll walk through the main techniques behind AI content detection, show a small Python experiment you can run yourself, and explain why every detector, including ours, sometimes gets it wrong.
TL;DR
- AI text detectors look for statistical fingerprints: how predictable the text is (perplexity), how uniform it is (burstiness), and patterns learned by trained classifiers.
- AI image detectors look for generation artifacts in pixels and frequencies, and for provenance metadata like C2PA.
- All of this is probabilistic. Short texts, heavily edited AI text, and writing by non-native English speakers are where detectors struggle most.
- Treat a detector score as one signal for human review, never as proof.
1. Perplexity: how "surprised" is a language model?
Large language models generate text by repeatedly picking likely next tokens. As a result, AI-written text tends to be very predictable to another language model.
Perplexity measures that predictability. Low perplexity means the model saw each next word coming. Human writing usually has more unexpected word choices, odd phrasing and personal detail, so its perplexity tends to be higher.
2. Burstiness: is every sentence equally "smooth"?
Humans are inconsistent. We mix a long, winding sentence with a short one. We get vague, then very specific. Burstiness captures how much predictability varies from sentence to sentence.
AI text is often uniformly smooth: every sentence has similar length, structure and perplexity. Human text tends to be "burstier".
Try it yourself: perplexity and burstiness in ~25 lines
Here's a minimal experiment using the open GPT-2 model from Hugging Face. It's not a production detector, but it shows the core idea.
# pip install torch transformers
import re
import torch
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
tokenizer = GPT2TokenizerFast.from_pretrained("gpt2")
model = GPT2LMHeadModel.from_pretrained("gpt2")
model.eval()
def perplexity(text: str) -> float:
enc = tokenizer(text, return_tensors="pt")
with torch.no_grad():
out = model(**enc, labels=enc["input_ids"])
return torch.exp(out.loss).item()
def burstiness(text: str) -> float:
sentences = [s for s in re.split(r"(?<=[.!?])\s+", text) if len(s.split()) > 4]
if len(sentences) < 2:
return 0.0
scores = [perplexity(s) for s in sentences]
mean = sum(scores) / len(scores)
std = (sum((x - mean) ** 2 for x in scores) / len(scores)) ** 0.5
return std / mean # coefficient of variation
sample = "Paste a few paragraphs here and compare a human-written text with an AI-written one."
print(f"Perplexity: {perplexity(sample):.1f}")
print(f"Burstiness: {burstiness(sample):.2f}")
Run it on a paragraph you wrote and on a paragraph from a chatbot. You'll often see the AI text score lower on both. Then try a formal, textbook-style human paragraph, and you'll see why these signals alone are not enough.
3. Trained classifiers
Modern detectors don't rely on two hand-made numbers. They train a classifier, often a fine-tuned transformer, on large sets of human-written and AI-written text from many models. The classifier learns subtler patterns: word-choice distributions, how ideas are connected, repetition, and stylistic habits of specific models.
The catch is that classifiers are only as good as their training data. New models, new prompting styles and paraphrasing tools shift the distribution, so detectors need constant retraining.
4. Watermarking: the proactive approach
Instead of guessing after the fact, some AI providers can watermark output at generation time by subtly biasing token choices in a pattern only a key holder can detect. Google's SynthID is one example. Watermarks are promising, but they only work for models that implement them, and heavy editing or paraphrasing can weaken them.
5. How AI image detection works
Images are a different problem. Common approaches include:
- Pixel and frequency artifacts: generative models leave statistical traces, such as unusual noise patterns, texture inconsistencies and frequency-domain signatures, that a computer-vision model can learn to spot.
- Visual inconsistencies: lighting, reflections, text inside the image, hands and backgrounds that don't quite add up.
- Provenance metadata: standards like C2PA Content Credentials can record how an image was created or edited. When present, metadata is a strong signal, but it's easy to strip, so its absence proves nothing.
Why detectors get it wrong (and why that matters)
This is the part we think every developer integrating detection should understand.
- Short text is unreliable. A tweet-length sample doesn't contain enough signal.
- Edited AI text blurs the line. Text that's AI-drafted and human-edited is genuinely mixed, and so is the score.
- Non-native English writers get flagged more often. A 2023 Stanford study (Liang et al., "GPT detectors are biased against non-native English writers") found that several popular detectors misclassified a large share of TOEFL essays written by non-native speakers as AI-generated. Simpler vocabulary and sentence structures look "predictable".
- Even big labs have struggled. OpenAI withdrew its own AI text classifier in 2023, citing its low rate of accuracy.
That's why we design ProofAI to return a confidence score, not a verdict, and why we recommend using it as one input alongside human judgment, drafts, version history or a conversation with the writer.
Adding AI detection to your own app
If you're building edtech, HR, publishing or moderation tools, detection usually lives behind a simple API call. Here's what a request to the ProofAI API looks like:
curl -X POST https://ai.proofai.in/api/v1/detect \
-H "x-api-key: YOUR_API_KEY" \
-H "Origin: YOUR_DOMAIN" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'content=Your text here'
A few integration tips, whichever provider you use:
- Set a minimum length before scoring, and show "not enough text" instead of a weak score.
- Show scores as ranges or confidence levels, not as "AI" or "Human" labels.
- Never auto-punish. Route high scores to human review instead of automatic rejection.
- Mind privacy. Check whether the provider stores submitted content. ProofAI doesn't store scanned content.
We'll go deeper on the integration side in a future post.
Wrapping up
AI detection is a useful tool, but it's statistics, not magic. Understanding perplexity, burstiness, classifiers, watermarks and image artifacts helps you build features that are useful and fair.
If you want to experiment, you can try the free detector at proofai.in (no login needed) or ask us about API access.
What would you want to see next? A deep dive into image detection, a full API integration tutorial, or a benchmark of how detectors handle edited AI text? Let us know in the comments. 👇
Disclosure: we're the team behind ProofAI at 4Born Solutions. This article was drafted with AI assistance and reviewed and edited by our team.
Top comments (0)