Text Classification
Transformers
ONNX
Safetensors
ai-detection
machine-generated-text
knowledge-distillation
modernbert
mmbert
webgpu
webassembly
lightgbm
treeshap
Run this model with HF Jobs
Run ElderRyan/proseguard 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. 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 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 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ElderRyan/proseguard with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ElderRyan/proseguard")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ElderRyan/proseguard", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Publish ProseGuard Rev. 2 paper and RIST links
Browse filesAdd the 16-page institutional report, LaTeX source, and bibliography. Link the model card to the paper and RIST project entry, with a BibTeX citation.
Files changed (5)
- .gitattributes+1
- README.md+22
- paper/aidetect.bibAdded+201
- paper/aidetect.pdfAdded+3
- paper/aidetect.texAdded+537
5 unmodified lines67895 unmodified linesassets/benchmark_hero.png filter=lfs diff=lfs merge=lfs -textassets/pareto_multilingual.png filter=lfs diff=lfs merge=lfs -textassets/benchmarks_tiers.png filter=lfs diff=lfs merge=lfs -textpaper/aidetect.pdf filter=lfs diff=lfs merge=lfs -text30 unmodified lines3132333435363778 unmodified lines11611711811912012112212312412512612712812913013113213313413513613713813914014114230 unmodified lines
[](https://aidetect.rist.edu.rs)[](https://prosegrain.com)[](https://rist.edu.rs/papers/aidetect/)[](./LICENSE)[](#pick-your-tier)
78 unmodified lines
</details>
## 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).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201@inproceedings{mitchell2023detectgpt, title = {{DetectGPT}: Zero-Shot Machine-Generated Text Detection using Probability Curvature}, author = {Mitchell, Eric and Lee, Yoonho and Khazatsky, Alexander and Manning, Christopher D. and Finn, Chelsea}, booktitle = {Proceedings of the 40th International Conference on Machine Learning (ICML)}, pages = {24950--24962}, year = {2023}}
@inproceedings{bao2024fastdetectgpt, title = {{Fast-DetectGPT}: Efficient Zero-Shot Detection of Machine-Generated Text via Conditional Probability Curvature}, author = {Bao, Guangsheng and Zhao, Yanbin and Teng, Zhiyang and Yang, Linyi and Zhang, Yue}, booktitle = {International Conference on Learning Representations (ICLR)}, year = {2024}}
@inproceedings{hans2024binoculars, title = {Spotting {LLMs} With Binoculars: Zero-Shot Detection of Machine-Generated Text}, author = {Hans, Abhimanyu and Schwarzschild, Avi and Cherepanova, Valeriia and Kazemi, Hamid and Saha, Aniruddha and Goldblum, Micah and Geiping, Jonas and Goldstein, Tom}, booktitle = {Proceedings of the 41st International Conference on Machine Learning (ICML)}, year = {2024}}
@inproceedings{gehrmann2019gltr, title = {{GLTR}: Statistical Detection and Visualization of Generated Text}, author = {Gehrmann, Sebastian and Strobelt, Hendrik and Rush, Alexander M.}, booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations}, pages = {111--116}, year = {2019}}
@article{liang2023gptbiased, title = {{GPT} Detectors Are Biased Against Non-Native {English} Writers}, author = {Liang, Weixin and Yuksekgonul, Mert and Mao, Yining and Wu, Eric and Zou, James}, journal = {Patterns}, volume = {4}, number = {7}, pages = {100779}, year = {2023}}
@inproceedings{liang2024monitoring, title = {Monitoring {AI}-Modified Content at Scale: A Case Study on the Impact of {ChatGPT} on {AI} Conference Peer Reviews}, author = {Liang, Weixin and Izzo, Zachary and Zhang, Yaohui and Lepp, Haley and Cao, Hancheng and Zhao, Xuandong and Chen, Lingjiao and Ye, Haotian and Liu, Sheng and Huang, Zhi and McFarland, Daniel A. and Zou, James Y.}, booktitle = {Proceedings of the 41st International Conference on Machine Learning (ICML)}, year = {2024}}
@article{diveye2025, title = {{DivEye}: Surprising Rhythm Over Raw Perplexity for Robust Machine-Generated Text Detection}, author = {Basani, Sai and Chen, Pin-Yu}, journal = {Transactions on Machine Learning Research (TMLR)}, year = {2025}}
@misc{zippy2023, title = {{ZipPy}: Fast {AI}/LLM Text Detection via Compression Ratios}, author = {{Thinkst Applied Research}}, howpublished = {\url{https://github.com/thinkst/zippy}}, year = {2023}}
@inproceedings{wang2012nbsvm, title = {Baselines and Bigrams: Simple, Good Sentiment and Topic Classification}, author = {Wang, Sida and Manning, Christopher D.}, booktitle = {Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics (ACL)}, pages = {90--94}, year = {2012}}
@inproceedings{weinberger2009featurehashing, title = {Feature Hashing for Large Scale Multitask Learning}, author = {Weinberger, Kilian and Dasgupta, Anirban and Langford, John and Smola, Alex and Attenberg, Josh}, booktitle = {Proceedings of the 26th International Conference on Machine Learning (ICML)}, pages = {1113--1120}, year = {2009}}
@inproceedings{ke2017lightgbm, title = {{LightGBM}: A Highly Efficient Gradient Boosting Decision Tree}, author = {Ke, Guolin and Meng, Qi and Finley, Thomas and Wang, Taifeng and Chen, Wei and Ma, Weidong and Ye, Qiwei and Liu, Tie-Yan}, booktitle = {Advances in Neural Information Processing Systems (NeurIPS)}, volume = {30}, year = {2017}}
@article{lundberg2020treeshap, title = {From Local Explanations to Global Understanding with Explainable {AI} for Trees}, author = {Lundberg, Scott M. and Erion, Gabriel and Chen, Hugh and DeGrave, Alex and Prutkin, Jordan M. and Nair, Bala and Katz, Ronit and Himmelfarb, Jonathan and Bansal, Nisha and Lee, Su-In}, journal = {Nature Machine Intelligence}, volume = {2}, number = {1}, pages = {56--67}, year = {2020}}
@inproceedings{dugan2024raid, title = {{RAID}: A Shared Benchmark for Robust Evaluation of Machine-Generated Text Detectors}, author = {Dugan, Liam and Hwang, Alyssa and Trhl{\'\i}k, Filip and Ludan, Josh Magnus and Zhu, Andrew and Xu, Hainiu and Ippolito, Daphne and Callison-Burch, Chris}, booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (ACL)}, pages = {12463--12492}, year = {2024}}
@inproceedings{li2024mage, title = {{MAGE}: Machine-Generated Text Detection in the Wild}, author = {Li, Yafu and Li, Qintong and Cui, Leyang and Bi, Wei and Wang, Zhilin and Wang, Longyue and Yang, Linyi and Shi, Shuming and Zhang, Yue}, booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (ACL)}, pages = {36--53}, year = {2024}}
@article{guo2023hc3, title = {How Close is {ChatGPT} to Human Experts? Comparison Corpus, Evaluation, and Detection}, author = {Guo, Biyang and Zhang, Xin and Wang, Ziyuan and Jiang, Minqi and Nie, Jinran and Ding, Yuxuan and Yue, Jianwei and Wu, Yupeng}, journal = {arXiv preprint arXiv:2301.07597}, year = {2023}}
@article{watts1998collective, title = {Collective Dynamics of `Small-World' Networks}, author = {Watts, Duncan J. and Strogatz, Steven H.}, journal = {Nature}, volume = {393}, number = {6684}, pages = {440--442}, year = {1998}}
@article{newman2002assortative, title = {Assortative Mixing in Networks}, author = {Newman, Mark E. J.}, journal = {Physical Review Letters}, volume = {89}, number = {20}, pages = {208701}, year = {2002}}
@article{hurst1951longterm, title = {Long-Term Storage Capacity of Reservoirs}, author = {Hurst, Harold Edwin}, journal = {Transactions of the American Society of Civil Engineers}, volume = {116}, number = {1}, pages = {770--799}, year = {1951}}
@inproceedings{zadrozny2002calibration, title = {Transforming Classifier Scores into Accurate Multiclass Probability Estimates}, author = {Zadrozny, Bianca and Elkan, Charles}, booktitle = {Proceedings of the 8th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining}, pages = {694--699}, year = {2002}}
@article{covington2010mattr, title = {Cutting the {Gordian} Knot: The Moving-Average Type--Token Ratio ({MATTR})}, author = {Covington, Michael A. and McFall, Joe D.}, journal = {Journal of Quantitative Linguistics}, volume = {17}, number = {2}, pages = {94--100}, year = {2010}}
@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}}
@article{warner2024modernbert, title = {Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference}, author = {Warner, Benjamin and Chaffin, Antoine and Clavi{\'e}, Benjamin and Weller, Orion and Hallstr{\"o}m, Oskar and Taghadouini, Said and Gallagher, Alexis and Biswas, Raja and Ladhak, Faisal and Aarsen, Tom and Cooper, Nathan and Adams, Griffin and Howard, Jeremy and Poli, Iacopo}, journal = {arXiv preprint arXiv:2412.13663}, year = {2024}}
@misc{textsight2026aidetection, title = {{AI} Text Detection: A Control Set That Does Not Flatter Detectors}, author = {{TextSight}}, year = {2026}, howpublished = {\url{https://huggingface.co/datasets/textsightai/ai-text-detection-benchmark-2026}}}
@inproceedings{hu2023radar, title = {{RADAR}: Robust {AI}-Text Detection via Adversarial Learning}, author = {Hu, Xiaomeng and Chen, Pin-Yu and Ho, Tsung-Yi}, booktitle = {Advances in Neural Information Processing Systems (NeurIPS)}, volume = {36}, year = {2023}}
@misc{desklib2025detector, title = {{Desklib} {AI} Text Detector v1.01}, author = {{Desklib}}, year = {2025}, howpublished = {\url{https://huggingface.co/desklib/ai-text-detector-v1.01}}}123version https://git-lfs.github.com/spec/v1oid sha256:3571a33e3ec65e1ec29c0b3c09af756afaea4968d028e88a41e3a81a5fbebc49size 682617123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}\usepackage{lmodern}\usepackage{microtype}\emergencystretch=1.5em\usepackage[margin=0.95in]{geometry}\usepackage{amsmath,amssymb,amsthm,mathtools}\usepackage{booktabs,array,multirow}\usepackage{enumitem}\usepackage{xcolor}\usepackage{tikz}\usetikzlibrary{arrows.meta,positioning,fit,backgrounds,calc}\PassOptionsToPackage{hyphens}{url}\usepackage[colorlinks=true,linkcolor=blue!60!black,citecolor=blue!60!black,urlcolor=blue!60!black, pdftitle={ProseGuard (AIDetect): Three-Tier Client-to-Server Multilingual AI Text Detection from 679 KiB WebAssembly to Multi-Head mmBERT Verifiers}, pdfauthor={Ryan Kung}]{hyperref}
\theoremstyle{definition}\newtheorem{definition}{Definition}[section]
\theoremstyle{plain}\newtheorem{proposition}[definition]{Proposition}
\theoremstyle{remark}\newtheorem{remark}[definition]{Remark}
\newcommand{\code}[1]{\texttt{#1}}
\title{\vspace{-0.8em}\textbf{ProseGuard (AIDetect): Three-Tier Client-to-Server Multilingual AI Text Detection from $679\,\text{KiB}$ WebAssembly to Multi-Head \texttt{mmBERT} Verifiers}\vspace{-0.2em}}\author{\textbf{Ryan Kung}\\[0.2em]{\normalsize Ryan Institute of Science and Technology}\\[0.08em]{\footnotesize\textsc{Non-Profit Private Academic Institution} $\cdot$ \href{https://rist.edu.rs/}{\texttt{rist.edu.rs}}}}\date{\small Technical Report \texttt{RIST-CS-AI-2026-03} (Rev.\ 2) $\cdot$ December 4, 2026\\[0.1em]\footnotesize\href{https://rist.edu.rs/papers/aidetect/}{\texttt{rist.edu.rs/papers/aidetect/}} $\cdot$ Weights: \href{https://huggingface.co/ElderRyan/proseguard}{\texttt{huggingface.co/ElderRyan/proseguard}} $\cdot$ Live: \href{https://prosegrain.com/}{\texttt{prosegrain.com}}\vspace{-0.4em}}
\begin{document}\maketitle
\begin{abstract}High-accuracy detectors for machine-generated text typically rely on multi-gigabyte neural language models (such as DetectGPT, Fast-DetectGPT, and Binoculars) or proprietary cloud APIs (such as ZeroGPT, GPTZero, and Originality.ai) that require uploading raw manuscripts to remote servers. Both choices create practical barriers for confidential drafts, peer review, and browser-local inspection. Conversely, lightweight non-neural heuristics based on raw compression ratios or uncalibrated sentence variance collapse under domain shift and frontier post-training.
We present \textsc{ProseGuard} (building on our \textsc{AIDetect} WebAssembly core), an open-weight, MIT-licensed multilingual detection suite spanning three progressive deployment tiers inside a single unified repository (\url{https://huggingface.co/ElderRyan/proseguard}): \textbf{Tier~1} (\textsc{ProseGuard-ML}), a dependency-free $679\,\text{KiB}$ ($389\,\text{KiB}$ gzipped) Rust and WebAssembly engine executing in $1.1$ to $27.0\,\text{ms}$ per document; \textbf{Tier~2} (\textsc{ProseGuard-mmBERT-small}), a distilled multi-head neural verifier exported both as a $51.8\,\text{MB}$ ($45.1\,\text{MiB}$ gzipped) $4$-bit browser WebGPU/Wasm package and a $136\,\text{MB}$ \code{INT8} edge/server model; and \textbf{Tier~3} (\textsc{ProseGuard-mmBERT-base}), a $22$-layer, $8{,}192$-token server verifier ($295.9\,\text{MB}$ \code{INT8}). Tier~1 maps input text onto a $28$-dimensional orthogonal statistical basis (\textsf{Dual-PPM}, concave Mixture MLE $\hat{\alpha}$, DivEye surprisal dynamics with $R/S$ Hurst exponent, word co-occurrence topology, script-isolated \textsf{NBSVM}, and cadence forensics) paired with out-of-fold LightGBM, Isotonic-Platt calibration, and stack-allocated exact \textsf{TreeSHAP}. Tiers~2 and~3 extend Johns Hopkins CLSP's pretrained \code{mmBERT} encoder with tri-pooled $3$-way document classification (\emph{Human}, \emph{AI-Assisted}, \emph{AI-Native}), continuous edit-intensity regression, a branch-free $64$-token sliding-window span detector trained via online \textsf{SpanMix}, and an asymmetric squared low-FPR hinge penalty over $495{,}571$ commercially clean passages.
On a $12{,}914$-document held-out test set, Tier~1 reaches $0.9700$ ROC-AUC ($73.64\%$ TPR at $1\%$ FPR, $0.0071$ ECE) in single-digit milliseconds. On TextSight's 2026 modern-human benchmark (\code{OOD-2026 Modern}, $338$ human vs.\ $56$ AI passages), the shipped $136\,\text{MB}$ \code{INT8} \textsc{ProseGuard-mmBERT-small} reaches $0.9977$ ROC-AUC and $94.6\%$ TPR@1\%FPR (bootstrap 95\% CI $85.7$--$100\%$), compared with $50.0\%$ for \code{Oxidane/TMR} and $25.0\%$ for \code{e5-small-lora} on the same passages. The sample is small and CIs are wide, commercial APIs were not evaluated on this split, and on English adversarial paraphrase (RAID+MAGE) our tiers reach only $50.7\%$--$53.9\%$ TPR@1\%FPR, below published RAID leaderboard results for GPTZero and Desklib.\end{abstract}
\section{Introduction}\label{sec:intro}
Current methods for detecting machine-generated text split into two regimes with incompatible deployment trade-offs:\begin{enumerate}[label=\textbf{(\arabic*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{Server-Side Neural Scoring and Fine-Tuned Classifiers:} Zero-shot probability-curvature detectors such as DetectGPT~\cite{mitchell2023detectgpt}, Fast-DetectGPT~\cite{bao2024fastdetectgpt}, GLTR~\cite{gehrmann2019gltr}, and Binoculars~\cite{hans2024binoculars} query one or two multi-billion-parameter causal language models to compare token log-probabilities against local perturbations or cross-model expectations. Supervised neural detectors fine-tune RoBERTa, DeBERTa, or Qwen backbones on benchmark corpora~\cite{dugan2024raid,li2024mage}. Both approaches require GPU memory measured in gigabytes and force users of web tools to transmit unpublished manuscripts, internal memos, or student submissions to third-party servers. \item \textbf{Lightweight Non-Neural Heuristics:} Browser-local or CPU-only tools often fall back on single-file Lempel--Ziv compression ratios (e.g., ZipPy~\cite{zippy2023}), raw sentence-length variance, or static lists of RLHF transition phrases (``delve into,'' ``it is important to note''). As our baseline experiments confirm (Section~\ref{sec:eval}), unconditioned LZ77 ratios reach only $0.6370$ ROC-AUC ($1.53\%$ TPR at $1\%$ FPR) and invert below random guessing ($0.3557$ AUC) under length and genre shifts, while uncalibrated perplexity and burstiness rules systematically misclassify non-native English (ESL) academic writing~\cite{liang2023gptbiased} and structured technical prose.\end{enumerate}
This paper asks two linked systems and statistical questions: \emph{(1) how close can a sub-megabyte, zero-LLM browser engine get to server-grade accuracy and calibration across English, Simplified Chinese, Traditional Chinese, and Japanese; and (2) when frontier models suppress surface RLHF giveaways, can a compact multi-head neural verifier close the remaining recall gap while still fitting inside browser WebGPU/Wasm memory and maintaining $\le 1\%$ false positives on non-native human writers?}
We design, train, and release \textsc{ProseGuard} (open weights at \url{https://huggingface.co/ElderRyan/proseguard}; live client-side systems at \url{https://prosegrain.com/} and \url{https://aidetect.rist.edu.rs}), unifying our $679\,\text{KiB}$ \textsc{AIDetect} statistical engine (\textsc{ProseGuard-ML}, Tier~1) with two distilled multi-head neural verifiers (\textsc{ProseGuard-mmBERT-small}, Tier~2, and \textsc{ProseGuard-mmBERT-base}, Tier~3). Our main technical contributions are:\begin{itemize}[leftmargin=1.8em,itemsep=2pt] \item \textbf{Compact Orthogonal Feature Basis ($28\text{D}$ in $320\,\text{KiB}$ Tables):} Rather than relying on a single Compression or N-gram score, we combine six complementary statistical views over a fixed $65{,}536$-bucket memory layout (\code{ml\_tables.bin}, $327{,}696\,\text{bytes}$): a $3$-order dual-distribution Markov model (\textsf{Dual-PPM}), Liang et al.'s distributional mixture fraction $\hat{\alpha}$~\cite{liang2024monitoring} solved via concave Newton--Raphson iteration, $9\text{D}$ surprisal rhythm derivatives~\cite{diveye2025} augmented with a Rescaled-Range ($R/S$) Hurst exponent~\cite{hurst1951longterm}, word co-occurrence small-world clustering~\cite{watts1998collective} and degree assortativity~\cite{newman2002assortative}, a formatting-invariant signed feature-hashed \textsf{NBSVM}~\cite{weinberger2009featurehashing,wang2012nbsvm}, and decimal-safe stylometric cadence and Unicode watermark scans. \item \textbf{Zero-Byte Cross-Script Homomorphism and Kana Salt Isolation:} Shared $65{,}536$-bucket hash tables suffer severe collisions when mixing scripts: Traditional Chinese characters miss Simplified Chinese buckets unless tables are duplicated, while Japanese Kanji collide directly with Chinese Hanzi of opposite stylistic polarity. We resolve both in $O(1)$ space via a compile-time Traditional-to-Simplified CJK projection ($99.41\%$ AUC on Traditional Chinese with zero additional table bytes) and a document-level Kana script salt (\code{0x4A41\_0000}) that isolates Japanese Kanji buckets whenever Hiragana or Katakana are present. \item \textbf{Out-of-Fold Soft-Label Boosting and Causal Topic Deconfounding:} Training GBDT trees on the same fold used to populate $65{,}536$-bucket likelihood tables causes severe overfitting to in-fold margins. We enforce a disjoint two-stage split across $120{,}892$ training documents, generalize both Level-1 tables and Level-2 LightGBM~\cite{ke2017lightgbm} to continuous soft targets $y \in [0, 1]$ for co-authored human+AI articles, fit a tail-blended Isotonic and Platt calibrator~\cite{zadrozny2002calibration} that cuts Expected Calibration Error (ECE) in half ($0.0160 \to 0.0071$), and show how topic-matched pre-2021 human corpora eliminate domain-vocabulary false positives ($54.0\% \to 10.9\%$ on human cryptography prose) without sacrificing domain AI recall ($97.0\%$--$99.7\%$). \item \textbf{Stack-Allocated Exact \textsf{TreeSHAP} and Integrity Attestation in Wasm:} We implement exact path-dependent \textsf{TreeSHAP}~\cite{lundberg2020treeshap} in pure safe Rust using fixed stack buffers (\code{MAX\_PATH\_DEPTH = 16}, zero heap allocations per tree node), verified to satisfy exact local accuracy $f(x) = \phi_0 + \sum_{j=1}^{28} \phi_j(x)$ within $10^{-8}$, paired with browser WebCrypto SHA-256 and IEEE 802.3 CRC32 self-tests. \item \textbf{Multi-Head \code{mmBERT} Distillation and $51.8\,\text{MB}$ Browser \code{Q4} Compaction:} To catch frontier models that evade surface N-gram tables (such as \code{claude-opus-5} and \code{qwen-3.8-27b}), we build Tiers~2 and~3 on Johns Hopkins CLSP's $8{,}192$-token \code{mmBERT} encoder~\cite{marone2025mmbert}, adding tri-pooled $3$-way document classification, continuous edit-intensity regression, a branch-free $64$-token sliding-window span detector supervised via online \textsf{SpanMix}, and an asymmetric low-FPR hinge loss across $495{,}571$ MIT/Apache/CC-BY-SA documents. Distilling \code{mmBERT-base} into \code{mmBERT-small} and compacting the $256\text{K}$ vocabulary into an $O(1)$ $65{,}536$-token \code{uint16} table yields a $51.8\,\text{MB}$ $4$-bit browser ONNX model ($76.8\%$ TPR@1\%FPR on \code{OOD-2026 Modern}, against $25.0\%$ for the \code{e5-small-lora} browser baseline), while the $136\,\text{MB}$ and $295.9\,\text{MB}$ \code{INT8} tiers reach $94.6\%$ and $96.4\%$, with wide confidence intervals.\end{itemize}
\section{Architecture and Packed Level-1 Statistical Tables}\label{sec:arch}
Figure~\ref{fig:pipeline} illustrates the two-stage offline training pipeline and the single-pass client-side WebAssembly execution path. Let an input document be a validated UTF-8 string $x$ of byte length $|x| \le 524{,}288$ ($512\,\text{KiB}$) containing at least $12$ non-whitespace Unicode scalar values.
\begin{figure}[t]\centering\resizebox{\textwidth}{!}{%\begin{tikzpicture}[ font=\footnotesize, box/.style={draw=black!75, rounded corners=2pt, align=center, inner sep=4.5pt, fill=gray!6}, wbox/.style={draw=blue!65!black, rounded corners=2pt, align=center, inner sep=4.5pt, fill=blue!4}, arr/.style={-{Stealth[length=2.2mm,width=1.6mm]}, semithick, draw=black!75}] \node[box, minimum width=2.3cm] (input) {UTF-8 Document $x$\\(EN / ZH / JA)}; \node[wbox, right=0.5cm of input, minimum width=3.1cm] (tables) {Level-1 Hashed Tables\\(\code{ml\_tables.bin}, $320\,\text{KiB}$)\\Dual-PPM $\cdot$ MLE $\cdot$ NBSVM}; \node[box, below=0.42cm of tables, minimum width=3.1cm] (struct) {Zero-Table Analyzers\\DivEye $9\text{D}$ + Hurst $H$\\Co-occur Graph + Cadence}; \node[box, right=0.55cm of $(tables.east)!0.5!(struct.east)$, minimum width=2.3cm] (vec) {Orthogonal Basis\\$\mathbf{z}(x) \in \mathbb{R}^{28}$\\+ Sent.\ Margins}; \node[wbox, right=0.5cm of vec, minimum width=3.0cm] (gbdt) {Calibrated LightGBM\\(\code{gbdt\_forest.bin}, $154\,\text{KiB}$)\\$115$ Trees + Exact TreeSHAP};
\draw[arr] (input.east) -- (tables.west); \draw[arr] (input.south) |- (struct.west); \draw[arr] (tables.east) -| ([xshift=-0.24cm]vec.west) -- (vec.west); \draw[arr] (struct.east) -| ([xshift=-0.24cm]vec.west) -- (vec.west); \draw[arr] (vec.east) -- (gbdt.west);\end{tikzpicture}%}\caption{Single-pass client-side inference pipeline inside the $679\,\text{KiB}$ WebAssembly module. Both embedded weight artifacts (\code{ml\_tables.bin} and \code{gbdt\_forest.bin}) are immutable \code{include\_bytes!} slices with zero runtime deserialization heap overhead.}\label{fig:pipeline}\end{figure}
\subsection{Cross-Script Tokenization and Namespace Isolation}\label{sec:script}
A practical browser detector must handle alphabetic scripts (English), ideographic scripts without word spaces (Simplified and Traditional Chinese), and mixed scripts combining Kanji with syllabaries (Japanese Hiragana and Katakana) without shipping four separate multi-megabyte vocabularies. We first classify the dominant script family of $x$ via the CJK-and-Kana character share $\rho_{\mathrm{cjk}}(x) \in [0, 1]$, and apply two deterministic projections prior to feature hashing:\begin{enumerate}[label=\textbf{(\roman*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{Zero-Byte Traditional-to-Simplified Projection ($\pi_{\mathrm{cjk}}$):} High-frequency Traditional Chinese function characters and grammatical markers (such as \code{U+9019}$\to$\code{U+8FD9} [\emph{zh\`e}], \code{U+5011}$\to$\code{U+4EEC} [\emph{men}], \code{U+500B}$\to$\code{U+4E2A} [\emph{g\`e}], \code{U+70BA}$\to$\code{U+4E3A} [\emph{w\'ei}], \code{U+8207}$\to$\code{U+4E0E} [\emph{y\v{u}}], \code{U+5C0D}$\to$\code{U+5BF9} [\emph{du\`i}], \code{U+8AAA}$\to$\code{U+8BF4} [\emph{shu\=o}], and $130+$ core orthographic pairs) are mapped to their canonical Simplified codepoints before hashing. Because Traditional and Simplified Chinese share syntactic and RLHF discourse structures modulo character glyph choice, $\pi_{\mathrm{cjk}}$ transfers statistical power trained on large Simplified Chinese corpora directly to Traditional Chinese with zero extra memory. \item \textbf{Japanese Kana Salt Isolation:} Japanese prose uses hundreds of Kanji codepoints identical to Chinese Hanzi in \code{U+4E00}--\code{U+9FFF}, but with completely different unigram and bigram transition statistics. Without namespace separation, Japanese Kanji land in Chinese hash buckets and inherit spurious log-odds weights. Let $\mathbb{I}_{\mathrm{kana}}(x) \in \{0, 1\}$ indicate whether $x$ contains any Hiragana (\code{U+3040}--\code{U+309F}) or Katakana (\code{U+30A0}--\code{U+30FF}) scalar. Whenever $\mathbb{I}_{\mathrm{kana}}(x) = 1$, every token unit and N-gram hash in $x$ is XOR-salted with \code{0x4A41\_0000}, routing Japanese text to a collision-isolated virtual subspace within the same $B = 2^{16} = 65{,}536$ bucket array.\end{enumerate}
Tokenization produces a stream of $32$-bit unit hashes $u_1, \dots, u_T$ via $64$-bit SplitMix64 mixing (\code{0x9E3779B97F4A7C15}, avalanche multipliers \code{0xBF58476D1CE4E5B9} and \code{0x94D049BB133111EB}): lowercase alphanumeric words for alphabetic spans and individual canonicalized ideographs/kana for CJK spans.
\subsection{Packed \texorpdfstring{$320\,\text{KiB}$}{320 KiB} Binary Table Layout (\texorpdfstring{\code{ml\_tables.bin}}{ml\_tables.bin})}\label{sec:tables}
To keep cache footprint inside L2 cache and avoid floating-point bloat in Wasm, all three corpus-trained Level-1 models share $B = 65{,}536$ buckets packed into an exact $327{,}696$-byte binary layout:{\small\[\underbrace{16\text{ B}}_{\text{Header}}\;+\;\underbrace{65{,}536 \times 2\text{ B}}_{\text{Dual-PPM }(\text{i8}, \text{u8})}\;+\;\underbrace{65{,}536 \times 2\text{ B}}_{\text{Mixture MLE }(\text{u8}^2)}\;+\;\underbrace{65{,}536 \times 1\text{ B}}_{\text{NBSVM }(\text{i8})}\;=\; 327{,}696\text{ B}.\]}
\paragraph{1. Dual-Distribution Hashed PPM (\textsf{Dual-PPM}).}In server-side detectors such as Fast-DetectGPT~\cite{bao2024fastdetectgpt} and Binoculars~\cite{hans2024binoculars}, machine generation is detected because tokens sampled from an LLM concentrate in high-probability regions of the model's conditional distribution relative to human writing. We approximate conditional cross-entropy divergence without neural weights using orders $k \in \{1, 2, 3\}$ hashed Markov transitions. On Fold-A training documents with soft AI target $y_d \in [0, 1]$, each transition tuple $(u_{t-k}, \dots, u_t)$ hashes with order-specific seed $S_k$ into bucket $b \in \{0, \dots, B-1\}$, accumulating AI weight $C_{A}[b] += y_d$ and human weight $C_{H}[b] += (1 - y_d)$. With Laplace smoothing $\lambda = 2$ and empirical Bayes shrinkage $s_b = \frac{n_b}{n_b + 20}$ where $n_b = C_H[b] + C_A[b]$, the shrunk log-likelihood ratio in bits is:\begin{equation}\mathrm{LLR}_{\mathrm{PPM}}[b] \;=\; \frac{n_b}{n_b + 20} \log_2 \!\left( \frac{(C_A[b] + \lambda) / (\sum_{b'} C_A[b'] + \lambda B)}{(C_H[b] + \lambda) / (\sum_{b'} C_H[b'] + \lambda B)} \right),\label{eq:ppm}\end{equation}quantized as $\mathrm{round}(24 \cdot \mathrm{LLR}_{\mathrm{PPM}}[b]) \in [-127, 127]$ (\code{i8}). Simultaneously, using parent context counts $C_H^{\mathrm{ctx}}[c]$, we compute the empirical human conditional Shannon surprisal $I_H(u_t \mid \mathrm{ctx}) = -\log_2 \frac{C_H[b] + 1}{C_H^{\mathrm{ctx}}[c] + \kappa_k}$ (in bits, shrunk toward an unseen-transition prior of $6.8\,\text{bits}$ and quantized at $1/18$-bit resolution into \code{u8}). At inference time, a single linear pass over $u_1, \dots, u_T$ blends available context orders ($0.25\,\text{ord}_1 + 0.35\,\text{ord}_2 + 0.40\,\text{ord}_3$) to emit both document-level LLR statistics ($z_0, z_1, z_2$), $85$th-percentile sentence LLR ($z_3$), and a per-token conditional surprisal stream $s_1, \dots, s_{T-1}$ for DivEye dynamics.
\paragraph{2. Concave Distributional Mixture MLE ($\hat{\alpha}$).}Following Liang et al.~\cite{liang2024monitoring}, a partially edited or hybrid document can be modeled as an i.i.d.\ mixture of human token/bigram distribution $P$ and AI distribution $Q$ with mixing proportion $\alpha \in [0, 1]$. For each bucket $b$, we store Dirichlet-smoothed, empirical-Bayes-shrunk negative log-likelihoods $(-\ln P(b), -\ln Q(b)) \in [2.0, 14.75]^2$ at $0.05$-nat resolution (\code{u8}). Given observed unigrams and bigrams $b_1, \dots, b_m$ in test document $x$ with $p_i = P(b_i)$ and $q_i = Q(b_i)$, the log-likelihood of mixture parameter $\alpha \in [0, 1]$ is:\begin{equation}\ell(\alpha) \;=\; \sum_{i=1}^{m} \ln\bigl((1 - \alpha) p_i + \alpha q_i\bigr).\label{eq:mle}\end{equation}
\begin{proposition}[Global Concavity and Convergence of Mixture Solver]\label{prop:mle}For any positive sequences $p_i, q_i > 0$ ($i = 1, \dots, m$), $\ell(\alpha)$ is smooth and concave on $[0, 1]$, and strictly concave whenever $p_i \neq q_i$ for at least one $i$. Consequently, projected damped Newton--Raphson iteration starting from $\alpha^{(0)} = 0.5$ converges to the unique global maximizer $\hat{\alpha} = \arg\max_{\alpha \in [0,1]} \ell(\alpha)$.\end{proposition}\begin{proof}Differentiating~\eqref{eq:mle} twice with respect to $\alpha \in [0, 1]$ yields\[\ell'(\alpha) \;=\; \sum_{i=1}^{m} \frac{q_i - p_i}{(1 - \alpha) p_i + \alpha q_i},\qquad\ell''(\alpha) \;=\; -\sum_{i=1}^{m} \left(\frac{q_i - p_i}{(1 - \alpha) p_i + \alpha q_i}\right)^{\!2} \;\le\; 0,\]because the denominator $(1 - \alpha)p_i + \alpha q_i \ge \min(p_i, q_i) > 0$ on $[0, 1]$. If $q_{i^*} \neq p_{i^*}$ for some $i^*$, the $i^*$-th squared term is strictly positive, so $\ell''(\alpha) < 0$ everywhere on $[0, 1]$ and $\hat{\alpha} \in [0, 1]$ is unique.\end{proof}
In \textsc{AIDetect}, $12$ iterations of damped Newton--Raphson update $\alpha^{(t+1)} = \Pi_{[0,1]}\bigl[\alpha^{(t)} - \ell'(\alpha^{(t)}) / (\ell''(\alpha^{(t)}) - 10^{-9})\bigr]$ (stopping early when $|\Delta \alpha| < 10^{-5}$) take $< 40\,\mu\text{s}$ and yield $\hat{\alpha}$ ($z_{17}$) alongside mean mixture log-likelihood ratio ($z_{18}$).
\paragraph{3. Formatting-Invariant Feature-Hashed \textsf{NBSVM}.}Surface lexical and syntactic preferences (such as RLHF contrastive scaffolds, participial clause openings, and subword stems) are captured via Weinberger et al.'s signed feature hashing~\cite{weinberger2009featurehashing} combined with sublinear TF scaling~\cite{wang2012nbsvm}. Early prototypes revealed an important pitfall: if paragraph breaks or Markdown bullets are hashed into lexical features, multi-paragraph human essays receive artificial positive AI margins simply for using clean paragraphing. We enforce \emph{formatting invariance} by stripping Markdown structural punctuation (\code{\#}, \code{*}, \code{`}, \code{>}) and normalizing all whitespace runs to single spaces before extracting: (a) word $1$--$3$-grams, (b) $1$-skip-bigrams anchored on common English function words, (c) character $3$--$5$-grams inside $600$-character windows for alphabetic text, and (d) canonicalized CJK character $1$--$4$-grams. Each feature hash $h \in \{0,1\}^{64}$ maps to bucket $b = h \bmod B$ with Rademacher sign $\sigma(h) = (-1)^{(h \gg 32) \& 1}$ and L2-normalized weight $v_f = \sigma(h)\frac{1 + \ln \mathrm{cnt}_f}{\sqrt{|F(x)|}}$. Weights $w \in \mathbb{R}^B$ are trained on Fold-A via $5$ epochs of L2-regularized AdaGrad logistic regression ($\eta = 0.28$, $\lambda_2 = 2.5 \times 10^{-4}$) and quantized to \code{i8} relative to the $99.9$th-percentile magnitude ($z_{23}, z_{24}$).
\subsection{Zero-Table Structural, Fractal, and Network Features}\label{sec:struct}
Lexical hash tables alone degrade under unseen topics or heavy paraphrasing. The remaining $19$ dimensions of $\mathbf{z}(x) \in \mathbb{R}^{28}$ measure scale-free distributional, rhythmic, and topological invariants that require zero stored weights:\begin{itemize}[leftmargin=1.8em,itemsep=2pt] \item \textbf{DivEye $9\text{D}$ Surprisal Dynamics and Fractal Hurst Exponent ($z_5$--$z_{12}$):} Motivated by DivEye~\cite{diveye2025}, which observes that LLM decoding maintains smooth step-to-step surprisal transitions whereas human drafting alternates between predictable scaffolding and sudden high-surprisal lexical choices, we compute mean, coefficient of variation (CV), skewness, excess kurtosis, mean absolute first- and second-order temporal differences ($\frac{1}{n-1}\sum |s_{t+1}-s_t|$ and $\frac{1}{n-2}\sum |s_{t+2}-2s_{t+1}+s_t|$), and lag-$1$ autocorrelation over the \textsf{Dual-PPM} surprisal stream $s_{1:n}$. We further compute Hurst's Rescaled-Range ($R/S$) exponent $H \in (0, 1)$~\cite{hurst1951longterm} via ordinary least squares of $\ln(R(w)/S(w))$ against $\ln w$ across dyadic window sizes $w \in \{8, 16, 32, 64, 128\}$, capturing long-range persistence ($H > 0.5$) versus memoryless fluctuations. \item \textbf{Word Co-occurrence Complex Network Topology ($z_{21}$--$z_{22}$):} Over the document's top $V \le 96$ frequent lexical types, we construct an undirected sliding-window ($w=3$) co-occurrence graph $G = (V, E)$ represented as a compact $96 \times 96$ bit-adjacency matrix on the stack. From $G$ we compute the Watts--Strogatz average local clustering coefficient $C = \frac{1}{|V|}\sum_{u} \frac{2 T(u)}{d_u(d_u-1)}$~\cite{watts1998collective} and Newman's degree assortativity coefficient $r \in [-1, 1]$~\cite{newman2002assortative}, which differentiates hub-and-spoke functional topologies typical of natural human prose (more negative $r$) from uniform clause reuse. \item \textbf{Decimal-Safe Cadence Burstiness, Lexical Diversity, and Watermarks ($z_4, z_{13}$--$z_{16}, z_{19}$--$z_{20}, z_{25}$--$z_{27}$):} Naive period-based sentence splitters break technical prose at decimal multipliers (\code{1.8x to 4.3x}), byte sizes (\code{8.58 MB}), and file extensions (\code{.rs}, \code{.el}), fabricating short sentence fragments that inflate burstiness CV. Our peekable segmenter splits on ASCII periods only before whitespace or closing delimiters while excluding standalone headings ($\le 28$ chars without terminal punctuation) from prose burstiness statistics, and blends sentence CV with comma-clause CV on CJK text. We combine cadence CV, mean adjacent length jump, extreme-sentence ratio ($\le 6$ or $\ge 38$ units), paragraph symmetry, Moving-Average Type--Token Ratio (\textsf{MATTR-50})~\cite{covington2010mattr}, length-invariant Yule's $K = 10^4 (\sum_v c_v^2 - N)/N^2$, ZipPy LZ77 compression ratio~\cite{zippy2023}, specificity density, and zero-width / \code{U+202F} narrow no-break space watermark scans.\end{itemize}
\section{Out-of-Fold Boosting, Soft Labels, and Exact TreeSHAP}\label{sec:training}
\subsection{Two-Stage Out-of-Fold Protocol and Continuous Soft Targets}\label{sec:oof}
If a Level-2 tree ensemble is trained on the same documents used to fit Level-1 hashed counts (\textsf{Dual-PPM}, \textsf{Mixture MLE}, and \textsf{NBSVM}), in-fold margins exhibit artificially wide separation ($>94\%$ accuracy on Fold-A), causing the tree booster to assign $>85\%$ split gain to \code{nbsvm\_margin} and under-weight structural and surprisal features that are essential out of distribution.
We prevent this leakage via a strict three-way training partition:\begin{enumerate}[label=\textbf{Stage \arabic*:},leftmargin=4.2em,itemsep=2pt] \item \textbf{Level-1 Hashed Table Estimation ($N_{\mathrm{Fold\text{-}A}} = 82{,}046$):} Fit \code{ml\_tables.bin} exclusively on Fold-A. Freeze \code{ml\_tables.bin} and extract $28\text{D}$ feature matrices in parallel Rust via Rayon across disjoint Fold-B + Dev ($N_{\mathrm{OOF}} = 46{,}805$) and Calibration Val ($N_{\mathrm{cal}} = 7{,}959$). \item \textbf{Regularized Feature-Subsampled LightGBM ($N_{\mathrm{OOF}} = 46{,}805$):} Train a depth-bounded LightGBM ensemble~\cite{ke2017lightgbm} (\code{max\_depth=5}, \code{num\_leaves=24}, \code{feature\_\allowbreak fraction=0.45}, \code{bagging\_\allowbreak fraction=0.85}, $\lambda_1 = 2.0$, $\lambda_2 = 8.0$, \code{min\_child\_\allowbreak samples=65}, $115$ trees, $5{,}219$ total nodes) using the continuous cross-entropy objective: \begin{equation} \mathcal{L}_{\mathrm{xent}}(y, f(x)) \;=\; -\bigl[y \ln \sigma(f(x)) + (1 - y)\ln(1 - \sigma(f(x)))\bigr], \qquad y \in [0, 1]. \label{eq:xent} \end{equation} Because both Equation~\eqref{eq:ppm} (fractional count weights $y$ and $1-y$), AdaGrad logistic updates ($\nabla_z \mathcal{L} = \sigma(z) - y$), and LightGBM's Newton leaf steps accept arbitrary continuous targets $y \in [0, 1]$, human-AI co-authored documents with known authorship share (e.g., $y = 0.50$) train directly toward calibrated intermediate posteriors rather than being forced into noisy binary labels. \item \textbf{Tail-Blended Isotonic + Platt Calibration ($N_{\mathrm{cal}} = 7{,}959$):} Raw boosted log-odds margins $m(x) = \sum_{t=1}^{T_{\mathrm{tree}}} f_t(\mathbf{z}(x))$ are calibrated on the held-out $7{,}959$-document calibration split by fitting both a $42$-knot monotone quantile Isotonic Regression curve $g_{\mathrm{iso}}(m)$~\cite{zadrozny2002calibration} and a parametric Platt sigmoid $g_{\mathrm{platt}}(m) = \sigma(a m + b)$, blended $0.75\,g_{\mathrm{iso}}(m) + 0.25\,g_{\mathrm{platt}}(m)$ inside the empirical quantile support ($0.50 / 0.50$ outside) so extreme out-of-range margins remain smooth and strictly monotone.\end{enumerate}
\subsection{Causal Topic Deconfounding Under Domain Adaptation}\label{sec:deconfound}
A subtle failure mode arises when adapting an AI detector to detect AI-written technical documentation in specialized domains (such as peer-to-peer cryptographic protocols or Emacs Lisp systems). Suppose $D_{\mathrm{domain}}^{+}$ consists of AI-generated documentation rich in domain nouns $V_{\mathrm{dom}} = \{\text{\code{protocol}}, \text{\code{blockchain}}, \text{\code{consensus}}, \text{\code{emacs}}, \text{\code{buffer}}, \text{\code{lisp}}\}$. If $D_{\mathrm{domain}}^{+}$ is added to training and balanced only with general-domain human news or Wikipedia articles $D_{\mathrm{gen}}^{-}$, then $P(y=1 \mid w \in V_{\mathrm{dom}})$ approaches $1$ in the training distribution. Linear and tree models minimize empirical risk by assigning positive AI log-odds to technical vocabulary itself, turning genuine human domain experts into false positives.
In our ablation of this exact phenomenon (Section~\ref{sec:case_study}), adding $3{,}238$ AI-generated cryptography and LispM documentation passages balanced only with general human articles caused the predicted AI score on a verbatim 2021 Vitalik Buterin blockchain essay to jump from $10.9\%$ to $54.0\%$. Replacing general human balancing rows with \emph{topic-matched pre-LLM human corpora} (specifically pre-2021 GNU Emacs \code{etc/NEWS.19}--\code{NEWS.27} and essays alongside human cryptography, distributed-systems, and systems-programming prose matching $V_{\mathrm{dom}}$) restores $P(y=1 \mid w \in V_{\mathrm{dom}}) \approx 0.5$, forcing \textsf{Dual-PPM} and \textsf{NBSVM} to separate stylistic generation patterns rather than topic nouns.
\subsection{Stack-Allocated Exact Path-Dependent TreeSHAP}\label{sec:treeshap}
Opaque probability percentages are insufficient for editorial review; users need to know \emph{which} orthogonal signal family drove a classification and \emph{which} sentences carry the strongest AI or human signatures. For every prediction, \textsc{AIDetect} runs Lundberg et al.'s exact polynomial-time path-dependent \textsf{TreeSHAP} algorithm~\cite{lundberg2020treeshap} directly in WebAssembly over all $115$ trees ($5{,}219$ nodes). Because maximum tree depth is bounded at $D_{\max} = 5$, all active coalition path states $(f_d, z_d, o_d, w_d)$ (\code{extend\_path}, \code{unwind\_path}, and leaf coalition weighting using pre-recorded training node cover $C_v$) reside inside fixed stack arrays of length \code{MAX\_PATH\_DEPTH = 16} with zero heap allocations. By Shapley additivity, the feature attributions $\phi_1(x), \dots, \phi_{28}(x)$ satisfy exact local accuracy in raw margin space:\begin{equation}f(\mathbf{z}(x)) \;=\; \phi_0 + \sum_{j=1}^{28} \phi_j(\mathbf{z}(x)), \qquad \text{where } \phi_0 = \sum_{t=1}^{T_{\mathrm{tree}}} \mathbb{E}_{\mathrm{cover}}[f_t],\label{eq:shap}\end{equation}verified in unit tests across every inference pass to floating-point precision $< 10^{-8}$, and grouped into five interpretable family attributions ($\Phi_{\mathrm{PPM}}, \Phi_{\mathrm{DivEye}}, \Phi_{\mathrm{Cadence}}, \Phi_{\mathrm{MLE+Graph}}, \Phi_{\mathrm{NBSVM}}$). Sentence-level probabilities combine document posterior $p_{\mathrm{doc}}$ with localized per-sentence hashed margins $m_s = 0.55\,m_s^{\mathrm{NBSVM}} + 0.45\,\mathrm{LLR}_s^{\mathrm{PPM}}$ alongside cadence and watermark indicators.
\section{Multi-Head Neural Verifiers and Browser Q4 Distillation}\label{sec:neural}
While Tier~1 (\textsc{ProseGuard-ML}) delivers single-digit millisecond screening in $679\,\text{KiB}$, fixed-order Markov and feature-hashed N-gram tables face an information-theoretic limit when a frontier generator suppresses high-frequency RLHF transition phrases and varies clause lengths (as demonstrated on \code{claude-opus-5} in Section~\ref{sec:eval}). Conversely, commercial cloud detectors such as ZeroGPT and Originality.ai require uploading private text to third-party servers, and in peer-reviewed evaluations ZeroGPT fails to achieve false-positive rates below $16.9\%$~\cite{dugan2024raid}. To close this gap without sacrificing local execution or open licensing, Tiers~2 and~3 (\textsc{ProseGuard-mmBERT-small} and \textsc{ProseGuard-mmBERT-base}) introduce a multi-head bidirectional encoder architecture built upon Johns Hopkins CLSP's MIT-licensed \code{mmBERT}~\cite{marone2025mmbert,warner2024modernbert}.
\subsection{Tri-Pooled Multi-Head \texorpdfstring{\code{mmBERT}}{mmBERT} Architecture}\label{sec:mmbert_arch}
Both \code{jhu-clsp/mmBERT-base} ($22$ layers, hidden dimension $D = 768$, $8{,}192$-token context) and \code{jhu-clsp/mmBERT-small} ($D = 384$, $8{,}192$-token context) extend ModernBERT~\cite{warner2024modernbert} with rotary position embeddings, alternating local-global attention, and a $256{,}000$-token multilingual vocabulary covering over $1{,}800$ languages. Given token sequence $x_{1:L}$ with binary mask $m_{1:L} \in \{0, 1\}^L$ and final encoder states $H = [h_1, \dots, h_L] \in \mathbb{R}^{L \times D}$, standard mean or \code{[CLS]} pooling suffers from dilution on hybrid articles: if a $2{,}000$-word human draft contains one $150$-word AI-generated section, document-wide averaging buries the localized AI signal.
We attach two coupled heads to $H$:\begin{enumerate}[label=\textbf{(\arabic*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{Token Attribution and Branch-Free Sliding-Window Max Head:} A two-layer GELU MLP $g_{\mathrm{tok}} : \mathbb{R}^D \to \mathbb{R}$ emits per-token AI logits $s_t = g_{\mathrm{tok}}(h_t)$ and masked token probabilities $p_t = \sigma(s_t) m_t$. To capture localized AI insertions while remaining compatible with dynamic sequence lengths during ONNX graph tracing (avoiding data-dependent Python branches on $L < 64$), we right-pad $p_{1:L}$ and $m_{1:L}$ with $64$ zeros and apply $1\text{D}$ average pooling of window $W = 64$ and stride $S = 32$ (writing $M_k = \sum_{t \in \mathcal{W}_k} m_t$ and $M = \sum_{t=1}^L m_t$): \begin{equation} w_k \;=\; \mathbb{I}[M_k \ge 8] \frac{\sum_{t \in \mathcal{W}_k} p_t}{\max(8, M_k)}, \qquad w_{\max}(x) \;=\; \max\!\left(\max_{k} w_k,\; \frac{\sum_{t=1}^L p_t}{\max(1, M)}\right). \label{eq:winmax} \end{equation} \item \textbf{Tri-Pooled $3$-Way Document and Edit-Intensity Head:} We form a joint document representation $u(x) \in \mathbb{R}^D$ by projecting the concatenation of three complementary views: (i) masked mean pooling $h_{\mathrm{mean}}$, (ii) learned global attention pooling $h_{\mathrm{attn}} = \sum_{t=1}^L \alpha_t h_t$ with $\alpha = \mathrm{softmax}(w_g^\top h_t)$, and (iii) detached salience-weighted pooling $h_{\mathrm{sal}} = \sum_{t=1}^L \beta_t h_t$ weighted by stop-gradient token logits $\beta = \mathrm{softmax}(\mathrm{sg}(s_{1:L}))$, which routes high-suspicion spans directly to the document classifier without destabilizing token gradients. Linear heads over $u(x)$ predict $3$-way authorship logits $z_{\mathrm{doc}} \in \mathbb{R}^3$ (\code{0: Human}, \code{1: AI-Assisted/Polished}, \code{2: AI-Native}) and continuous AI intervention fraction $\hat{e}(x) = \sigma(w_e^\top u(x)) \in [0, 1]$.\end{enumerate}
\subsection{Online SpanMix, Asymmetric Low-FPR Hinge, and Distillation}\label{sec:mmbert_train}
To ensure that all released neural weights carry clean MIT commercial rights, we exclude non-commercial (\code{NC}) corpora (\code{AIGC-text-bank} and \code{WildAI}) entirely from neural training gradients, holding them strictly for out-of-distribution evaluation. We assemble a leak-free $495{,}571$-row training split and $38{,}127$-row validation split from permissively licensed English, Chinese, and multilingual corpora (RAID~\cite{dugan2024raid}, MAGE~\cite{li2024mage}, HC3~\cite{guo2023hc3}, SemEval-2024 Task~8, C-ReD, AnxForever, artem9k, dmitva, and mined hard human technical/ESL articles), correcting upstream label inversions and reclassifying $11{,}416$ DIPPER-paraphrased RAID passages from \code{human} to \code{AI-Assisted}.
During training, two mechanisms enforce span localization and strict low-FPR calibration:\begin{itemize}[leftmargin=1.8em,itemsep=2pt] \item \textbf{Online \textsf{SpanMix} and Formatting Anti-Shortcut Perturbation:} With probability $p_{\mathrm{mix}} = 0.20$, pure human ($y=0$) and pure AI ($y=2$) documents of the same language are spliced at paragraph or sentence boundaries, providing exact character-aligned binary token targets $t_{1:L} \in \{0, 1\}^L$, class label $y = 1$ (\code{AI-Assisted}), and exact edit-ratio supervision $e = \ell_{\mathrm{AI}} / \ell_{\mathrm{total}}$. With probability $0.30$, Markdown headers, bold markers, curly quotes, and punctuation styling are symmetrically perturbed so the encoder cannot shortcut on surface formatting. \item \textbf{Asymmetric Squared Excess-FPR Loss:} Standard cross-entropy treats false positives and false negatives symmetrically, often leaving $2\%$--$15\%$ of human technical or ESL documents in the high-score tail. For every human sample ($\mathbb{I}[y_i = 0] = 1$), we penalize non-human probability $P_{\mathrm{AI}}(x_i) = 1 - P_{\theta}(y=0 \mid x_i)$ exceeding a $5\%$ safety margin: \begin{equation} \begin{aligned} \mathcal{L}_{\mathrm{total}} \;=\; \mathcal{L}_{\mathrm{CE}}(z_{\mathrm{doc}}, y) &\;+\; \lambda_{\mathrm{fpr}}\,\mathbb{I}[y=0]\, \omega_i \max\bigl(0,\, P_{\mathrm{AI}}(x) - 0.05\bigr)^2 \\ &\;+\; \lambda_{e}\,\mathcal{L}_{\mathrm{Huber}}(\hat{e}, e) \;+\; \lambda_{\mathrm{tok}}\,\mathcal{L}_{\mathrm{BCE}}(s_{1:L}, t_{1:L}), \end{aligned} \label{eq:pg_loss} \end{equation} with $\lambda_{\mathrm{fpr}} = 12.0$, $\lambda_e = 0.6$, $\lambda_{\mathrm{tok}} = 0.5$, and elevated sample weight $\omega_i = 2.5$ on mined hard human technical and ESL prose.\end{itemize}
We first train the $22$-layer teacher (\textsc{ProseGuard-mmBERT-base}) in \code{bfloat16} on Apple M1 Max Metal MPS, then distill the student (\textsc{ProseGuard-mmBERT-small}) online by combining hard-label loss~\eqref{eq:pg_loss} ($0.55$ weight) with temperature-scaled KL divergence ($\tau = 2.0$) on $3$-way teacher logits, L1 regression on teacher $\hat{e}$, and binary KL on teacher token-span probabilities ($0.45$ weight). On the held-out validation split, a Neyman--Pearson grid search fits temperature $T$ and window blend $\beta \in [0, 1]$ for the deployed score:\begin{equation}S_{\mathrm{PG}}(x) \;=\; (1 - \beta)\,\bigl(1 - P_T(y=0 \mid x)\bigr) \;+\; \beta\,\max\!\Bigl(1 - P_T(y=0 \mid x),\; w_{\max}(x)\Bigr).\label{eq:pg_score}\end{equation}
\subsection{\texorpdfstring{$65{,}536$}{65,536}-Vocab Compaction and \texorpdfstring{$51.8\,\text{MB}$}{51.8 MB} Browser Q4 Export}\label{sec:web_q4}
In \code{mmBERT-small}, the $256{,}000 \times 384$ token embedding matrix alone consumes $393\,\text{MB}$ in \code{FP32} ($>70\%$ of total model bytes), preventing practical browser downloads. Because over $190{,}000$ vocabulary entries serve low-resource scripts outside English, Chinese, and Japanese, we perform a lossless-in-practice vocabulary compaction to $V_{\mathrm{web}} = 65{,}536 = 2^{16}$ tokens: we retain all special and byte-fallback tokens, $100\%$ of single-character ASCII, CJK Unified Ideographs (\code{U+4E00}--\code{U+9FFF}), Hiragana/Katakana (\code{U+3000}--\code{U+30FF}), and fullwidth punctuation, and fill remaining slots by multilingual corpus frequency ($99.6\%$ token coverage across held-out EN/ZH/JA text).
At runtime, a static $500\,\text{KiB}$ lookup table (\code{vocab\_\allowbreak remap\_\allowbreak u16.bin}, \code{uint16[256000]}, $\sim 120\,\text{KiB}$ gzipped) maps raw tokenizer IDs into $[0, 65{,}535]$ in $O(1)$ array indexing inside a browser Web Worker. Applying dynamic \code{INT8} embedding \code{Gather} quantization and $4$-bit block-wise \code{MatMulNBits} quantization to linear layers compresses \textsc{ProseGuard-mmBERT-small} from $538\,\text{MB}$ (\code{FP32}) to $136\,\text{MB}$ (full-vocab \code{INT8} ONNX) and $51.8\,\text{MB}$ ($45.1\,\text{MiB}$ gzipped, \code{web/model\_web\_q4.onnx}), which streams once from static CDN storage into the browser Cache API and executes locally via WebGPU or Wasm SIMD with zero manuscript bytes transmitted.
\section{Experimental Evaluation}\label{sec:eval}
\subsection{Datasets and Evaluation Splits}
Table~\ref{tab:datasets} summarizes the $154{,}424$-row unified multilingual corpus assembled from open-source benchmarks spanning 2019--2026 human writing and $>15$ generator families (GPT-5, GPT-4o, GPT-4.1, Claude 3.5/4.5, DeepSeek-V3/R1, Qwen-2.5/3, Grok, Llama-3-70B, GLM-4, Doubao-1.5-Pro), deduplicated via $96$-bit BLAKE2b content hashes. Two benchmarks are held out strictly for zero-shot out-of-distribution (OOD) testing without a single training or validation example from their sources: (i) \textbf{OOD-2026} ($N=700$, \code{textsightai} 2026 benchmark pairing pre-2022 Wikipedia, public-domain literature, and PubMed Central non-native ESL biomedical prose against 2025--2026 frontier models), and (ii) \textbf{OOD-NLPCC25} ($N=4{,}000$, official NLPCC-2025 Task 1 test split featuring unseen DeepSeek-V3 Chinese generations).
\begin{table}[t]\centering\caption{Composition of training, out-of-fold boosting, calibration, held-out test, and strict OOD evaluation splits.}\label{tab:datasets}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{5.0pt}\begin{tabular}{@{}llrrl@{}}\toprule\textbf{Split} & \textbf{Role in Pipeline} & \textbf{Docs} & \textbf{AI Share} & \textbf{Constituent Sources \& Languages} \\\midruleFold-A & Level-1 Hashed Tables (\code{ml\_tables.bin}) & $82{,}046$ & $48.4\%$ & AIGC-Bank, WildAI, artem9k, rasbt, HC3~\cite{guo2023hc3}, \\Fold-B + Dev & Out-of-Fold LightGBM (\code{gbdt\_forest.bin}) & $46{,}805$ & $48.4\%$ & RAID~\cite{dugan2024raid}, MAGE~\cite{li2024mage}, C-ReD, NLPCC25-tr, \\Calib.\ Val & Isotonic + Platt Calibration ($42$ knots) & $7{,}959$ & $49.6\%$ & AnxForever, OpenCC \code{s2twp}, minko186 (JA), \\Held-out Test & In-distribution Multilingual Test & $12{,}914$ & $50.5\%$ & + Topic-deconfounded technical \& soft-label split \\\midruleOOD-2026 & Zero-shot English Fairness \& 2026 OOD & $700$ & $8.0\%$ & Pre-2022 Wiki, ESL PMC, PD Lit.\ vs.\ 2026 LLMs \\OOD-NLPCC25 & Zero-shot Chinese OOD (DeepSeek-V3) & $4{,}000$ & $50.9\%$ & Official NLPCC-2025 Task 1 held-out test set \\\bottomrule\end{tabular}%}\end{table}
\subsection{Baseline Comparison and Orthogonal Feature Ablations}
Table~\ref{tab:ablations} compares single-family baselines and progressive ablations trained under identical out-of-fold boosting and evaluated across Held-out Test ($N=12{,}914$), OOD-2026 ($N=700$), and OOD-NLPCC25 ($N=4{,}000$). Following Hans et al.~\cite{hans2024binoculars}, in addition to ROC-AUC, accuracy, and F1 at threshold $0.5$, we report true positive rate at $1\%$ and $5\%$ false positive rates ($\text{TPR@1\%FPR}$, $\text{TPR@5\%FPR}$), Brier score, and $10$-bin Expected Calibration Error (ECE).
\begin{table}[t]\centering\caption{Baseline comparison and progressive feature-family ablations across Held-out Test ($N=12{,}914$), OOD-2026 ($N=700$), and OOD-NLPCC25 ($N=4{,}000$). All models run with zero neural network weights.}\label{tab:ablations}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{4.2pt}\begin{tabular}{@{}lccccccccc@{}}\toprule& \multicolumn{6}{c}{\textbf{Held-out Multilingual Test ($N=12{,}914$)}} & \multicolumn{2}{c}{\textbf{OOD-2026}} & \textbf{NLPCC25} \\\cmidrule(lr){2-7} \cmidrule(lr){8-9} \cmidrule(l){10-10}\textbf{Model / Feature Basis} & \textbf{AUC} & \textbf{Acc\%} & \textbf{TPR@1\%} & \textbf{TPR@5\%} & \textbf{Brier} & \textbf{ECE} & \textbf{AUC} & \textbf{Acc\%} & \textbf{AUC} \\\midrule1.\ LZ77 Compression Alone~\cite{zippy2023} & 0.6370 & 59.87 & 1.53\% & 14.11\% & 0.2360 & 0.0309 & 0.3557 & 85.43 & 0.5187 \\2.\ DivEye $9\text{D}$ + Hurst + Word Graph & 0.6880 & 64.15 & 4.90\% & 16.75\% & 0.2239 & 0.0238 & 0.7224 & 68.29 & 0.6424 \\3.\ Stylometry \& Burstiness Alone & 0.8608 & 78.55 & 30.33\% & 53.16\% & 0.1501 & 0.0163 & 0.8614 & 90.29 & 0.8378 \\4.\ Dual-PPM + Mixture MLE ($\hat{\alpha}$) Alone & 0.8741 & 79.41 & 34.42\% & 57.15\% & 0.1431 & 0.0158 & 0.8992 & 86.00 & 0.9203 \\5.\ Hashed N-gram NBSVM Alone & 0.9536 & 88.59 & 64.29\% & 81.04\% & 0.0829 & 0.0098 & 0.8971 & 91.86 & 0.9523 \\6.\ Full $26\text{D}$ Basis w/o NBSVM & 0.9362 & 86.26 & 55.28\% & 73.75\% & 0.0991 & 0.0060 & 0.8894 & \textbf{94.29} & 0.9296 \\7.\ Full $28\text{D}$ Ensemble (Raw Logistic) & \textbf{0.9700} & \textbf{91.25} & \textbf{73.64\%} & \textbf{87.03\%} & 0.0652 & 0.0160 & \textbf{0.9098} & 93.71 & \textbf{0.9592} \\8.\ \textbf{AIDetect Full $28\text{D}$ (Calibrated)} & \textbf{0.9700} & 91.14 & \textbf{73.64\%} & \textbf{87.03\%} & \textbf{0.0650} & \textbf{0.0071} & \textbf{0.9098} & 93.00 & \textbf{0.9592} \\\bottomrule\end{tabular}%}\end{table}
Three empirical findings stand out in Table~\ref{tab:ablations}:\begin{enumerate}[label=\textbf{(\arabic*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{Failure of Standalone Compression:} Single-document LZ77 compression (Row~1) performs poorly in-domain ($0.6370$ AUC, $1.53\%$ TPR@1\%FPR) and drops to $0.3557$ AUC on OOD-2026 because long public-domain literary chapters achieve higher dictionary reuse than short LLM responses. Compression only becomes informative inside a multivariate tree conditioned on length and script. \item \textbf{Complementarity Between Markov Curvature, Rhythm, and Lexical Hashing:} While formatting-invariant \textsf{NBSVM} is the strongest individual family in-domain ($0.9536$ AUC, Row~5), \textsf{Dual-PPM} + \textsf{Mixture MLE} alone actually slightly outperforms \textsf{NBSVM} alone on OOD-2026 ($0.8992$ vs.\ $0.8971$ AUC, Row~4), and the $26\text{D}$ non-NBSVM basis reaches $0.9362$ AUC on its own (Row~6). Combining all $28$ features boosts $\text{TPR@1\%FPR}$ by $+9.35$ percentage points over \textsf{NBSVM} alone ($64.29\% \to 73.64\%$) and lifts Held-out AUC to $0.9700$. \item \textbf{Probability Calibration:} Adding the $42$-knot Isotonic + Platt calibrator (Row~8 vs.\ Row~7) preserves ranking identically while cutting ECE by $55.6\%$ ($0.0160 \to 0.0071$), ensuring that displayed percentages correspond to empirical authorship frequencies.\end{enumerate}
\subsection{Multilingual Breakdown and OOD-2026 Fairness Analysis}
Table~\ref{tab:langs} reports performance stratified by language across the $12{,}914$ held-out test documents. Notably, Traditional Chinese (\code{zh-Hant}) achieves $0.9941$ ROC-AUC and $89.00\%$ $\text{TPR@1\%FPR}$ ($2.33\%$ FPR at threshold $0.5$) without storing a separate Traditional Chinese hash table, validating the $\pi_{\mathrm{cjk}}$ orthographic homomorphism. Japanese (\code{ja}) reaches $0.8784$ ROC-AUC ($80.00\%$ accuracy on $N=50$ held-out docs); while Kana salt isolation (\code{0x4A41\_0000}) prevents Chinese Hanzi interference, smaller public Japanese training volume leaves a clear accuracy gap relative to Chinese and English.
\begin{table}[t]\centering\caption{Stratified performance by language/script on the Held-out Test Set ($N=12{,}914$).}\label{tab:langs}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{5.5pt}\begin{tabular}{@{}lrrrrrrrr@{}}\toprule\textbf{Language} & \textbf{Test Docs} & \textbf{ROC-AUC} & \textbf{PR-AUC} & \textbf{Acc\%} & \textbf{F1} & \textbf{FPR@0.5} & \textbf{TPR@1\%FPR} & \textbf{Brier} \\\midruleEnglish (\code{en}) & $8{,}600$ & 0.9579 & 0.9557 & 89.37\% & 0.8811 & 9.52\% & 63.61\% & 0.0776 \\Simplified Chinese (\code{zh-Hans}) & $3{,}664$ & 0.9877 & 0.9938 & 94.76\% & 0.9587 & 5.33\% & 87.53\% & 0.0393 \\Traditional Chinese (\code{zh-Hant}) & $600$ & 0.9941 & 0.9944 & 95.33\% & 0.9522 & 2.33\% & 89.00\% & 0.0332 \\Japanese (\code{ja}) & $50$ & 0.8784 & 0.8979 & 80.00\% & 0.7826 & 12.00\% & 44.00\% & 0.1565 \\\midrule\textbf{All Held-out Test} & $\mathbf{12{,}914}$ & \textbf{0.9700} & \textbf{0.9746} & \textbf{91.14\%} & \textbf{0.9118} & \textbf{8.33\%} & \textbf{73.64\%} & \textbf{0.0650} \\\bottomrule\end{tabular}%}\end{table}
Table~\ref{tab:ood26} breaks down OOD-2026 ($N=700$) by sub-domain. On the critical fairness slice of non-native English biomedical papers (\code{human-pmc-esl}, $N=183$), \textsc{AIDetect} achieves $96.17\%$ accuracy ($3.83\%$ false-positive rate, mean predicted AI probability $9.00\%$), avoiding the $>60\%$ ESL false-positive rates documented by Liang et al.~\cite{liang2023gptbiased} for raw perplexity detectors. On public-domain literature ($N=306$) and pre-2022 Wikipedia ($N=155$), accuracy is $99.35\%$ and $90.97\%$. Across unseen 2025--2026 generators, \textsc{AIDetect} detects \code{gpt-oss-120b} ($83.33\%$) and \code{gpt-4.1} ($75.00\%$), drops to $58.33\%$ and $50.00\%$ on \code{claude-haiku-4-5} and \code{qwen-3.8-27b}, and misses \code{claude-opus-5} completely ($0.00\%$ at threshold $0.5$, mean predicted AI $19.65\%$). Inspecting feature attributions on \code{claude-opus-5} shows why: Opus 5 suppresses standard RLHF transition phrases, varies sentence lengths ($\text{CV} > 0.55$), and uses low-frequency lexical items that mimic human essayists when evaluated without a multi-billion-parameter neural observer.
\begin{table}[t]\centering\caption{Sub-domain breakdown on the strict zero-shot OOD-2026 benchmark ($N=700$, overall ROC-AUC $= 0.9098$).}\label{tab:ood26}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{5.5pt}\begin{tabular}{@{}llrrr@{}}\toprule\textbf{OOD-2026 Sub-Domain} & \textbf{Ground Truth} & \textbf{Docs} & \textbf{Accuracy @ $0.5$} & \textbf{Mean Pred.\ AI\%} \\\midrule\code{pd-literature} (Public-Domain Books) & Human & $306$ & $99.35\%$ & $4.15\%$ \\\code{human-pmc-esl} (Non-Native ESL Biomedical) & Human & $183$ & $96.17\%$ & $9.00\%$ \\\code{human-wikipedia-pre2022} (Pre-ChatGPT Wiki) & Human & $155$ & $90.97\%$ & $17.20\%$ \\\midrule\code{gpt-oss-120b} & AI & $12$ & $83.33\%$ & $71.93\%$ \\\code{gpt-4.1} & AI & $12$ & $75.00\%$ & $62.48\%$ \\\code{claude-haiku-4-5} & AI & $12$ & $58.33\%$ & $56.28\%$ \\\code{qwen-3.8-27b} & AI & $8$ & $50.00\%$ & $53.32\%$ \\\code{claude-opus-5} & AI & $12$ & $0.00\%$ & $19.65\%$ \\\bottomrule\end{tabular}%}\end{table}
\subsection{Topic Deconfounding, Soft-Label Co-Authorship, and Wasm Latency}\label{sec:case_study}
Table~\ref{tab:sys} evaluates (a) causal topic deconfounding and soft-label calibration ($y = 0.50$) on real technical writing, and (b) browser WebAssembly binary footprint and single-core latency on Apple M-series silicon (Node.js v22 V8 Wasm engine, $40$-run warmup + $40$-run measurement, including full $28\text{D}$ extraction, $115$-tree exact \textsf{TreeSHAP}, and sentence attribution).
\begin{table}[t]\centering\caption{Left: Effect of causal topic deconfounding and $y=0.50$ soft-label training on technical prose. Right: Compiled WebAssembly footprint and end-to-end single-core latency (including exact \textsf{TreeSHAP}).}\label{tab:sys}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{4.5pt}\begin{tabular}{@{}lrr@{\hspace{1.2em}}lrrr@{}}\toprule\textbf{Technical Evaluation Passage} & \textbf{Naive} & \textbf{Deconf.} & \textbf{Document Size} & \textbf{Bytes} & \textbf{p50} & \textbf{p99} \\\midruleRings / LispM AI Docs ($14$ articles, $y=1$) & $98.9\%$ & $99.1\%$ & Cold Wasm Init + SHA-256 & $695{,}460$ & $15.68\,\text{ms}$ & $18.40\,\text{ms}$ \\Emacs Harness Post (EN, $y=0.50$ hybrid) & $48.0\%$ & $49.9\%$ & Short Note ($\sim 100$ words) & $550$ & $1.12\,\text{ms}$ & $2.39\,\text{ms}$ \\Emacs Harness Post (ZH, $y=0.50$ hybrid) & $54.3\%$ & $53.4\%$ & Blog Post ($\sim 380$ words) & $2{,}200$ & $2.26\,\text{ms}$ & $4.72\,\text{ms}$ \\Vitalik Buterin 2021 Crypto Essay ($y=0$) & $54.0\%$ & $10.9\%$ & Long Essay ($\sim 1{,}400$ words) & $8{,}250$ & $6.68\,\text{ms}$ & $8.01\,\text{ms}$ \\Elon Musk 2006 Master Plan ($y=0$) & $24.5\%$ & $24.4\%$ & Technical Paper ($\sim 5{,}600$ words) & $33{,}000$ & $26.97\,\text{ms}$ & $34.39\,\text{ms}$ \\Vaswani et al.\ 2017 Abstract ($y=0$) & $4.3\%$ & $5.9\%$ & \multicolumn{4}{@{}l}{\emph{Binary: $679\,\text{KiB}$ raw Wasm ($389\,\text{KiB}$ gzip), $0$ Cargo deps}} \\\bottomrule\end{tabular}%}\end{table}
On the human-AI co-authored Emacs benchmark post (opening four personal motivation paragraphs written by the author, remaining benchmark walkthrough drafted with AI assistance, trained under continuous target $y = 0.50$), \textsc{AIDetect} predicts $49.9\%$ AI on the plain English body ($52.4\%$ with web header) and $53.4\%$ AI on the Chinese version, while sentence-level attribution identifies the author's opening motivation sentence as Most Human ($89\%$ Human) and the structured symbol-lookup benchmark transition as Most AI ($71\%$ AI). Meanwhile, topic-matched pre-2021 human counterweights eliminate the $54.0\% \to 10.9\%$ false positive on human cryptocurrency writing while retaining $99.1\%$ mean AI score ($97.0\%$--$99.7\%$ range) across all $14$ AI-generated Rings and LispM technical articles.
\subsection{Three-Tier Progression and External Detector Comparison}\label{sec:external_eval}
To evaluate how all three \textsc{ProseGuard} tiers compare against published open-weight and commercial detectors, we report two standard threshold-independent and low-false-positive metrics side by side in separate columns rather than single-threshold accuracy alone: \textbf{ROC-AUC} ($1.0 =$ ideal ranking separation between human and AI documents across all thresholds; $0.5 =$ random coin flip) and \textbf{TPR@1\%FPR} (the percentage of AI-generated documents caught when the decision threshold is strictly locked so at most $1\%$ of human documents are falsely flagged).
\paragraph{1. Same-Split Head-to-Head on \code{OOD-2026}.}TextSight~\cite{textsight2026aidetection} assembled \code{OOD-2026} specifically to expose inflated detector claims: removing its pre-1940 Victorian literature negative control leaves \textbf{OOD-2026 Modern} ($N=394$: $155$ pre-2022 Wikipedia revisions and $183$ non-Anglophone PubMed Central biomedical articles paired against $56$ genre-matched September 2026 outputs from \code{claude-opus-5}, \code{claude-haiku-4-5}, \code{gpt-4.1}, \code{gpt-oss-120b}, and \code{qwen-3.8-27b}). Based on \code{e5-small-lora} scoring $0.6711$ ROC-AUC and $25.0\%$ TPR@1\%FPR on this set, TextSight concluded that a detector small enough to run inside a browser was not yet viable to ship.
Table~\ref{tab:competitors_ood26} scores the shipped \textsc{ProseGuard} files (\code{INT8} and \code{Q4} ONNX, Wasm) alongside \code{RoBERTa-Base OpenAI} and the per-passage \code{e5-small-lora} and \code{Oxidane/TMR} scores that TextSight releases with the dataset. Confidence intervals come from $2{,}000$ stratified bootstrap resamples, re-deriving the $1\%$ FPR threshold in each resample; ESL intervals are Wilson intervals. We read the results as follows:\begin{enumerate}[label=\textbf{(\alph*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{The neural tiers rank better than the open baselines we could run.} Both \code{INT8} tiers exceed $0.99$ ROC-AUC, and the lower end of the \code{mmBERT-small} \code{INT8} TPR interval ($85.7\%$) sits above the upper end of \code{Oxidane/TMR} ($69.6\%$). The $51.8\,\text{MB}$ \code{Q4} build loses about $18$ points of recall to quantization and vocabulary compaction. \item \textbf{The $1\%$ FPR point is fragile.} With $338$ human passages the threshold rests on about three documents. \code{mmBERT-base} reaches $96.4\%$ but its interval spans $46.4$--$100\%$, and only $12$ \code{claude-opus-5} passages exist, so per-generator recall should be read as indicative. \item \textbf{ESL false positives depend on calibration, not only on ranking.} At a uniform $0.5$ threshold, \code{mmBERT-small} \code{INT8} flags $13.7\%$ of the $183$ non-Anglophone PubMed papers, similar to \code{Oxidane/TMR} ($13.1\%$), while \textsc{ProseGuard-ML} ($3.8\%$), \code{mmBERT-base} ($4.4\%$), and the \code{Q4} build ($0.5\%$) are lower. These are copy-edited published papers, so they are a weak proxy for learner writing. \item \textbf{Validation reuse.} We evaluated on \code{OOD-2026} several times during development, so it served partly as a validation set.\end{enumerate}
\begin{table}[t]\centering\caption{Same-split comparison on \code{OOD-2026 Modern}~\cite{textsight2026aidetection} ($338$ pre-2022 Wikipedia and non-Anglophone PMC human passages vs.\ $56$ genre-matched 2026 AI passages). Brackets give 95\% bootstrap CIs. Opus~5 recall uses the same $1\%$ FPR threshold ($n=12$). ESL is the share of $183$ non-Anglophone PMC papers scoring $\ge 0.5$. Commercial APIs were not evaluated.}\label{tab:competitors_ood26}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{5pt}\begin{tabular}{@{}llllrr@{}}\toprule\textbf{Detector} & \textbf{Footprint} & \textbf{ROC-AUC} & \textbf{TPR@1\%FPR} & \textbf{Opus 5} & \textbf{ESL @0.5} \\\midruleRoBERTa-Base OpenAI & $501\,\text{MB}$ FP32 & 0.316 & 0.0\% & 0/12 & 8.2\% \\TextSight \code{e5-small-lora} & Browser LoRA & 0.671 [0.574, 0.760] & 25.0\% [10.7, 37.5] & 1/12 & 10.4\% [6.8, 15.7] \\Oxidane \code{tmr-ai-detector} & Server model & 0.867 [0.799, 0.926] & 50.0\% [37.5, 69.6] & 0/12 & 13.1\% [9.0, 18.8] \\\midrule\textbf{ProseGuard-ML} & $679\,\text{KiB}$ Wasm & 0.864 [0.809, 0.913] & 39.3\% [21.4, 51.8] & 0/12 & 3.8\% [1.9, 7.7] \\\textbf{ProseGuard-mmBERT-small} & $51.8\,\text{MB}$ Q4 & 0.988 [0.977, 0.995] & 76.8\% [62.5, 91.1] & 6/12 & 0.5\% [0.1, 3.0] \\\textbf{ProseGuard-mmBERT-small} & $136\,\text{MB}$ INT8 & 0.998 [0.994, 1.000] & 94.6\% [85.7, 100] & 11/12 & 13.7\% [9.4, 19.4] \\\textbf{ProseGuard-mmBERT-base} & $295.9\,\text{MB}$ INT8 & 0.996 [0.991, 1.000] & 96.4\% [46.4, 100] & 10/12 & 4.4\% [2.2, 8.4] \\\bottomrule\end{tabular}%}\end{table}
\paragraph{2. Multilingual, Hybrid Polish, and Adversarial Benchmarks Across Tiers.}Table~\ref{tab:tiers_multilingual} compares all three \textsc{ProseGuard} tiers across four stratified $1{,}400$-document multilingual benchmarks (\code{seed=20261204}). On Chinese \code{DeepSeek-V3} with adversarial perturbations (\code{NLPCC-2025}, unseen by the neural tiers), \text{TPR@1\%FPR} scales monotonically across tiers from $58.3\%$ (\code{ML}) to $75.5\%$ (\code{mmBERT-small}) and $90.3\%$ (\code{mmBERT-base}, $81.6\%$ at $0.1\%$ FPR). On \code{AnxForever} Chinese hybrid tasks (continuation, rewriting, and light AI polishing), \code{mmBERT-small} and \code{mmBERT-base} raise recall on lightly AI-polished human drafts at $1\%$ human FPR from $59.9\%$ (\code{ML}) to $72.7\%$ and $74.2\%$. On a blind real-world 50/50 human-AI co-authored technical essay on Lisp Machine architecture ($y = 0.50$ ground-truth authorship split), \textsc{ProseGuard-mmBERT-base} predicts $50.95\%$ AI ($49.1\%$ \emph{Human}, $37.7\%$ \emph{AI-Assisted}, $13.2\%$ \emph{AI-Native}).
\begin{table}[t]\centering\caption{The three \textsc{ProseGuard} tiers on held-out benchmarks ($N=1{,}400$ per split, PyTorch weights). C-ReD and AnxForever are held-out splits of training sources. NLPCC-2025 was unseen by the neural tiers; its train split was used for \textsc{ProseGuard-ML}.}\label{tab:tiers_multilingual}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{4.0pt}\begin{tabular}{@{}lrrrrrrrrr@{}}\toprule& \multicolumn{2}{c}{\textbf{NLPCC-2025 (ZH)}} & \multicolumn{2}{c}{\textbf{C-ReD (ZH)}} & \multicolumn{3}{c}{\textbf{AnxForever Hybrid (ZH)}} & \multicolumn{2}{c}{\textbf{RAID + MAGE (EN)}} \\\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-8} \cmidrule(l){9-10}\textbf{Model Tier} & \textbf{AUC} & \textbf{TPR@1\%} & \textbf{AUC} & \textbf{TPR@1\%} & \textbf{AUC} & \textbf{TPR@1\%} & \textbf{Polish@1\%} & \textbf{AUC} & \textbf{TPR@1\%} \\\midrule\textbf{ProseGuard-ML} ($679\,\text{KiB}$ Wasm) & 0.9647 & 58.3\% & 0.9985 & 97.1\% & 0.9800 & 79.8\% & 59.9\% & 0.8272 & 44.5\% \\\textbf{ProseGuard-mmBERT-small} ($136\,\text{MB}$) & 0.9840 & 75.5\% & \textbf{0.9990} & 96.8\% & 0.9845 & \textbf{83.6\%} & 72.7\% & \textbf{0.8975} & \textbf{53.9\%} \\\textbf{ProseGuard-mmBERT-base} ($295.9\,\text{MB}$) & \textbf{0.9922} & \textbf{90.3\%} & 0.9989 & \textbf{97.5\%} & \textbf{0.9847} & 75.5\% & \textbf{74.2\%} & 0.8621 & 50.7\% \\\bottomrule\end{tabular}%}\end{table}
\paragraph{3. Published Numbers for Commercial and Larger Detectors.}We did not run commercial APIs. Table~\ref{tab:commercial_raid} lists published results from the ACL~2024 RAID study~\cite{dugan2024raid}, the live RAID leaderboard, and Liang et al.~\cite{liang2023gptbiased} only as context. These numbers come from different data, different tool versions, and often vendor default thresholds, so they cannot be compared directly with Table~\ref{tab:competitors_ood26}. In particular, the 2023 TOEFL false-positive rates for ZeroGPT and GPTZero describe older versions on raw learner essays, while our ESL numbers come from copy-edited published papers.\begin{itemize}[leftmargin=1.8em,itemsep=2pt] \item \textbf{English adversarial paraphrase is our weakest area:} On heavy English adversarial attacks in RAID (such as DIPPER $11\text{B}$ paraphrasing, synonym substitution, and homoglyph injection), specialized multi-gigabyte English detectors such as Desklib v1.01~\cite{desklib2025detector} (\code{DeBERTa-v3-large}, $1.74\,\text{GB}$, trained directly across the multi-million-row English RAID set, $76.5\%$ RAID leaderboard TPR@1\%FPR) and GPTZero's updated cloud ensemble ($92.9\%$ RAID leaderboard TPR@1\%FPR) achieve higher adversarial English recall than \textsc{ProseGuard-mmBERT-small} ($53.9\%$ on our combined \code{RAID+MAGE} OOD split). Those detectors are English-only or cloud-hosted, and $6\times$--$50\times$ larger than our \code{INT8} tiers; we did not test them on Chinese or Japanese text.\end{itemize}
\begin{table}[t]\centering\caption{Published reference metrics from RAID (ACL 2024~\cite{dugan2024raid} and leaderboard) and Liang et al.~\cite{liang2023gptbiased}. Not a same-split comparison. ProseGuard rows use our own RAID+MAGE split (R+M), which differs from the RAID leaderboard test set. Asterisk ($^*$): ZeroGPT could not reach $5\%$ FPR in RAID.}\label{tab:commercial_raid}\vspace{3pt}\resizebox{\textwidth}{!}{%\footnotesize\setlength{\tabcolsep}{4.2pt}\begin{tabular}{@{}lllrrrr@{}}\toprule\textbf{Detector} & \textbf{Deployment \& License} & \textbf{Languages} & \textbf{RAID@5\%FPR} & \textbf{Min FPR} & \textbf{RAID@1\%FPR} & \textbf{ESL Human FPR} \\\midruleZeroGPT~\cite{dugan2024raid,liang2023gptbiased} & Closed Cloud API & Multilingual & $65.5\%^*$ & $16.90\%$ & Unreachable & $61.3\%$ (TOEFL) \\GPTZero~\cite{dugan2024raid,liang2023gptbiased} & Closed Cloud API & Multilingual & $66.5\%$ (2024) & $<1.00\%$ & $92.9\%$ (Live API) & $51.6\%$ (2023 TOEFL) \\Originality.ai~\cite{dugan2024raid} & Closed Cloud API & Multilingual & $85.0\%$ & $0.62\%$ & -- & -- \\Winston AI~\cite{dugan2024raid} & Closed Cloud API & EN / FR / ES & $71.0\%$ & $<5.00\%$ & -- & -- \\\midruleRoBERTa-ChatGPT~\cite{guo2023hc3,dugan2024raid} & Open ($499\,\text{MB}$) & EN (sep.\ ZH) & $44.8\%$ & $<5.00\%$ & $19.6\%$ & -- \\RADAR~\cite{hu2023radar,dugan2024raid} & Open ($1.4\,\text{GB}$) & EN only & $70.9\%$ & $<1.00\%$ & -- & -- \\Fast-DetectGPT~\cite{bao2024fastdetectgpt,dugan2024raid} & Open ($\sim 12\,\text{GB}$ GPU) & EN-centric & $73.6\%$ & $0.88\%$ & -- & -- \\Binoculars~\cite{hans2024binoculars,dugan2024raid} & Open ($\sim 14\,\text{GB}$ $2\times 7\text{B}$) & EN-centric & $79.6\%$ & $<0.10\%$ & $69.5\%$ (Clean) & $<1.0\%$ \\Desklib v1.01~\cite{desklib2025detector} & Open MIT ($1.74\,\text{GB}$) & EN only & -- & $<1.00\%$ & $76.5\%$ (In-dom.) & -- \\\midruleProseGuard-ML & Open MIT ($679\,\text{KiB}$ Wasm) & EN / ZH / JA & $56.5\%$ (R+M) & -- & $44.5\%$ (R+M) & $3.8\%$ (PMC, @0.5) \\ProseGuard-mmBERT-small & Open MIT ($136\,\text{MB}$ INT8) & EN / ZH / JA & $65.5\%$ (R+M) & -- & $53.9\%$ (R+M) & $13.7\%$ (PMC, @0.5) \\ProseGuard-mmBERT-base & Open MIT ($295.9\,\text{MB}$ INT8) & EN / ZH / JA & $59.6\%$ (R+M) & -- & $50.7\%$ (R+M) & $4.4\%$ (PMC, @0.5) \\\bottomrule\end{tabular}%}\end{table}
\section{Limitations and Conclusion}\label{sec:conclusion}
Across its three deployment tiers, \textsc{ProseGuard} makes explicit trade-offs between footprint, latency, and adversarial robustness:\begin{enumerate}[label=\textbf{(\arabic*)},leftmargin=2.2em,itemsep=2pt] \item \textbf{Tier-1 Statistical Ceiling vs.\ Tier-2/3 Neural Verification:} As shown on \code{claude-\allowbreak opus-5} in Tables~\ref{tab:ood26} and~\ref{tab:competitors_ood26}, frontier models post-trained to vary clause rhythm and avoid high-frequency RLHF transitions evade $679\,\text{KiB}$ N-gram and Markov tables ($0.0\%$ recall at $1\%$ FPR in \textsc{ProseGuard-ML}). The multi-head \code{mmBERT} tiers catch more of these passages ($6/12$ in the $51.8\,\text{MB}$ \code{Q4} build, $11/12$ in \code{mmBERT-\allowbreak small INT8}, $10/12$ in \code{mmBERT-\allowbreak base INT8}), at the cost of $0.2$--$0.4\,\text{s}$ CPU inference instead of $2.3\,\text{ms}$ Wasm screening. With $12$ samples these figures are indicative only. \item \textbf{Small, Reused Evaluation Set and Untested Commercial Baselines:} \code{OOD-2026 Modern} has $56$ AI passages and was consulted during development. We have not run GPTZero, Originality.ai, Pangram, or ZeroGPT on it, so we make no claim of superiority over commercial detectors. \item \textbf{Short Snippets Below $50$ Words:} Reliable estimation of \textsf{MATTR-50}, dyadic $R/S$ Hurst exponents, co-occurrence clustering, and $64$-token sliding-window span statistics requires multiple sentences; below $250$ characters, both statistical and neural tiers exhibit wider confidence intervals and should not be used as standalone proof of authorship. \item \textbf{Heavy Paraphrase Attacks and Low-Volume Scripts:} While \textsc{ProseGuard} strips zero-width Unicode watermarks (\code{U+200B}, \code{U+2060}, \code{U+FEFF}), normalizes narrow no-break spaces (\code{U+202F}), and trains with DIPPER paraphrases and \textsf{SpanMix}, aggressive multi-pass paraphrasing on \code{RAID+MAGE} lowers recall at $1\%$ FPR to $50.7\%$--$53.9\%$ (compared to $76.5\%$ for $1.74\,\text{GB}$ English-only RAID specialists), and smaller public Japanese corpora leave Japanese accuracy behind English and Chinese.\end{enumerate}
Within those explicit boundaries, unifying a $679\,\text{KiB}$ exact-\textsf{TreeSHAP} WebAssembly statistical screener with $51.8\,\text{MB}$ browser \code{Q4} and $136$--$295.9\,\text{MB}$ \code{INT8} multi-head \code{mmBERT} verifiers gives a privacy-preserving, MIT-licensed path from millisecond client screening to neural verification that outperforms the open baselines we could run on the same 2026 passages, without uploading user manuscripts to cloud APIs. All code, quantized weights, and calibration metadata are publicly available at \url{https://huggingface.co/ElderRyan/proseguard}.
\bibliographystyle{plain}\bibliography{aidetect}
\end{document}.gitattributes+1
README.md+22
paper/aidetect.bibAdded+201
paper/aidetect.pdfAdded+3
paper/aidetect.texAdded+537