Specifications

Detect Law v8.1

A zero-shot AI-text detector: two small open models and an exact integer decision rule, with no training on AI text. These specs match the version scored by RAID's official evaluation.

Identity

NameTHE DETECT LAW v8.1, package detect-law 0.3.0
TypeZero-shot, metric-based. No classifier is trained on AI text.
Decision ruleInteger-only (int32) sequential statistical test, written in C
LanguageEnglish (RAID is English-only)
LicenceCode: all rights reserved. Paper: CC BY-NC-ND 4.0, doi:10.5281/zenodo.23257822

Models

RoleCareful mode (default)Official mode (RAID submission)
A · base modelLlama-3.2-1BLlama-3.2-1B
B · instruct modelLlama-3.2-1B-Instruct, 4-bitLlama-3.2-1B-Instruct, full precision
MemoryAbout 3 GBAbout 5 GB

Both modes flagged the same 0.22% of held-out human texts; official mode catches slightly more AI text.

How a text is checked

  1. Normalise. Unicode NFKC, remove invisible format characters (zero-width spaces, soft hyphens), map Cyrillic and Greek look-alike letters to Latin, collapse spacing.
  2. Clean (app only). Skip headings, table fragments and equation lead-ins, and everything from a References heading on. PDFs are reflowed into paragraphs first.
  3. Window. Split into 200-token windows, each scored from a fresh start-of-text token; a final window under 100 tokens joins the one before. The RAID run read the first 1,024 tokens of each text.
  4. Measure every token, with one forward pass of each model:
    • Surprise: how predictable the token is under model A, against that position's own expected value.
    • Contrast: how much more the instruct model B prefers the token than the base model A does, against the expected gap.
    • Repetition: whether tokens repeat within the window, against how much probability A already gives tokens it has seen.
  5. Decide. An integer sequential test over the three signals stops early when the evidence is decisive, or finishes with an end-of-text test. Its human baseline allows for differences between texts. Every constant comes from 3,200 human RAID training texts (400 per domain). The rule keeps 24 int32 words of state and uses no floating point.

Output

VerdictAI evidence, No evidence of AI, or Undecided
EvidenceA z-score for each signal: surprise, contrast, repetition
Scorelaw_score = Σ max(z, 0)² × 256, an integer. Benchmark scale: √(law_score ÷ 256)
Also returnedTokens read vs tokens in the text, whether it stopped early, time taken

Accuracy on RAID

Official evaluation, 672,000 texts5% FPR1% FPRAUROC
All texts, including 11 attacks88.99%81.37%96.48
No attacks92.33%86.54%97.61
By AI model99.6–100% on Llama 2 chat, ChatGPT and Mistral chat; 82–88% on base models with random sampling
By kind of writing89.4% (poetry) to 95.0% (books)
Under attackNo loss from look-alike letters, zero-width characters or extra spacing. Hardest: paraphrasing (76.6%) and synonym swaps (80.8%).
Human texts flagged0.22% of 3,200 held-out texts; worst kind of writing poetry 1.25%; none of the texts over 600 tokens
StandingTop zero-shot detector on RAID; 27th of 44 overall. Trained commercial detectors score higher.

AI text caught at a fixed false-positive rate (FPR) on human text. Official results from RAID's evaluation service, 8 October 2026.

Speed and cost

HardwareTokens per second
A40 GPU (the full RAID test set in about 4.3 hours)about 12,800
Kaggle T4 GPUabout 1,000
Mac M4 Pro (MLX)about 750–900
4-core CPUabout 430

One forward pass of each 1B model per token, with no perturbations or sampling. About $0.01–0.03 per million words on rented GPUs.

Interfaces

Web appRuns locally on port 8765. Paste text, or drop .txt, .md, .docx or .pdf files, several at once.
Command linedetect-law file1.pdf file2.docx …
HTTP API/v1/detect (text), /v1/detect-file (file bytes), /v1/health, /v1/info
MCP serverTools check_text, check_file, about_detect_law for Claude
Limits300,000 characters per text, 20 MB per file. Text never leaves the computer.

Known limits

  • Texts under about 120 words are often Undecided.
  • Paraphrased text and base models with plain random sampling are the hardest cases.
  • RAID's AI models date from 2023. Short texts from current frontier models are harder to catch.
  • Scanned PDFs (page images only) contain no text to read.
  • The constants were set on RAID's human training texts.
  • Not yet tested on non-native English writers.

A verdict is statistical evidence, not proof. Send AI verdicts to a person for review, never to automatic penalties.