Basics · Inside BERT-Small PII (28.75 MB q8 · Apache-2.0) · 49 BIO Labels & Threshold Sweep

Inside BERT-Small PII: 49-Label Schema, BIO Merging & Precision/Recall

Explore the exact 49-label config.id2label space (O + 24 entity types × B-/I-) across 5 risk tiers, inspect raw WordPiece ## subword merging, and sweep 8 confidence thresholds live to measure precision, recall, and F1 on real model logits.

1. WordPiece ## BIO Stream & Merged Spans

WordPiece tokens–
## Subword pieces–
Non-O BIO tokens–
Merged spans (pass)–
NaN logit check–
Inference ms–

Step A · Raw B- / I- / O WordPiece Stream

Direct output of pipe(text, { ignore_labels: [] }). Subwords begin with ##.

Awaiting BERT-Small PII inference…

Step B · Merged Entity Spans (≥ 0.50)

Contiguous B-TYPE/I-TYPE runs, ## continuations, and tight punctuation bridges collapsed to exact offsets.

Awaiting BERT-Small PII inference…

Per-Token WordPiece & BIO Breakdown

WordPiece token, subword flag, original slice, BIO label, confidence score, and character offsets
Idx WordPiece Original Slice BIO Label Score Confidence Offsets
Run inspection above to populate per-token scores.

2. Live 8-Point Confidence Threshold Sweep (Precision / Recall / F1)

Evaluates real merged spans from the active ground-truth sample across thresholds 0.20–0.90 so you can pick the right operating point for strict blocking vs low false-positive redaction.

8-point confidence threshold sweep showing true positives, false positives, false negatives, precision, recall, and F1
Threshold Predicted TP / FP / FN Precision Recall F1 Score F1 Visual
Run inspection above to compute the live 8-point precision/recall sweep.

3. Exact 49-Label config.id2label Schema (5 Risk Tiers)

Grounded verbatim in live onnx-community/bert-small-pii-detection-ONNX/config.json (0: "O" plus IDs 1–48 across 24 entity types). Cards highlight when detected in the active text.

4. Inspect BIO Alignment & Threshold Sweep Code

Show the code · bert-pii-core.mjs — alignTokensToText() (WordPiece offset + NaN audit)
Show the code · bert-pii-core.mjs — evaluateSpansAgainstGroundTruth() (Precision / Recall / F1)
Show the code · worker.js — ensureLoaded() (epoch-guarded 28.75 MB WASM q8 load)