ProseGuard (AIDetect): Three-Tier Client-to-Server Multilingual AI Text Detection from \(679\,\text{KiB}\) WebAssembly to Multi-Head mmBERT Verifiers
3571a33e3ec65e1e…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 ProseGuard (building on our AIDetect WebAssembly core), an open-weight, MIT-licensed multilingual detection suite spanning three progressive deployment tiers inside a single unified repository (https://huggingface.co/ElderRyan/proseguard): Tier 1 (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; Tier 2 (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}\) INT8 edge/server model; and Tier 3 (ProseGuard-mmBERT-base), a \(22\)-layer, \(8{,}192\)-token server verifier (\(295.9\,\text{MB}\) INT8). Tier 1 maps input text onto a \(28\)-dimensional orthogonal statistical basis (Dual-PPM, concave Mixture MLE \(\hat{\alpha}\), DivEye surprisal dynamics with \(R/S\) Hurst exponent, word co-occurrence topology, script-isolated NBSVM, and cadence forensics) paired with out-of-fold LightGBM, Isotonic-Platt calibration, and stack-allocated exact TreeSHAP. Tiers 2 and 3 extend Johns Hopkins CLSP's pretrained mmBERT encoder with tri-pooled \(3\)-way document classification (Human, AI-Assisted, AI-Native), continuous edit-intensity regression, a branch-free \(64\)-token sliding-window span detector trained via online 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 (OOD-2026 Modern, \(338\) human vs. \(56\) AI passages), the shipped \(136\,\text{MB}\) INT8 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 Oxidane/TMR and \(25.0\%\) for 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.
1.Introduction#
Current methods for detecting machine-generated text split into two regimes with incompatible deployment trade-offs:
Server-Side Neural Scoring and Fine-Tuned Classifiers: Zero-shot probability-curvature detectors such as DetectGPT [1], Fast-DetectGPT [2], GLTR [3], and Binoculars [4] 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 [5, 6]. 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.
Lightweight Non-Neural Heuristics: Browser-local or CPU-only tools often fall back on single-file Lempel–Ziv compression ratios (e.g., ZipPy [7]), raw sentence-length variance, or static lists of RLHF transition phrases (“delve into,” “it is important to note”). As our baseline experiments confirm (Section 5), 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 [8] and structured technical prose.
This paper asks two linked systems and statistical questions: (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 ProseGuard (open weights at https://huggingface.co/ElderRyan/proseguard; live client-side systems at https://prosegrain.com/ and https://aidetect.rist.edu.rs), unifying our \(679\,\text{KiB}\) AIDetect statistical engine (ProseGuard-ML, Tier 1) with two distilled multi-head neural verifiers (ProseGuard-mmBERT-small, Tier 2, and ProseGuard-mmBERT-base, Tier 3). Our main technical contributions are:
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 (
ml_tables.bin, \(327{,}696\,\text{bytes}\)): a \(3\)-order dual-distribution Markov model (Dual-PPM), Liang et al.'s distributional mixture fraction \(\hat{\alpha}\) [9] solved via concave Newton–Raphson iteration, \(9\text{D}\) surprisal rhythm derivatives [10] augmented with a Rescaled-Range (\(R/S\)) Hurst exponent [11], word co-occurrence small-world clustering [12] and degree assortativity [13], a formatting-invariant signed feature-hashedNBSVM[14, 15], and decimal-safe stylometric cadence and Unicode watermark scans.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 (
0x4A41_0000) that isolates Japanese Kanji buckets whenever Hiragana or Katakana are present.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 [16] to continuous soft targets \(y \in [0, 1]\) for co-authored human+AI articles, fit a tail-blended Isotonic and Platt calibrator [17] 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\%\)).
Stack-Allocated Exact
TreeSHAPand Integrity Attestation in Wasm: We implement exact path-dependentTreeSHAP[18] in pure safe Rust using fixed stack buffers (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.Multi-Head
mmBERTDistillation and \(51.8\,\text{MB}\) BrowserQ4Compaction: To catch frontier models that evade surface N-gram tables (such asclaude-opus-5andqwen-3.8-27b), we build Tiers 2 and 3 on Johns Hopkins CLSP's \(8{,}192\)-tokenmmBERTencoder [19], adding tri-pooled \(3\)-way document classification, continuous edit-intensity regression, a branch-free \(64\)-token sliding-window span detector supervised via onlineSpanMix, and an asymmetric low-FPR hinge loss across \(495{,}571\) MIT/Apache/CC-BY-SA documents. DistillingmmBERT-baseintommBERT-smalland compacting the \(256\text{K}\) vocabulary into an \(O(1)\) \(65{,}536\)-tokenuint16table yields a \(51.8\,\text{MB}\) \(4\)-bit browser ONNX model (\(76.8\%\) TPR@1%FPR onOOD-2026 Modern, against \(25.0\%\) for thee5-small-lorabrowser baseline), while the \(136\,\text{MB}\) and \(295.9\,\text{MB}\)INT8tiers reach \(94.6\%\) and \(96.4\%\), with wide confidence intervals.
2.Architecture and Packed Level-1 Statistical Tables#
Figure 1 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.
ml_tables.bin and gbdt_forest.bin) are immutable include_bytes! slices with zero runtime deserialization heap overhead. #2.1Cross-Script Tokenization and Namespace Isolation#
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:
Zero-Byte Traditional-to-Simplified Projection (\(\pi_{\mathrm{cjk}}\)): High-frequency Traditional Chinese function characters and grammatical markers (such as
U+9019\(\to\)U+8FD9[zh\`e],U+5011\(\to\)U+4EEC[men],U+500B\(\to\)U+4E2A[g\`e],U+70BA\(\to\)U+4E3A[w\'ei],U+8207\(\to\)U+4E0E[y\vu],U+5C0D\(\to\)U+5BF9[du\`i],U+8AAA\(\to\)U+8BF4[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.Japanese Kana Salt Isolation: Japanese prose uses hundreds of Kanji codepoints identical to Chinese Hanzi in
U+4E00–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 (U+3040–U+309F) or Katakana (U+30A0–U+30FF) scalar. Whenever \(\mathbb{I}_{\mathrm{kana}}(x) = 1\), every token unit and N-gram hash in \(x\) is XOR-salted with0x4A41_0000, routing Japanese text to a collision-isolated virtual subspace within the same \(B = 2^{16} = 65{,}536\) bucket array.
Tokenization produces a stream of \(32\)-bit unit hashes \(u_1, \dots, u_T\) via \(64\)-bit SplitMix64 mixing (0x9E3779B97F4A7C15, avalanche multipliers 0xBF58476D1CE4E5B9 and 0x94D049BB133111EB): lowercase alphanumeric words for alphabetic spans and individual canonicalized ideographs/kana for CJK spans.
2.2Packed \(320\,\text{KiB}\) Binary Table Layout (ml_tables.bin)#
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:
1. Dual-Distribution Hashed PPM (Dual-PPM).
In server-side detectors such as Fast-DetectGPT [2] and Binoculars [4], 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:
quantized as \(\mathrm{round}(24 \cdot \mathrm{LLR}_{\mathrm{PPM}}[b]) \in [-127, 127]\) (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 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.
2. Concave Distributional Mixture MLE (\(\hat{\alpha}\)).
Following Liang et al. [9], 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 (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:
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)\).
Differentiating (2) twice with respect to \(\alpha \in [0, 1]\) yields
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.
In 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}\)).
3. Formatting-Invariant Feature-Hashed 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 [14] combined with sublinear TF scaling [15]. 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 formatting invariance by stripping Markdown structural punctuation (\#, *, `, >) 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 i8 relative to the \(99.9\)th-percentile magnitude (\(z_{23}, z_{24}\)).
2.3Zero-Table Structural, Fractal, and Network Features#
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:
DivEye \(9\text{D}\) Surprisal Dynamics and Fractal Hurst Exponent (\(z_5\)–\(z_{12}\)): Motivated by DivEye [10], 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
Dual-PPMsurprisal stream \(s_{1:n}\). We further compute Hurst's Rescaled-Range (\(R/S\)) exponent \(H \in (0, 1)\) [11] 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.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)}\) [12] and Newman's degree assortativity coefficient \(r \in [-1, 1]\) [13], which differentiates hub-and-spoke functional topologies typical of natural human prose (more negative \(r\)) from uniform clause reuse.
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 (
1.8x to 4.3x), byte sizes (8.58 MB), and file extensions (.rs,.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 (MATTR-50) [20], length-invariant Yule's \(K = 10^4 (\sum_v c_v^2 - N)/N^2\), ZipPy LZ77 compression ratio [7], specificity density, and zero-width /U+202Fnarrow no-break space watermark scans.
3.Out-of-Fold Boosting, Soft Labels, and Exact TreeSHAP#
3.1Two-Stage Out-of-Fold Protocol and Continuous Soft Targets#
If a Level-2 tree ensemble is trained on the same documents used to fit Level-1 hashed counts (Dual-PPM, Mixture MLE, and NBSVM), in-fold margins exhibit artificially wide separation (\(>94\%\) accuracy on Fold-A), causing the tree booster to assign \(>85\%\) split gain to 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:
Level-1 Hashed Table Estimation (\(N_{\mathrm{Fold\text{-}A}} = 82{,}046\)): Fit
ml_tables.binexclusively on Fold-A. Freezeml_tables.binand 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\)).Regularized Feature-Subsampled LightGBM (\(N_{\mathrm{OOF}} = 46{,}805\)): Train a depth-bounded LightGBM ensemble [16] (
max_depth=5,num_leaves=24,feature_ fraction=0.45,bagging_ fraction=0.85, \(\lambda_1 = 2.0\), \(\lambda_2 = 8.0\),min_child_ samples=65, \(115\) trees, \(5{,}219\) total nodes) using the continuous cross-entropy objective:\[\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].\](1)Because both Equation (1) (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.
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)\) [17] 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.
3.2Causal Topic Deconfounding Under Domain Adaptation#
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{\texttt{protocol}}, \text{\texttt{blockchain}}, \text{\texttt{consensus}}, \text{\texttt{emacs}}, \text{\texttt{buffer}}, \text{\texttt{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 5.4), 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 topic-matched pre-LLM human corpora (specifically pre-2021 GNU Emacs etc/NEWS.19–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 Dual-PPM and NBSVM to separate stylistic generation patterns rather than topic nouns.
3.3Stack-Allocated Exact Path-Dependent TreeSHAP#
Opaque probability percentages are insufficient for editorial review; users need to know which orthogonal signal family drove a classification and which sentences carry the strongest AI or human signatures. For every prediction, AIDetect runs Lundberg et al.'s exact polynomial-time path-dependent TreeSHAP algorithm [18] 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)\) (extend_path, unwind_path, and leaf coalition weighting using pre-recorded training node cover \(C_v\)) reside inside fixed stack arrays of length 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:
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.
4.Multi-Head Neural Verifiers and Browser Q4 Distillation#
While Tier 1 (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 claude-opus-5 in Section 5). 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\%\) [5]. To close this gap without sacrificing local execution or open licensing, Tiers 2 and 3 (ProseGuard-mmBERT-small and ProseGuard-mmBERT-base) introduce a multi-head bidirectional encoder architecture built upon Johns Hopkins CLSP's MIT-licensed mmBERT [19, 21].
4.1Tri-Pooled Multi-Head mmBERT Architecture#
Both jhu-clsp/mmBERT-base (\(22\) layers, hidden dimension \(D = 768\), \(8{,}192\)-token context) and jhu-clsp/mmBERT-small (\(D = 384\), \(8{,}192\)-token context) extend ModernBERT [21] 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 [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\):
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\)):
\[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).\](1)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\) (
0: Human,1: AI-Assisted/Polished,2: AI-Native) and continuous AI intervention fraction \(\hat{e}(x) = \sigma(w_e^\top u(x)) \in [0, 1]\).
4.2Online SpanMix, Asymmetric Low-FPR Hinge, and Distillation#
To ensure that all released neural weights carry clean MIT commercial rights, we exclude non-commercial (NC) corpora (AIGC-text-bank and 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 [5], MAGE [6], HC3 [22], 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 human to AI-Assisted.
During training, two mechanisms enforce span localization and strict low-FPR calibration:
Online
SpanMixand 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\) (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.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{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}\](1)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.
We first train the \(22\)-layer teacher (ProseGuard-mmBERT-base) in bfloat16 on Apple M1 Max Metal MPS, then distill the student (ProseGuard-mmBERT-small) online by combining hard-label loss (6) (\(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:
4.3\(65{,}536\)-Vocab Compaction and \(51.8\,\text{MB}\) Browser Q4 Export#
In mmBERT-small, the \(256{,}000 \times 384\) token embedding matrix alone consumes \(393\,\text{MB}\) in 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 (U+4E00–U+9FFF), Hiragana/Katakana (U+3000–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 (vocab_ remap_ u16.bin, 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 INT8 embedding Gather quantization and \(4\)-bit block-wise MatMulNBits quantization to linear layers compresses ProseGuard-mmBERT-small from \(538\,\text{MB}\) (FP32) to \(136\,\text{MB}\) (full-vocab INT8 ONNX) and \(51.8\,\text{MB}\) (\(45.1\,\text{MiB}\) gzipped, 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.
5.Experimental Evaluation#
5.1Datasets and Evaluation Splits#
Table 1 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) OOD-2026 (\(N=700\), 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) OOD-NLPCC25 (\(N=4{,}000\), official NLPCC-2025 Task 1 test split featuring unseen DeepSeek-V3 Chinese generations).
| Split | Role in Pipeline | Docs | AI Share | Constituent Sources & Languages |
|---|---|---|---|---|
| Fold-A | Level-1 Hashed Tables (ml_tables.bin) | \(82{,}046\) | \(48.4\%\) | AIGC-Bank, WildAI, artem9k, rasbt, HC3 [22], |
| Fold-B + Dev | Out-of-Fold LightGBM (gbdt_forest.bin) | \(46{,}805\) | \(48.4\%\) | RAID [5], MAGE [6], C-ReD, NLPCC25-tr, |
| Calib. Val | Isotonic + Platt Calibration (\(42\) knots) | \(7{,}959\) | \(49.6\%\) | AnxForever, OpenCC s2twp, minko186 (JA), |
| Held-out Test | In-distribution Multilingual Test | \(12{,}914\) | \(50.5\%\) | + Topic-deconfounded technical & soft-label split |
| OOD-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 |
5.2Baseline Comparison and Orthogonal Feature Ablations#
Table 2 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. [4], 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).
| Held-out Multilingual Test (\(N=12{,}914\)) | OOD-2026 | NLPCC25 | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Model / Feature Basis | AUC | Acc% | TPR@1% | TPR@5% | Brier | ECE | AUC | Acc% | AUC |
| 1. LZ77 Compression Alone [7] | 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 | 94.29 | 0.9296 |
| 7. Full \(28\text{D}\) Ensemble (Raw Logistic) | 0.9700 | 91.25 | 73.64% | 87.03% | 0.0652 | 0.0160 | 0.9098 | 93.71 | 0.9592 |
| 8. AIDetect Full \(28\text{D}\) (Calibrated) | 0.9700 | 91.14 | 73.64% | 87.03% | 0.0650 | 0.0071 | 0.9098 | 93.00 | 0.9592 |
Three empirical findings stand out in Table 2:
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.
Complementarity Between Markov Curvature, Rhythm, and Lexical Hashing: While formatting-invariant
NBSVMis the strongest individual family in-domain (\(0.9536\) AUC, Row 5),Dual-PPM+Mixture MLEalone actually slightly outperformsNBSVMalone 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 overNBSVMalone (\(64.29\% \to 73.64\%\)) and lifts Held-out AUC to \(0.9700\).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.
5.3Multilingual Breakdown and OOD-2026 Fairness Analysis#
Table 3 reports performance stratified by language across the \(12{,}914\) held-out test documents. Notably, Traditional Chinese (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 (ja) reaches \(0.8784\) ROC-AUC (\(80.00\%\) accuracy on \(N=50\) held-out docs); while Kana salt isolation (0x4A41_0000) prevents Chinese Hanzi interference, smaller public Japanese training volume leaves a clear accuracy gap relative to Chinese and English.
| Language | Test Docs | ROC-AUC | PR-AUC | Acc% | F1 | FPR@0.5 | TPR@1%FPR | Brier |
|---|---|---|---|---|---|---|---|---|
English (en) | \(8{,}600\) | 0.9579 | 0.9557 | 89.37% | 0.8811 | 9.52% | 63.61% | 0.0776 |
Simplified Chinese (zh-Hans) | \(3{,}664\) | 0.9877 | 0.9938 | 94.76% | 0.9587 | 5.33% | 87.53% | 0.0393 |
Traditional Chinese (zh-Hant) | \(600\) | 0.9941 | 0.9944 | 95.33% | 0.9522 | 2.33% | 89.00% | 0.0332 |
Japanese (ja) | \(50\) | 0.8784 | 0.8979 | 80.00% | 0.7826 | 12.00% | 44.00% | 0.1565 |
| All Held-out Test | \(\mathbf{12{,}914}\) | 0.9700 | 0.9746 | 91.14% | 0.9118 | 8.33% | 73.64% | 0.0650 |
Table 4 breaks down OOD-2026 (\(N=700\)) by sub-domain. On the critical fairness slice of non-native English biomedical papers (human-pmc-esl, \(N=183\)), 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. [8] 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, AIDetect detects gpt-oss-120b (\(83.33\%\)) and gpt-4.1 (\(75.00\%\)), drops to \(58.33\%\) and \(50.00\%\) on claude-haiku-4-5 and qwen-3.8-27b, and misses claude-opus-5 completely (\(0.00\%\) at threshold \(0.5\), mean predicted AI \(19.65\%\)). Inspecting feature attributions on 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.
| OOD-2026 Sub-Domain | Ground Truth | Docs | Accuracy @ \(0.5\) | Mean Pred. AI% |
|---|---|---|---|---|
pd-literature (Public-Domain Books) | Human | \(306\) | \(99.35\%\) | \(4.15\%\) |
human-pmc-esl (Non-Native ESL Biomedical) | Human | \(183\) | \(96.17\%\) | \(9.00\%\) |
human-wikipedia-pre2022 (Pre-ChatGPT Wiki) | Human | \(155\) | \(90.97\%\) | \(17.20\%\) |
gpt-oss-120b | AI | \(12\) | \(83.33\%\) | \(71.93\%\) |
gpt-4.1 | AI | \(12\) | \(75.00\%\) | \(62.48\%\) |
claude-haiku-4-5 | AI | \(12\) | \(58.33\%\) | \(56.28\%\) |
qwen-3.8-27b | AI | \(8\) | \(50.00\%\) | \(53.32\%\) |
claude-opus-5 | AI | \(12\) | \(0.00\%\) | \(19.65\%\) |
5.4Topic Deconfounding, Soft-Label Co-Authorship, and Wasm Latency#
Table 5 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 TreeSHAP, and sentence attribution).
TreeSHAP). #| Technical Evaluation Passage | Naive | Deconf. | Document Size | Bytes | p50 | p99 |
|---|---|---|---|---|---|---|
| Rings / 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\%\) | Binary: \(679\,\text{KiB}\) raw Wasm (\(389\,\text{KiB}\) gzip), \(0\) Cargo deps | |||
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\)), 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.
5.5Three-Tier Progression and External Detector Comparison#
To evaluate how all three 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: ROC-AUC (\(1.0 =\) ideal ranking separation between human and AI documents across all thresholds; \(0.5 =\) random coin flip) and 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).
1. Same-Split Head-to-Head on OOD-2026.
TextSight [23] assembled OOD-2026 specifically to expose inflated detector claims: removing its pre-1940 Victorian literature negative control leaves 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 claude-opus-5, claude-haiku-4-5, gpt-4.1, gpt-oss-120b, and qwen-3.8-27b). Based on 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 6 scores the shipped ProseGuard files (INT8 and Q4 ONNX, Wasm) alongside RoBERTa-Base OpenAI and the per-passage e5-small-lora and 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:
The neural tiers rank better than the open baselines we could run. Both
INT8tiers exceed \(0.99\) ROC-AUC, and the lower end of themmBERT-smallINT8TPR interval (\(85.7\%\)) sits above the upper end ofOxidane/TMR(\(69.6\%\)). The \(51.8\,\text{MB}\)Q4build loses about \(18\) points of recall to quantization and vocabulary compaction.The \(1\%\) FPR point is fragile. With \(338\) human passages the threshold rests on about three documents.
mmBERT-basereaches \(96.4\%\) but its interval spans \(46.4\)–\(100\%\), and only \(12\)claude-opus-5passages exist, so per-generator recall should be read as indicative.ESL false positives depend on calibration, not only on ranking. At a uniform \(0.5\) threshold,
mmBERT-smallINT8flags \(13.7\%\) of the \(183\) non-Anglophone PubMed papers, similar toOxidane/TMR(\(13.1\%\)), while ProseGuard-ML (\(3.8\%\)),mmBERT-base(\(4.4\%\)), and theQ4build (\(0.5\%\)) are lower. These are copy-edited published papers, so they are a weak proxy for learner writing.Validation reuse. We evaluated on
OOD-2026several times during development, so it served partly as a validation set.
OOD-2026 Modern [23] (\(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. #| Detector | Footprint | ROC-AUC | TPR@1%FPR | Opus 5 | ESL @0.5 |
|---|---|---|---|---|---|
| RoBERTa-Base OpenAI | \(501\,\text{MB}\) FP32 | 0.316 | 0.0% | 0/12 | 8.2% |
TextSight 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 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] |
| 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] |
| 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] |
| 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] |
| 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] |
2. Multilingual, Hybrid Polish, and Adversarial Benchmarks Across Tiers.
Table 7 compares all three ProseGuard tiers across four stratified \(1{,}400\)-document multilingual benchmarks (seed=20261204). On Chinese DeepSeek-V3 with adversarial perturbations (NLPCC-2025, unseen by the neural tiers), TPR@1%FPR scales monotonically across tiers from \(58.3\%\) (ML) to \(75.5\%\) (mmBERT-small) and \(90.3\%\) (mmBERT-base, \(81.6\%\) at \(0.1\%\) FPR). On AnxForever Chinese hybrid tasks (continuation, rewriting, and light AI polishing), mmBERT-small and mmBERT-base raise recall on lightly AI-polished human drafts at \(1\%\) human FPR from \(59.9\%\) (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), ProseGuard-mmBERT-base predicts \(50.95\%\) AI (\(49.1\%\) Human, \(37.7\%\) AI-Assisted, \(13.2\%\) AI-Native).
| NLPCC-2025 (ZH) | C-ReD (ZH) | AnxForever Hybrid (ZH) | RAID + MAGE (EN) | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Model Tier | AUC | TPR@1% | AUC | TPR@1% | AUC | TPR@1% | Polish@1% | AUC | TPR@1% |
| ProseGuard-ML (\(679\,\text{KiB}\) Wasm) | 0.9647 | 58.3% | 0.9985 | 97.1% | 0.9800 | 79.8% | 59.9% | 0.8272 | 44.5% |
| ProseGuard-mmBERT-small (\(136\,\text{MB}\)) | 0.9840 | 75.5% | 0.9990 | 96.8% | 0.9845 | 83.6% | 72.7% | 0.8975 | 53.9% |
| ProseGuard-mmBERT-base (\(295.9\,\text{MB}\)) | 0.9922 | 90.3% | 0.9989 | 97.5% | 0.9847 | 75.5% | 74.2% | 0.8621 | 50.7% |
3. Published Numbers for Commercial and Larger Detectors.
We did not run commercial APIs. Table 8 lists published results from the ACL 2024 RAID study [5], the live RAID leaderboard, and Liang et al. [8] 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 6. 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.
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 [24] (
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 ProseGuard-mmBERT-small (\(53.9\%\) on our combinedRAID+MAGEOOD split). Those detectors are English-only or cloud-hosted, and \(6\times\)–\(50\times\) larger than ourINT8tiers; we did not test them on Chinese or Japanese text.
| Detector | Deployment & License | Languages | RAID@5%FPR | Min FPR | RAID@1%FPR | ESL Human FPR |
|---|---|---|---|---|---|---|
| ZeroGPT [5, 8] | Closed Cloud API | Multilingual | \(65.5\%^*\) | \(16.90\%\) | Unreachable | \(61.3\%\) (TOEFL) |
| GPTZero [5, 8] | Closed Cloud API | Multilingual | \(66.5\%\) (2024) | \(<1.00\%\) | \(92.9\%\) (Live API) | \(51.6\%\) (2023 TOEFL) |
| Originality.ai [5] | Closed Cloud API | Multilingual | \(85.0\%\) | \(0.62\%\) | – | – |
| Winston AI [5] | Closed Cloud API | EN / FR / ES | \(71.0\%\) | \(<5.00\%\) | – | – |
| RoBERTa-ChatGPT [22, 5] | Open (\(499\,\text{MB}\)) | EN (sep. ZH) | \(44.8\%\) | \(<5.00\%\) | \(19.6\%\) | – |
| RADAR [25, 5] | Open (\(1.4\,\text{GB}\)) | EN only | \(70.9\%\) | \(<1.00\%\) | – | – |
| Fast-DetectGPT [2, 5] | Open (\(\sim 12\,\text{GB}\) GPU) | EN-centric | \(73.6\%\) | \(0.88\%\) | – | – |
| Binoculars [4, 5] | Open (\(\sim 14\,\text{GB}\) \(2\times 7\text{B}\)) | EN-centric | \(79.6\%\) | \(<0.10\%\) | \(69.5\%\) (Clean) | \(<1.0\%\) |
| Desklib v1.01 [24] | Open MIT (\(1.74\,\text{GB}\)) | EN only | – | \(<1.00\%\) | \(76.5\%\) (In-dom.) | – |
| ProseGuard-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) |
6.Limitations and Conclusion#
Across its three deployment tiers, ProseGuard makes explicit trade-offs between footprint, latency, and adversarial robustness:
Tier-1 Statistical Ceiling vs. Tier-2/3 Neural Verification: As shown on
claude- opus-5in Tables 4 and 6, 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 ProseGuard-ML). The multi-headmmBERTtiers catch more of these passages (\(6/12\) in the \(51.8\,\text{MB}\)Q4build, \(11/12\) inmmBERT- small INT8, \(10/12\) inmmBERT- 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.Small, Reused Evaluation Set and Untested Commercial Baselines:
OOD-2026 Modernhas \(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.Short Snippets Below \(50\) Words: Reliable estimation of
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.Heavy Paraphrase Attacks and Low-Volume Scripts: While ProseGuard strips zero-width Unicode watermarks (
U+200B,U+2060,U+FEFF), normalizes narrow no-break spaces (U+202F), and trains with DIPPER paraphrases andSpanMix, aggressive multi-pass paraphrasing onRAID+MAGElowers 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.
Within those explicit boundaries, unifying a \(679\,\text{KiB}\) exact-TreeSHAP WebAssembly statistical screener with \(51.8\,\text{MB}\) browser Q4 and \(136\)–\(295.9\,\text{MB}\) INT8 multi-head 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 https://huggingface.co/ElderRyan/proseguard.
Key Questions & Empirical Summary (FAQ)#
- What are the three ProseGuard deployment tiers?
- ProseGuard-ML is a 679 KiB Rust/Wasm statistical screener with exact TreeSHAP. ProseGuard-mmBERT-small is a distilled neural verifier available as a 51.8 MB Q4 browser model or a 136 MB INT8 model. ProseGuard-mmBERT-base is a 295.9 MB INT8 verifier. The neural models provide Human, AI-Assisted, and AI-Native probabilities, edit-intensity estimates, and token-span scores. Code and weights are released at huggingface.co/ElderRyan/proseguard under the MIT license.
- What does the ProseGuard Rev. 2 evaluation establish?
- On OOD-2026 Modern (338 human and 56 AI passages), small INT8 reaches 94.6% TPR at 1% FPR (95% bootstrap CI: 85.7–100%), base INT8 reaches 96.4% (46.4–100%), and browser Q4 reaches 76.8% (62.5–91.1%). At score 0.5, ESL false-positive rates on 183 published biomedical papers are 13.7%, 4.4%, and 0.5%, respectively. The set was reused during development, samples are small, and commercial APIs were not evaluated on this split.
References#
- [1]Mitchell, Eric and Lee, Yoonho and Khazatsky, Alexander and Manning, Christopher D. and Finn, Chelsea, “DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature,” Proceedings of the 40th International Conference on Machine Learning (ICML), pp. 24950–24962, 2023.
- [2]Bao, Guangsheng and Zhao, Yanbin and Teng, Zhiyang and Yang, Linyi and Zhang, Yue, “Fast-DetectGPT: Efficient Zero-Shot Detection of Machine-Generated Text via Conditional Probability Curvature,” International Conference on Learning Representations (ICLR), 2024.
- [3]Gehrmann, Sebastian and Strobelt, Hendrik and Rush, Alexander M., “GLTR: Statistical Detection and Visualization of Generated Text,” Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 111–116, 2019.
- [4]Hans, Abhimanyu and Schwarzschild, Avi and Cherepanova, Valeriia and Kazemi, Hamid and Saha, Aniruddha and Goldblum, Micah and Geiping, Jonas and Goldstein, Tom, “Spotting LLMs With Binoculars: Zero-Shot Detection of Machine-Generated Text,” Proceedings of the 41st International Conference on Machine Learning (ICML), 2024.
- [5]Dugan, Liam and Hwang, Alyssa and Trhl\'\ik, Filip and Ludan, Josh Magnus and Zhu, Andrew and Xu, Hainiu and Ippolito, Daphne and Callison-Burch, Chris, “RAID: A Shared Benchmark for Robust Evaluation of Machine-Generated Text Detectors,” Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (ACL), pp. 12463–12492, 2024.
- [6]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, “MAGE: Machine-Generated Text Detection in the Wild,” Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (ACL), pp. 36–53, 2024.
- [7]Thinkst Applied Research, “ZipPy: Fast AI/LLM Text Detection via Compression Ratios,” https://github.com/thinkst/zippy, 2023.
- [8]Liang, Weixin and Yuksekgonul, Mert and Mao, Yining and Wu, Eric and Zou, James, “GPT Detectors Are Biased Against Non-Native English Writers,” Patterns, vol. 4, no. 7, pp. 100779, 2023.
- [9]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., “Monitoring AI-Modified Content at Scale: A Case Study on the Impact of ChatGPT on AI Conference Peer Reviews,” Proceedings of the 41st International Conference on Machine Learning (ICML), 2024.
- [10]Basani, Sai and Chen, Pin-Yu, “DivEye: Surprising Rhythm Over Raw Perplexity for Robust Machine-Generated Text Detection,” Transactions on Machine Learning Research (TMLR), 2025.
- [11]Hurst, Harold Edwin, “Long-Term Storage Capacity of Reservoirs,” Transactions of the American Society of Civil Engineers, vol. 116, no. 1, pp. 770–799, 1951.
- [12]Watts, Duncan J. and Strogatz, Steven H., “Collective Dynamics of `Small-World' Networks,” Nature, vol. 393, no. 6684, pp. 440–442, 1998.
- [13]Newman, Mark E. J., “Assortative Mixing in Networks,” Physical Review Letters, vol. 89, no. 20, pp. 208701, 2002.
- [14]Weinberger, Kilian and Dasgupta, Anirban and Langford, John and Smola, Alex and Attenberg, Josh, “Feature Hashing for Large Scale Multitask Learning,” Proceedings of the 26th International Conference on Machine Learning (ICML), pp. 1113–1120, 2009.
- [15]Wang, Sida and Manning, Christopher D., “Baselines and Bigrams: Simple, Good Sentiment and Topic Classification,” Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics (ACL), pp. 90–94, 2012.
- [16]Ke, Guolin and Meng, Qi and Finley, Thomas and Wang, Taifeng and Chen, Wei and Ma, Weidong and Ye, Qiwei and Liu, Tie-Yan, “LightGBM: A Highly Efficient Gradient Boosting Decision Tree,” Advances in Neural Information Processing Systems (NeurIPS), vol. 30, 2017.
- [17]Zadrozny, Bianca and Elkan, Charles, “Transforming Classifier Scores into Accurate Multiclass Probability Estimates,” Proceedings of the 8th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 694–699, 2002.
- [18]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, “From Local Explanations to Global Understanding with Explainable AI for Trees,” Nature Machine Intelligence, vol. 2, no. 1, pp. 56–67, 2020.
- [19]Marone, Marc and Weller, Orion and Fleshman, William and Yang, Eugene and Lawrie, Dawn and Van Durme, Benjamin, “mmBERT: A Modern Multilingual Encoder,” arXiv preprint arXiv:2509.06888, 2025.
- [20]Covington, Michael A. and McFall, Joe D., “Cutting the Gordian Knot: The Moving-Average Type–Token Ratio (MATTR),” Journal of Quantitative Linguistics, vol. 17, no. 2, pp. 94–100, 2010.
- [21]Warner, Benjamin and Chaffin, Antoine and Clavié, Benjamin and Weller, Orion and Hallströ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, “Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference,” arXiv preprint arXiv:2412.13663, 2024.
- [22]Guo, Biyang and Zhang, Xin and Wang, Ziyuan and Jiang, Minqi and Nie, Jinran and Ding, Yuxuan and Yue, Jianwei and Wu, Yupeng, “How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detection,” arXiv preprint arXiv:2301.07597, 2023.
- [23]TextSight, “AI Text Detection: A Control Set That Does Not Flatter Detectors,” https://huggingface.co/datasets/textsightai/ai-text-detection-benchmark-2026, 2026.
- [24]Desklib, “Desklib AI Text Detector v1.01,” https://huggingface.co/desklib/ai-text-detector-v1.01, 2025.
- [25]Hu, Xiaomeng and Chen, Pin-Yu and Ho, Tsung-Yi, “RADAR: Robust AI-Text Detection via Adversarial Learning,” Advances in Neural Information Processing Systems (NeurIPS), vol. 36, 2023.