token-classification · 28.75 MB WASM q8 · 4-Layer BERT-Small · 49 BIO Labels · Apache-2.0

BERT-Small 49-Label PII — ~15 ms Gateway & Keystroke Scrubber

gravitee-io/bert-small-pii-detection (served via onnx-community/bert-small-pii-detection-ONNX, Apache-2.0) is a compact 4-layer BERT-Small encoder (28.75 MB q8 WASM) built for real-time API gateway guardrails — fast enough (~15 ms warm CPU inference) to scrub JSON payloads, auth logs, and live keystrokes locally before any data leaves your browser.

Upstream Model gravitee-io/bert-small-pii-detection
ONNX Artifact onnx-community/bert-small-pii-detection-ONNX
Pipeline Task token-classification
Size & Quant 28.75 MB · WASM q8
Label Space 49 BIO tags (24 types)
License Apache-2.0

1. Live Keystroke-Speed API Payload Scrubber

Local API Gateway Privacy: Loads onnx/model_quantized.onnx (28,748,527 B, Apache-2.0) via shared Transformers.js into a dedicated Web Worker. Zero payloads leave your device.

Pick a synthetic gateway/log preset, drag & drop or paste (Ctrl/Cmd+V) a payload, or type live:

Drop a .txt/.json/.csv/.log/.md file here, press Ctrl/Cmd+V anywhere on the page, or type with Live Keystroke Scrubbing enabled.
Redaction mode:
Inference latency–
Throughput–
Entities detected–
WordPiece tokens–
NaN logit check–
Backend / dtypeWASM · q8
Identity (Person, Org, Title, Age, NRP) Contact (Email, Phone, URL, Location, Coord) Financial & Gov ID (Card, IBAN, SSN, Passport) Network & Auth (IP, MAC, IMEI, Password) Temporal (Date / Time)

Detected PII Highlights

Initialize BERT-Small PII above to scan payloads locally.

Redacted Payload ([TYPE_N] Tag)

Redacted output will appear here after scanning.

2. WordPiece BIO Span Inspector Table

Every span below is collapsed from raw WordPiece B-/I-/O predictions with Unicode-normalized character offsets and structured punctuation bridging.

Detected PII entity spans, risk tiers, replacements, confidence scores, and character offsets
# Entity Type Risk Tier Detected Text Replacement Confidence Char Span
Run a scan above to inspect detected PII spans.

3. Why 4-Layer BERT-Small PII Matters & How the API Works

Fine-tuned by Gravitee.io from prajjwal1/bert-small (4 layers, 512 hidden dim) on gravitee-io/pii-detection-dataset, this model trades heavyweight 12-layer footprints for keystroke-speed CPU WASM execution (~15 ms warm) across 49 BIO tags including network/API secrets (IP_ADDRESS, MAC_ADDRESS, IMEI, PASSWORD).

import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.5";

const classifier = await pipeline(
  "token-classification",
  "onnx-community/bert-small-pii-detection-ONNX",
  { device: "wasm", dtype: "q8" }
);
const rawTokens = await classifier(payload, { ignore_labels: [] });
Show the code · worker.js — runSingleAnalysis() & analyze() (WASM q8 worker)
Show the code · bert-pii-core.mjs — mergeBioSpans() (49-label BIO merger)