Polaris-Mist: Zero-Regex Bidirectional LLM + BIOES CRF PII Redaction

Polaris-Mist (arXiv:2612.00074, RightWay AI Research) replaces fragile regex pipelines and slow multi-second autoregressive redactors with unmasked bidirectional LLMs (Qwen3-8B, GLM-4-9B-0414, EuroBERT-2.1B, Phi-4-14.7B), punctuation-isolated pre-tokenization, and a constrained 49-tag BIOES CRF. It hits 0.9987 F1 (99.56% character recall) on enterprise Suite E with 0/29 false alarms in 5–134 ms per document.
Polaris-Mist: Zero-Regex Bidirectional LLM + BIOES CRF PII Redaction: Polaris-Mist (arXiv:2612.00074, RightWay AI Research) replaces fragile regex pipelines and slow multi-second autoregressive redactors with unmasked bidirectional LLMs (Qwen3-8B, GLM-4-9B-0414, EuroBERT-2.1B, Phi-4-14.7B), punctuation-isolated pre-tokenization, and a constrained 49-tag BIOES CRF. It hits 0.9987 F1 (99.56% character recall) on enterprise Suite E with 0/29 false alarms in 5–134 ms per document. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Zero Inference-Time Regexes or Blacklists: Detects clause-level trade secrets (discount floors, margin redlines, M&A thresholds) alongside PII while avoiding false positives on git SHAs and [email protected].
- 0.9987 Enterprise Span F1 & 0/29 Negative False Alarms: Achieves 99.56% character recall on frozen Suite E, 0.9251 on Nemotron-PII, 0.9066 on Gretel PII, and 0.9077 on multilingual piimb.
- Sub-135 ms Privacy Gateway Latency: Runs in 4.51–17.58 GiB BF16 VRAM (2.1B–9B models) at 5–134 ms amortized BS=8 GPU forward+Viterbi time—over 25x faster than autoregressive Qwen3.5-9B (3,574 ms/doc).
- Punctuation-Isolated Pre-Tokenization: Eliminates subword straddling across English and Chinese contracts, lifting Suite D exact match from 80.0% to 95.0%.
import { createAgent } from '@smoke-monkey/harness';// Reversible privacy-gateway pattern: redact locally via Polaris-Mist before external cloud callsasync function redactLocally(rawDoc: string): Promise<{ maskedText: string; mapId: string }> {const res = await fetch(process.env.POLARIS_MIST_URL || 'http://127.0.0.1:8090/v1/redact', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify({ text: rawDoc, taxonomy: 'D12', reversible: true }),});if (!res.ok) throw new Error(`Polaris-Mist gateway error: ${res.status}`);return (await res.json()) as { maskedText: string; mapId: string };}const agent = createAgent({agentId: 'redacted-contract-reviewer',provider: 'anthropic',model: 'claude-sonnet-5-5',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},});async function main() {const rawContract = 'Counterparty Acme Holdings agreed to a 14.2% net margin floor for [email protected].';const { maskedText, mapId } = await redactLocally(rawContract);const result = await agent.run(`Review obligations in this scrubbed clause (session ${mapId}): ${maskedText}`);console.log('Zero-leakage review summary:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Redact PII Before It Reaches Your LLM | Postman Fabric Gateway
Can LLM Gateways Make Enterprise AI Safer?
Why Presidio and Autoregressive LLMs Fail Enterprise Privacy Gateways
Reversible privacy gateways scrub sensitive spans locally into deterministic surrogate tokens ([NAME_e0], [TRADE_SECRET_e1]) before prompts leave corporate networks. Existing approaches break in opposite ways:
- Rule + Compact NER (`Presidio`, `Piiranha-v1`): Miss semantic trade secrets (unannounced discount floors, M&A walk-away numbers) and trigger high false-positive rates on benign developer strings like
sha256:digests, git SHAs, TCP ports, or[email protected]specifiers. - Autoregressive LLM Redaction: Takes 3,574 ms/doc even on Qwen3.5-9B SFT, risks JSON schema failures, and degrades in recall near the end of dense documents (>=1,200 chars).
| Redaction Engine | Nemotron-PII F1 / Lat | Gretel PII EN F1 / Lat | piimb Multi F1 / Lat | Suite E F1 (Char Recall) |
|---|---|---|---|---|
| Microsoft Presidio (EN) | 0.6417 / 22 ms | 0.4806 / 13 ms | 0.4153 / 14 ms | 0.3159 (25.3% recall) |
| Piiranha-v1 (280M) | 0.7073 / 21 ms | 0.4880 / 17 ms | 0.8151 / 19 ms | 0.3341 |
| Polaris-Mist v7 (2.1B–9B) | 0.9251 | 0.9066 | 0.9077 | 0.9987 (99.56% recall) |
Three Architectural Innovations: Unmasking, Punctuation Isolation & BIOES CRF
Polaris-Mist (arXiv:2612.00074) converts pure self-attention causal decoders (Qwen3-8B, GLM-4-9B-0414, Phi-4-14.7B)—or native long-context encoders (EuroBERT-2.1B)—into single-pass bidirectional sequence labelers:
- Causal Unmasking + `lm_head` Pruning: Setting
is_causal = Falseacross all layers lets early tokens attend rightward, verified pre-training by suffix perturbation (Δ_doc,0 = 7.625on Qwen3-8B,14.000on GLM-4-9B). Droppinglm_headsaves 1.16 GiB BF16 VRAM on Qwen3-8B/GLM-4-9B and 0.96 GiB on Phi-4. (Hybrid recurrent models like Qwen3.5-9B with Gated DeltaNet are excluded because directional recurrences cannot invert via mask removal.) - Punctuation-Isolated Pre-Tokenization: Standard BPE merges punctuation across sensitive span boundaries (capping oracle Suite D exact match at 86.7%); isolating punctuation tokens restores a 100.0% ceiling and lifts achieved Suite D exact match from 80.0% to 95.0%.
- Constrained 49-Tag BIOES CRF: Models the 12-class D12 enterprise taxonomy (
name,phone,email,address,id,order,account,credential,organization, plus trade-secret/quasi-identifier classes) with Viterbi transition constraints trained under length-normalized NLL.
Memory & Throughput Sizing (L40S 48 GB)
EuroBERT-2.1B, Qwen3-8B, and GLM-4-9B-0414 require 4.51–17.58 GiB BF16 VRAM and run in 5–134 ms amortized per document (BS=8), achieving 0/29 false alarms on negative technical test cases.
Verifying Bidirectional Unmasking & Pre-Flight Redaction Gates
Before fine-tuning or deploying an unmasked decoder as a local privacy proxy, verify full rightward information flow across the attention stack:
import torch
def verify_bidirectional_flow(model, prefix_ids, doc_a_ids, doc_b_ids):
"""Confirms final-token suffix edits shift token index L_p by > 1e-4."""
with torch.no_grad():
h_a = model(torch.cat([prefix_ids, doc_a_ids], dim=1)).last_hidden_state
h_b = model(torch.cat([prefix_ids, doc_b_ids], dim=1)).last_hidden_state
lp = prefix_ids.shape[1]
delta = (h_a[0, lp] - h_b[0, lp]).abs().max().item()
assert delta > 1e-4, f"Causal leakage detected: delta={delta}"
print(f"Verified bidirectional propagation: delta_doc_0 = {delta:.3f}")Deploy Polaris-Mist as a pre-flight middleware in Smoke Monkey Harness so every file read or ticket snippet is deterministically scrubbed before touching external APIs.
Frequently Asked Questions
Q:How fast is Polaris-Mist compared to autoregressive LLM redaction?
Polaris-Mist 2.1B–9B models run in 5–134 ms amortized per document at batch size 8 (4.51–17.58 GiB BF16 VRAM), compared to 3,574 ms per document for autoregressive Qwen3.5-9B SFT.
Q:Why does Polaris-Mist avoid hybrid recurrent models like Qwen3.5-9B?
Hybrid models interleave directional recurrent layers (such as Gated DeltaNet) whose causal state transitions cannot be made bidirectional merely by removing the attention mask.
Q:How much does punctuation-isolated pre-tokenization improve accuracy?
Isolating punctuation boundaries eliminates subword straddling on English and Chinese contracts, raising the theoretical Suite D oracle ceiling from 86.7% to 100.0% and achieved exact match from 80.0% to 95.0%.
Q:Does Polaris-Mist trigger false positives on git commit hashes or package versions?
No. The D12 taxonomy explicitly excludes public git SHAs, sha256: digests, version strings, TCP/UDP ports, and [email protected] specifiers, achieving 0/29 negative false alarms in controlled evaluations.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.