Safety & Control
~9 min readUpdated: December 2026

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

Polaris-Mist Bidirectional LLM and 49-Tag BIOES CRF Enterprise PII Redaction Gateway in Smoke Monkey

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.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

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.

Key Architectural Takeaways
Quick Implementation Examplepolaris-mist-privacy-gate-agent.ts
polaris-mist-privacy-gate-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Reversible privacy-gateway pattern: redact locally via Polaris-Mist before external cloud calls
async 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);
Video Guides

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 pkg@1.2.0 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 EngineNemotron-PII F1 / LatGretel PII EN F1 / Latpiimb Multi F1 / LatSuite E F1 (Char Recall)
Microsoft Presidio (EN)0.6417 / 22 ms0.4806 / 13 ms0.4153 / 14 ms0.3159 (25.3% recall)
Piiranha-v1 (280M)0.7073 / 21 ms0.4880 / 17 ms0.8151 / 19 ms0.3341
Polaris-Mist v7 (2.1B–9B)0.92510.90660.90770.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:

  1. Causal Unmasking + `lm_head` Pruning: Setting is_causal = False across all layers lets early tokens attend rightward, verified pre-training by suffix perturbation (Δ_doc,0 = 7.625 on Qwen3-8B, 14.000 on GLM-4-9B). Dropping lm_head saves 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.)
  2. 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%.
  3. 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:

python
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.

Google Search Questions & Answers

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 pkg@1.2.0 specifiers, achieving 0/29 negative false alarms in controlled evaluations.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness