Text Classification
Transformers
ONNX
Safetensors
modernbert
fill-mask
ai-detection
machine-generated-text
mmbert
text-embeddings-inference
Run this model with HF Jobs
Run ElderRyan/ProseGuard-mmBERT-base 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-base. 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-base 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-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ElderRyan/ProseGuard-mmBERT-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ElderRyan/ProseGuard-mmBERT-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("ElderRyan/ProseGuard-mmBERT-base") model = AutoModelForMaskedLM.from_pretrained("ElderRyan/ProseGuard-mmBERT-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from ElderRyan/ProseGuard-mmBERT-base: direct link, hf CLI and curl.
- Browser
- Download file 4.77 kB
-
https://huggingface.co/ElderRyan/ProseGuard-mmBERT-base/resolve/main/README.md
- Command line
-
hf download hf://ElderRyan/ProseGuard-mmBERT-base/README.md
-
curl -L -o README.md https://huggingface.co/ElderRyan/ProseGuard-mmBERT-base/resolve/main/README.md
4.77 kB
| 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 | |
|  | |
| 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)). | |