Run this model with HF Jobs
Run ElderRyan/ProseGuard-mmBERT-small on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ElderRyan/ProseGuard-mmBERT-small. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ElderRyan/ProseGuard-mmBERT-small on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ElderRyan/ProseGuard-mmBERT-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ElderRyan/ProseGuard-mmBERT-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ElderRyan/ProseGuard-mmBERT-small")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ElderRyan/ProseGuard-mmBERT-small") model = AutoModelForMaskedLM.from_pretrained("ElderRyan/ProseGuard-mmBERT-small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("ElderRyan/ProseGuard-mmBERT-small")
model = AutoModelForMaskedLM.from_pretrained("ElderRyan/ProseGuard-mmBERT-small", device_map="auto")ProseGuard-mmBERT-small
ProseGuard-mmBERT-small is a compact, knowledge-distilled multilingual AI text detector and mixed-authorship span locator fine-tuned on top of the pretrained jhu-clsp/mmBERT-small encoder (Marone et al., 2025).
It supports up to 8,192 tokens of context and ships in three deployment formats:
- PyTorch SafeTensors (
model.safetensors,538 MB): Full 256,000-vocab FP32 weights. - Full-Vocab INT8 ONNX (
onnx/model_int8.onnx,136 MB): Drop-in CPU / CoreML / server runtime across allmmBERTlanguages. - Browser WASM SIMD & WebGPU Edition (
web/model_web_q4.onnx,51.8 MBraw /45.1 MiBgzip): Uses lossless 65,536-token EN/ZH/JA vocabulary compaction (web/vocab_remap_u16.bin) + 4-bitMatMulNBits+UINT8Gather quantization for 100% client-side browser execution.
Upstream Attribution & Multi-Head Extensions
- Pretrained Base Encoder:
jhu-clsp/mmBERT-small(mmBERT: A Modern Multilingual Encoder, Johns Hopkins University CLSP,arXiv:2509.06888, MIT License). - Downstream ProseGuard Architecture & Training:
- 3-Way Document + Edit-Intensity Head: Combines learned attention pooling, token-salience pooling, and mean pooling to predict
[P(Human), P(AI-Assisted), P(AI-Native)]alongside a continuous edit-intensity score $\hat{e} \in [0, 1]$. - Token-Level Span & 64-Token Sliding Window Head: Outputs per-token AI probabilities and peak 64-token window scores to catch localized AI insertions inside long human manuscripts.
- Online SpanMix & Asymmetric Low-FPR Distillation: Trained on commercially clean MIT / Apache-2.0 / CC-BY-SA multilingual corpora with online paragraph splicing (
SpanMix), format de-shortcutting,12xasymmetric false-positive penalties on mined hard human academic/technical prose, and multi-head KL + token MSE distillation fromElderRyan/ProseGuard-mmBERT-base.
- 3-Way Document + Edit-Intensity Head: Combines learned attention pooling, token-salience pooling, and mean pooling to predict
Benchmark
On OOD-2026 Modern (338 human vs 56 AI passages, 2026 generators), measured with the shipped files:
| Build | ROC-AUC | TPR@1%FPR (95% CI) | Claude Opus 5 @1%FPR | ESL papers flagged @0.5 |
|---|---|---|---|---|
onnx/model_int8.onnx (136 MB) |
0.998 | 94.6% (86 to 100) | 11/12 | 13.7% (25/183) |
web/model_web_q4.onnx (51.8 MB) |
0.988 | 76.8% (62 to 91) | 6/12 | 0.5% (1/183) |
Oxidane/tmr-ai-text-detector |
0.867 | 50.0% (38 to 70) | 0/12 | 13.1% (24/183) |
TextSight e5-small-lora |
0.671 | 25.0% (11 to 38) | 1/12 | 10.4% (19/183) |
The INT8 build scores high at 0.5 on many ESL papers, so calibrate your threshold on your own human text before use. The Q4 build loses about 18 points of recall to 4-bit quantization and vocabulary compaction.
Held-out splits (N=1,400, TPR@1%FPR, PyTorch weights): NLPCC-2025 Chinese 75.5%, C-ReD 96.8%, AnxForever 83.6% (light-polish subset 72.7%), RAID+MAGE English attacks 53.9%. Commercial APIs (GPTZero, Originality.ai, Pangram, ZeroGPT) have not been tested on this split. Full caveats: main Model Card.
Usage
1. ONNX Runtime (Python / Server / CLI, Zero PyTorch Dependency)
import json
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer
repo_dir = "./ProseGuard-mmBERT-small"
tokenizer = AutoTokenizer.from_pretrained(repo_dir)
cal = json.load(open(f"{repo_dir}/calibration.json"))["calibration"]
sess = ort.InferenceSession(f"{repo_dir}/onnx/model_int8.onnx", providers=["CPUExecutionProvider"])
text = "Paste any English or Chinese article here to inspect."
enc = tokenizer([text], truncation=True, max_length=2048, return_tensors="np")
logits_3way, edit_pred, token_probs, window_max = sess.run(
None, {"input_ids": enc["input_ids"], "attention_mask": enc["attention_mask"]}
)
scaled = logits_3way[0] / cal["temperature"]
probs = np.exp(scaled - scaled.max()) / np.exp(scaled - scaled.max()).sum()
doc_ai = float(1.0 - probs[0])
wb = cal["window_blend"]
combined_score = (1.0 - wb) * doc_ai + wb * max(doc_ai, float(window_max[0]))
print({"combined_ai_score": round(combined_score, 4), "probs_human_assisted_ai": probs.round(4).tolist()})
2. PyTorch (SafeTensors)
from safetensors.torch import load_file
from transformers import AutoTokenizer
from modeling_proseguard import ProseGuardModel
model = ProseGuardModel("jhu-clsp/mmBERT-small")
model.load_state_dict(load_file("model.safetensors"))
model.eval()
3. Browser WASM SIMD / WebGPU (51.8 MB Q4)
Host tokenizer.json, tokenizer_config.json, calibration.json, and web/* on static storage (e.g., Cloudflare R2 with CORS enabled), and import web/proseguard_web_worker.mjs:
import { initProseGuardWeb, analyzeProseGuardWeb } from './web/proseguard_web_worker.mjs';
await initProseGuardWeb('https://your-cdn-or-r2-domain.example.com/ProseGuard-mmBERT-small');
const result = await analyzeProseGuardWeb('Your manuscript stays 100% inside the browser.');
console.log(result);
Citations
If you use ProseGuard-mmBERT-small, please cite the upstream mmBERT pretrained encoder paper as well as ProseGuard:
@article{marone2025mmbert,
title={mmBERT: A Modern Multilingual Encoder},
author={Marone, Marc and Weller, Orion and Fleshman, William and Yang, Eugene and Lawrie, Dawn and Van Durme, Benjamin},
journal={arXiv preprint arXiv:2509.06888},
year={2025}
}
License
MIT License (see LICENSE).
- Downloads last month
- 35
Model tree for ElderRyan/ProseGuard-mmBERT-small
Base model
jhu-clsp/mmBERT-small
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ElderRyan/ProseGuard-mmBERT-small")