--- license: mit base_model: jhu-clsp/mmBERT-base language: - en - zh - ja - multilingual pipeline_tag: text-classification library_name: transformers tags: - ai-detection - machine-generated-text - modernbert - mmbert - onnx --- # ProseGuard-mmBERT-base **ProseGuard-mmBERT-base** is a high-precision multilingual AI text detector and token-level mixed-authorship attribution model fine-tuned on top of the pretrained [`jhu-clsp/mmBERT-base`](https://huggingface.co/jhu-clsp/mmBERT-base) encoder (Marone et al., 2025). It serves as the server-grade verifier and distillation teacher in the ProseGuard model family (alongside [`ElderRyan/ProseGuard-ML`](https://huggingface.co/ElderRyan/ProseGuard-ML) and [`ElderRyan/ProseGuard-mmBERT-small`](https://huggingface.co/ElderRyan/ProseGuard-mmBERT-small)): * **`model.safetensors` (`1.2 GB`)**: Full FP32 PyTorch weights. * **`onnx/model_int8.onnx` (`295.9 MB`)**: Single-file INT8 dynamically quantized ONNX graph (`~247 ms` CPU latency per article on Apple M1 Max, zero PyTorch runtime required). ## Upstream Attribution & Architecture * **Pretrained Base Encoder**: [`jhu-clsp/mmBERT-base`](https://huggingface.co/jhu-clsp/mmBERT-base) (*mmBERT: A Modern Multilingual Encoder*, Johns Hopkins University CLSP, `arXiv:2509.06888`, MIT License), supporting **8,192 tokens** via RoPE and alternating local/global bidirectional attention across a 256,000-token multilingual vocabulary. * **ProseGuard Multi-Head Extensions**: 1. **Document 3-Way + Continuous Edit-Intensity Head**: Concatenates attention-pooled, AI-salience-pooled, and mean-pooled hidden states to predict `[P(Human), P(AI-Assisted), P(AI-Native)]` and continuous edit intensity $\hat{e} \in [0, 1]$. 2. **Token-Level Attribution & 64-Token Sliding Window Max**: Predicts token-wise AI probabilities and peak 64-token window scores to prevent short AI insertions inside long human articles from being diluted by document-level averaging. 3. **Low-FPR Training Objective**: Trained exclusively on commercially clean MIT / Apache-2.0 / CC-BY-SA multilingual datasets using online `SpanMix` paragraph splicing, Markdown/punctuation de-shortcutting, and `12x` asymmetric false-positive penalties on mined hard human technical and academic prose. ## Benchmark ![OOD-2026 Modern same-split comparison](./assets/benchmark_hero.png) On OOD-2026 Modern (338 human vs 56 AI passages, 2026 generators), the shipped `onnx/model_int8.onnx` reaches 0.996 ROC-AUC and **96.4%** TPR@1%FPR, but the 95% CI is wide (46 to 100%) because the 1% threshold rests on about 3 human passages. It catches 10/12 Claude Opus 5 passages and flags 4.4% (8/183) of non-native PubMed papers at 0.5. For comparison, `Oxidane/TMR` gets 50.0% and `e5-small-lora` 25.0% on the same passages. Held-out splits (N=1,400, TPR@1%FPR, PyTorch weights): NLPCC-2025 Chinese **90.3%** (81.6% at 0.1% FPR), C-ReD 97.5%, AnxForever light-polish subset 74.2%, RAID+MAGE English attacks 50.7%. On English adversarial paraphrase, RAID leaderboard entries such as GPTZero (92.9%) and Desklib v1.01 (76.5%) report higher numbers on a different split. Commercial APIs (GPTZero, Originality.ai, Pangram, ZeroGPT) have not been tested on this split. Full caveats: [main Model Card](https://huggingface.co/ElderRyan/proseguard). ## Quick Start (ONNX Runtime) ```python import json import numpy as np import onnxruntime as ort from transformers import AutoTokenizer repo_dir = "./ProseGuard-mmBERT-base" 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." 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()}) ``` ## Citations Please cite the upstream `mmBERT` encoder paper when using this model: ```bibtex @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](LICENSE)).