Multi-model Β· Rampart PII (14.7 MB q4 Β· CC-BY-4.0) β†’ ModernBERT-Base NLI (150.87 MB q8 Β· Apache-2.0)

Privacy-First Compliance Classifier (165.6 MB Total)

Stage 1 (nationaldesignstudio/rampart, reusing ../../rampart-pii/worker.js) strips raw names, emails, phones, SSNs, and IBANs with [TYPE_N] placeholders. Stage 2 (onnx-community/ModernBERT-base-nli-ONNX) classifies compliance risk strictly on the scrubbed payload β€” raw PII never reaches the NLI classifier.

1. Two independent on-device models (165.6 MB total)

Stage 1 Β· Rampart 35-Label PII Redactor (14.7 MB)

Reuses ../../rampart-pii/worker.js β€” WASM q4 35-label BIO token classification across 7 European languages.

Stage 2 Β· ModernBERT-Base NLI Classifier (150.87 MB)

Uses ../worker.js β€” WASM q8 long-context RoPE zero-shot routing strictly on Stage 1's redacted output.

2. Incoming record β†’ PII firewall β†’ compliance routing

Initialise both stages above to run the 2-stage privacy firewall + compliance classifier.

Stage 1 PII spans–
Top compliance route–
Top NLI score–
Stage 1 / Stage 2 ms–
NaN count (S1 / S2)–

Stage 1 Β· Local PII Highlights (Never Leaves Stage 1)

Run Stage 1 to highlight detected PII spans locally.

Firewall Handoff Β· Scrubbed Payload Passed to Stage 2

Only this redacted payload is sent to ModernBERT-Base NLI.

Stage 2 Β· ModernBERT-Base NLI Scores (on Scrubbed Payload)

Stage 2 ModernBERT-Base NLI 3-way logits on the redacted payload
Compliance category Entailment (prob / logit) Neutral (prob / logit) Contradiction (prob / logit) 3-way split Pair tokens
Run the 2-stage pipeline above to inspect Stage 2 logits.

3. Inspect reused Stage 1 & Stage 2 clients

Show the code Β· modernbert-nli.js β€” RampartPiiClient (reusing ../../rampart-pii/worker.js)
Show the code Β· worker.js β€” runClassification() (Stage 2 NLI)

References