---
license: mit
base_model:
- jhu-clsp/mmBERT-small
- jhu-clsp/mmBERT-base
language:
- en
- zh
- ja
- multilingual
pipeline_tag: text-classification
library_name: transformers
tags:
- ai-detection
- machine-generated-text
- knowledge-distillation
- modernbert
- mmbert
- onnx
- webgpu
- webassembly
- lightgbm
- treeshap
---
# ProseGuard
**Multilingual AI text detection that runs locally, from a 679 KiB WASM screener to a 296 MB server verifier**
[](https://aidetect.rist.edu.rs)
[](https://prosegrain.com)
[](https://rist.edu.rs/papers/aidetect/)
[](./LICENSE)
[](#pick-your-tier)
*English · Simplified & Traditional Chinese · Japanese | Built on Rust WASM & [`jhu-clsp/mmBERT`](https://huggingface.co/jhu-clsp/mmBERT-base)*


## What these numbers say, and what they don't
- **Measured on the same split:** on [TextSight OOD-2026](https://huggingface.co/datasets/textsightai/ai-text-detection-benchmark-2026) (338 modern human vs 56 2026 AI passages), the neural tiers catch more AI text at 1% FPR than the open detectors we could run (`Oxidane/TMR` 50.0%, `e5-small-lora` 25.0%).
- **The sample is small.** 56 AI passages, 12 from Claude Opus 5. A 1% FPR threshold rests on about 3 human passages, so `mmBERT-base`'s 96.4% has a CI of 46 to 100%. `mmBERT-small` INT8 is the most stable (86 to 100%).
- **ESL false positives depend on the tier.** At a plain 0.5 threshold, `mmBERT-small` INT8 flags 13.7% of non-native PubMed papers, about the same as `Oxidane/TMR`. `ProseGuard-ML` (3.8%) and `mmBERT-base` (4.4%) are lower. These are published, copy-edited papers, not raw learner essays.
- **Not tested yet:** commercial APIs (GPTZero, Originality.ai, Pangram, ZeroGPT) have not been run on this split. We make no claim about them.
- **Where we lose:** on English adversarial paraphrase (RAID+MAGE) we reach 51 to 54% TPR@1%FPR. GPTZero (92.9%) and Desklib v1.01 (76.5%) report higher numbers on the RAID leaderboard. That is a different split, but the gap is large.
## Pick your tier
| Tier | Path | Size | Latency (M1 Max) | Best for |
| :--- | :--- | :---: | :---: | :--- |
| **ML** | [`ml/`](./ml) | `679 KiB` WASM | `2.3 ms` | Instant in-browser screening with exact `TreeSHAP` explanations |
| **Small · Web** | [`mmbert-small/web/`](./mmbert-small) | `51.8 MB` Q4 | `~320 ms` CPU 1 thread | Neural check fully inside the browser (WebGPU / WASM) |
| **Small · INT8** | [`mmbert-small/onnx/`](./mmbert-small) | `136 MB` INT8 | `~200 ms` CPU | Local CLI and CPU services |
| **Base · INT8** | [`mmbert-base/onnx/`](./mmbert-base) | `296 MB` INT8 | `~430 ms` CPU | Highest Chinese recall, 3-way + span output |
All neural tiers output `Human / AI-Assisted / AI-Native` probabilities, a continuous edit-intensity score, and a 64-token sliding-window peak for locating AI spans inside long human text. Non-commercial (`NC`) corpora were excluded from neural training.
## Quick start
```bash
# Pull only one tier
hf download ElderRyan/proseguard --include "mmbert-base/onnx/*" "mmbert-base/tokenizer*" "mmbert-base/calibration.json" --local-dir ./proseguard
```
```python
import json, numpy as np, onnxruntime as ort
from huggingface_hub import snapshot_download
from transformers import AutoTokenizer
tier = "mmbert-base" # or "mmbert-small"
root = f"{snapshot_download('ElderRyan/proseguard', allow_patterns=[f'{tier}/onnx/*', f'{tier}/tokenizer*', f'{tier}/calibration.json'])}/{tier}"
tok = AutoTokenizer.from_pretrained(root)
cal = json.load(open(f"{root}/calibration.json"))["calibration"]
sess = ort.InferenceSession(f"{root}/onnx/model_int8.onnx", providers=["CPUExecutionProvider"])
enc = tok(["Paste English, Chinese, or Japanese text here."], truncation=True, max_length=2048, return_tensors="np")
logits, edit_rate, tok_probs, win_max = sess.run(None, {"input_ids": enc["input_ids"], "attention_mask": enc["attention_mask"]})
p = np.exp((s := logits[0] / cal["temperature"]) - s.max()); p /= p.sum()
ai_score = (1 - cal["window_blend"]) * (1 - p[0]) + cal["window_blend"] * max(1 - p[0], float(win_max[0]))
print({"ai_score": round(float(ai_score), 4), "human_assisted_ai": p.round(4).tolist()})
```
Browser WASM and WebGPU
```javascript
// ML tier: 679 KiB WASM
import './ml/wasm-loader.js';
await globalThis.ProseGuardWasm.initWasmEngine();
console.log(globalThis.ProseGuardWasm.analyzeArticle('Draft stays local.'));
// Small tier: 51.8 MB Q4 in a Web Worker
import { initProseGuardWeb, analyzeProseGuardWeb } from './mmbert-small/web/proseguard_web_worker.mjs';
await initProseGuardWeb('https://your-cdn.example.com/proseguard/mmbert-small');
console.log(await analyzeProseGuardWeb('Manuscript never leaves the browser.'));
```
Evaluation details
- OOD-2026 numbers use the shipped files (`onnx/model_int8.onnx`, `web/model_web_q4.onnx`, WASM), `max_length=1024`. CIs: 2,000 stratified bootstrap resamples (TPR, AUC) and Wilson intervals (ESL FPR). Scores and script: `eval_results/ood2026_modern_scores.json`, `src/eval_ood_ci.py`.
- `Oxidane/TMR` and `e5-small-lora` scores are the per-passage files TextSight ships with the dataset.
- Tier chart (N=1,400 per split, `seed=20261204`) uses PyTorch weights. C-ReD and AnxForever are held-out splits of sources seen in training. NLPCC-2025 was unseen by the neural tiers but its train split was used for `ProseGuard-ML`.
- We evaluated on OOD-2026 several times during development, so treat it as a validation set rather than a clean test set.
## Paper and citation
**ProseGuard (AIDetect): Three-Tier Client-to-Server Multilingual AI Text Detection from 679 KiB WebAssembly to Multi-Head mmBERT Verifiers**
Ryan Kung. RIST technical report `RIST-CS-AI-2026-03`, Rev. 2, December 4, 2026 (16 pages).
[Read on RIST](https://rist.edu.rs/papers/aidetect/) · [Download PDF](https://huggingface.co/ElderRyan/proseguard/resolve/main/paper/aidetect.pdf) · [LaTeX source](./paper/aidetect.tex) · [References](./paper/aidetect.bib) · [RIST project](https://rist.edu.rs/projects/#aidetect)
The report describes all three detection tiers, training and distillation, browser quantization, multilingual benchmarks, confidence intervals, and evaluation limitations.
```bibtex
@techreport{kung2026aidetect,
author = {Ryan Kung},
title = {ProseGuard (AIDetect): Three-Tier Client-to-Server Multilingual AI Text Detection from 679 KiB WebAssembly to Multi-Head mmBERT Verifiers},
institution = {Ryan Institute of Science and Technology (RIST)},
year = {2026},
number = {RIST-CS-AI-2026-03},
note = {Revision 2, 16 pages},
url = {https://rist.edu.rs/papers/aidetect/}
}
```
## Attribution
`mmbert-small` and `mmbert-base` fine-tune and distill [`jhu-clsp/mmBERT`](https://huggingface.co/jhu-clsp/mmBERT-base) (Marone et al., JHU CLSP, `arXiv:2509.06888`, MIT). Released under the [MIT License](./LICENSE).