ProseGuard-ML

ProseGuard-ML is a zero-dependency Rust and WebAssembly engine for client-side AI-generated text detection and sentence-level attribution across English, Simplified Chinese, Traditional Chinese, and Japanese.

The entire compiled binary and quantized statistical parameters fit in 679 KiB (prose_guard_wasm.wasm, 389 KiB gzipped) and execute locally in 2.5 to 6.8 ms per document with zero network uploads.

Architecture

ProseGuard-ML maps each input UTF-8 document onto a 28-dimensional feature vector backed by two immutable binary tables (weights/ml_tables.bin at 320 KiB and weights/gbdt_forest.bin at 154 KiB):

  1. Dual-Distribution Hashed PPM (Dual-PPM): Orders 1 to 3 hashed Markov transition log-likelihood ratios with empirical Bayes shrinkage and conditional Shannon surprisal estimation.
  2. Concave Distributional Mixture MLE: Estimates the document AI mixture fraction $\hat{\alpha} \in [0, 1]$ via damped Newton-Raphson iteration over smoothed unigram and bigram likelihoods.
  3. Surprisal Rhythm & Hurst Exponent: 9D conditional surprisal derivatives paired with a Rescaled-Range ($R/S$) Hurst exponent.
  4. Word Co-occurrence Network Topology: Local clustering coefficient and degree assortativity on sliding lexical graphs.
  5. Formatting-Invariant Signed Feature-Hashed NBSVM: 65,536-bucket Rademacher-signed sublinear TF n-gram linear scorer with zero-byte Traditional-to-Simplified CJK folding and Japanese Kana hash-salt isolation (0x4A41_0000).
  6. Out-of-Fold LightGBM + Exact Stack-Allocated TreeSHAP: A 115-tree calibrated gradient-boosted forest trained on disjoint folds with Isotonic + Platt tail calibration and exact path-dependent Shapley attributions in WebAssembly.

Repository Contents

  • prose_guard_wasm.wasm: Compiled wasm32-unknown-unknown release module (679 KiB).
  • wasm-loader.js: Self-contained ES/CommonJS loader with SHA-256 and IEEE 802.3 CRC32 verification.
  • weights/ml_tables.bin: Packed 65,536-bucket Dual-PPM, Mixture MLE, and NBSVM table (320 KiB).
  • weights/gbdt_forest.bin: Calibrated 115-tree LightGBM forest with node cover statistics (154 KiB).
  • rust_src/: Complete zero-dependency Rust source crate ([dependencies] in Cargo.toml is empty).

Quick Start (Node.js / Browser)

import './wasm-loader.js';

const ProseGuard = globalThis.ProseGuardWasm;
await ProseGuard.initWasmEngine();

const report = ProseGuard.analyzeArticle(
  'Paste any English, Chinese, or Japanese article here for local inspection.',
  { genreCode: 0, sensitivityCode: 1 }
);

console.log({
  aiPct: report.aiPct,
  verdict: report.verdict,
  mleAlphaPct: report.mleAlphaPct,
  sentences: report.sentences,
});

Benchmark

OOD-2026 Modern same-split comparison

On OOD-2026 Modern (338 human vs 56 AI passages, 2026 generators), ProseGuard-ML reaches 0.864 ROC-AUC and 39.3% TPR@1%FPR (95% CI 21 to 52%). That is below Oxidane/TMR (50.0%) and above e5-small-lora (25.0%). It misses all 12 Claude Opus 5 passages at 1% FPR. At a 0.5 threshold it flags 3.8% (7/183) of non-native PubMed papers.

Held-out splits (N=1,400, TPR@1%FPR): NLPCC-2025 Chinese 58.3%, C-ReD 97.1%, AnxForever 79.8%, RAID+MAGE 44.5%.

Use it as a 2 to 7 ms first pass and send borderline text to mmbert-small or mmbert-base. Commercial APIs (GPTZero, Originality.ai, Pangram, ZeroGPT) have not been tested on this split. Full caveats: main Model Card.

Limitations

Without deep transformer representations, sub-megabyte n-gram and rhythm models miss unseen frontier generators that deliberately suppress standard transition templates and vary sentence cadence (such as Claude Opus 5 in OOD-2026). For high-stakes verification against frontier models, pair ProseGuard-ML as a fast first-pass filter with ProseGuard-mmBERT-small or ProseGuard-mmBERT-base.

License

Released under the MIT License.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support