text-classification · text · WASM · ~126 MB
When OpenAI released GPT-2 in 2019 they shipped a detector alongside it: a RoBERTa classifier fine-tuned to tell GPT-2's output apart from human-written web text. This is that original detector, running on-device. Paste text and it answers “reads machine-written” vs “reads human-written” with a real probability. It is a triage signal, never a verdict — and it is honest about its era: trained on GPT-2, not on today's chat models.
| Model | onnx-community/roberta-base-openai-detector-ONNX (ONNX export of openai-community/roberta-base-openai-detector) |
|---|---|
| Task / pipeline | text-classification (single-label) |
| Labels | Fake (reads machine-written) vs Real (reads human-written); softmax — the two scores sum to 1 |
| Architecture | RoBERTa-base (125M params) fine-tuned on GPT-2 1.5B outputs vs WebText |
| Reported accuracy | ~95% on 510-token GPT-2 1.5B samples (its training distribution) — not on ChatGPT-class text |
| Quantization | q8 (8-bit) ONNX |
| Backend | WebAssembly (runs anywhere; no WebGPU needed) |
| Download | ~126 MB, cached after first load |
| License | MIT |
| Web APIs | WebAssembly, Web Workers — all Baseline widely available |
Type or paste a passage (a paragraph works best — the detector was evaluated on ~510-token samples). The score re-computes automatically a moment after you stop typing. Above 50% the text reads machine-written to this detector.
The “real GPT-2 output” chips are verbatim completions generated by Xenova/gpt2 during this demo's validation — the exact model family this detector was trained to catch.
This is the model's raw softmax: two numbers, Fake and Real, that
sum to 1. RoBERTa reads the whole passage and asks “does this look like the GPT-2 1.5B outputs I was trained
on, or like WebText?” — machine text tends to be statistically smoother and more predictable than human
writing, and the classifier leans on that gap. Watch what happens with the short text chip: with
only four words there is almost no signal, and the bars slide towards a coin flip (or worse, a confident
mistake). When the two bars sit near 50/50, that uncertainty is the finding — treat the score as a
triage cue, never an accusation.
Content-authenticity checks usually mean shipping someone's draft, comment, or essay to a cloud API. A detector that runs in the tab flips that: the text never leaves the device, there is no per-call cost, and it works offline. And because this is the original detector — the one the whole “AI or human?” product category descends from — it is the perfect legible specimen for understanding what these tools can and cannot do.
Paste a passage, get a live machine-vs-human verdict, and compare real GPT-2 output against human writing of the same kinds side by side.
Run a batch of submissions through an on-device authenticity pre-check and triage them — badge “needs human review” with an adjustable threshold, human always in the loop.
Stress-test the detector: short texts, French, obfuscation, human+AI splices, code, and polished modern-LLM-style prose — watch exactly where it wavers and fails.
Generator vs watchdog: GPT-2 writes a passage in your browser, then its own detector scores it — and a “stealth dial” shows how decoding choices change detectability.
Binary classification is one call; ask for both scores with top_k:
import { pipeline } from "@huggingface/transformers";
const classify = await pipeline(
"text-classification",
"onnx-community/roberta-base-openai-detector-ONNX",
{ dtype: "q8" },
); // downloads + caches ~126 MB once
const out = await classify("ok so i finally tried that ramen place…", { top_k: 2 });
// → [{ label: "Real", score: 0.9998 }, { label: "Fake", score: 0.0002 }]
A default problem_type means Transformers.js applies a softmax over the two
classes, so Fake and Real sum to 1. It runs in a Web Worker so typing never
janks. The model truncates around 512 tokens — score passages, not whole documents.