Apache-2.0, zero-trust_remote_code, long-context (7,999 tokens) token classifier for AI agent runtime DLP — detecting 21 canonical PII, PHI, and developer/agent secret classes in a single forward pass.
Built by Tamarillo as a commercially clean drop-in alternative to non-commercial (CC-BY-NC-*) or 512-token-capped PII models. Trained exclusively on commercially permissive datasets (zero ai4privacy data) with explicit hard-negative calibration and long-context windowing.
| Property | Value |
|---|---|
| Base Model | jhu-clsp/ettin-encoder-32m |
| Architecture | ModernBertForTokenClassification (no trust_remote_code) |
| Parameters | 32M |
| Max Context Length | 7,999 tokens |
| Languages | English + Code / Logs / Agent Tool Outputs (English-only) |
| Entity Classes | 21 canonical classes (43 standard BIO labels) |
| CPU ONNX Latency | 8.85 ms p50 (FP32 ONNX, CPU, batch=1, ~45-tok input) |
| License | Apache-2.0 (100% commercially permissive training lineage) |
PERSON, EMAIL_ADDRESS, PHONE_NUMBER, STREET_ADDRESS, POSTAL_CODE, DATE_OF_BIRTH, SSN, GOVERNMENT_ID, PASSPORT, DRIVER_LICENSE, CREDIT_CARD, IBAN_CODE, BANK_ACCOUNT, MEDICAL_ID, USERNAME, IP_ADDRESS, PASSWORD, API_KEY, AUTH_TOKEN, DATABASE_URI, PRIVATE_KEY
Generic non-PII attributes (date, time, country, gender, occupation, language, generic url) are intentionally excluded to avoid production over-redaction.
model.safetensors — native PyTorch (transformers >= 4.48.0)onnx/model.onnx — FP32 (122.49 MB, CPU p50 8.85 ms, 2,048-tok token agreement vs. PyTorch: 1.0)onnx/model_fp16.onnx — FP16 (61.44 MB, CPU p50 12.0 ms, 2,048-tok token agreement vs. PyTorch: 1.0)onnx/parity_report.json — verified PyTorch-vs-ONNX logit diff and token-agreement reportscripts/eval_suite.py, scripts/taxonomy.py, scripts/synth_secrets.py, scripts/data_builder.py, scripts/train.py — reproducible data, training & evaluation scriptstransformers)pip install "transformers>=4.48.0" torch safetensors
from transformers import pipeline
scanner = pipeline(
"token-classification",
model="Tamarillo/pii-secrets-guard-tiny-en",
aggregation_strategy="simple",
)
text = (
"Patient Elena Vargas (elena.vargas@acme-fin.io, DOB 1988-04-12). "
"OPENAI_API_KEY=sk-proj-AbCdEf1234567890GhIjKlMnOpQrStUvWxYz0123456789"
)
for ent in scanner(text):
print(ent["entity_group"], repr(ent["word"]), round(ent["score"], 3))
# Expected output:
# PERSON ' Elena Vargas' 0.99...
# EMAIL_ADDRESS ' elena.vargas@acme-fin.io' 0.99...
# DATE_OF_BIRTH ' 1988-04-12' 0.99...
# API_KEY 'sk-proj-AbCdEf1234567890GhIjKlMnOpQrStUvWxYz0123456789' 0.99...
Verified live with presidio-analyzer >= 2.2.354 and en_core_web_sm:
pip install "transformers>=4.48.0" presidio-analyzer spacy
python -m spacy download en_core_web_sm
from presidio_analyzer import AnalyzerEngine
from presidio_analyzer.nlp_engine import NlpEngineProvider
nlp_config = {
"nlp_engine_name": "transformers",
"models": [
{
"lang_code": "en",
"model_name": {"spacy": "en_core_web_sm", "transformers": "Tamarillo/pii-secrets-guard-tiny-en"},
}
],
"ner_model_configuration": {
"model_to_presidio_entity_mapping": {
"PERSON": "PERSON",
"EMAIL_ADDRESS": "EMAIL_ADDRESS",
"PHONE_NUMBER": "PHONE_NUMBER",
"STREET_ADDRESS": "LOCATION",
"POSTAL_CODE": "LOCATION",
"DATE_OF_BIRTH": "DATE_TIME",
"SSN": "US_SSN",
"GOVERNMENT_ID": "ID",
"PASSPORT": "US_PASSPORT",
"DRIVER_LICENSE": "US_DRIVER_LICENSE",
"CREDIT_CARD": "CREDIT_CARD",
"IBAN_CODE": "IBAN_CODE",
"BANK_ACCOUNT": "US_BANK_NUMBER",
"MEDICAL_ID": "MEDICAL_LICENSE",
"USERNAME": "USERNAME",
"IP_ADDRESS": "IP_ADDRESS",
"PASSWORD": "PASSWORD",
"API_KEY": "API_KEY",
"AUTH_TOKEN": "AUTH_TOKEN",
"DATABASE_URI": "DATABASE_URI",
"PRIVATE_KEY": "PRIVATE_KEY"
},
"low_confidence_score_multiplier": 0.4,
"low_score_entity_names": [],
"labels_to_ignore": ["O"],
},
}
analyzer = AnalyzerEngine(nlp_engine=NlpEngineProvider(nlp_configuration=nlp_config).create_engine())
results = analyzer.analyze(text="Contact Elena Vargas at elena@acme-fin.io", language="en")
pip install "transformers>=4.48.0" onnxruntime huggingface_hub numpy
import json
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
repo_id = "Tamarillo/pii-secrets-guard-tiny-en"
tok = AutoTokenizer.from_pretrained(repo_id)
cfg = json.loads(open(hf_hub_download(repo_id, filename="config.json")).read())
id2label = {int(k): v for k, v in cfg["id2label"].items()}
onnx_path = hf_hub_download(repo_id, filename="onnx/model.onnx")
sess = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])
text = "DB=postgresql://svc:MyPass123!@db.internal:5432/prod"
enc = tok(text, return_tensors="np", return_offsets_mapping=True)
logits = sess.run(
["logits"],
{
"input_ids": enc["input_ids"].astype(np.int64),
"attention_mask": enc["attention_mask"].astype(np.int64),
},
)[0][0]
pred_ids = np.argmax(logits, axis=-1)
for (start, end), pid in zip(enc["offset_mapping"][0], pred_ids):
lbl = id2label[int(pid)]
if end > start and lbl != "O":
print(lbl, repr(text[int(start):int(end)]))
All checkpoints were selected strictly by validation metrics; evaluation was run with the bundled reproducible harness (scripts/eval_suite.py) using fair shared-entity typed F1 (IoU >= 0.50), identical canonical label normalization, and symmetric adjacent-span merging (first_name + last_name -> PERSON, building_number + street -> STREET_ADDRESS) for every baseline so no baseline is penalized for entity types it was not trained to predict.
n=600 per split)Splits: nvidia/Nemotron-PII (test), gretelai/gretel-pii-masking-en-v1 (test), gretelai/synthetic_pii_finance_multilingual (test; multilingual — out-of-scope for EN-only tiny-en), Wismut/nym-pii-multilingual-data (test; 23 languages — out-of-scope for EN-only tiny-en), and Agent-Secrets (split-disjoint templates generated by scripts/synth_secrets.py, n=600).
| Model (HF Repo ID) | Params | Max Len | Nemotron-EN | Gretel-EN | Gretel-Multi | Wismut-Multi | Agent-Secrets |
|---|---|---|---|---|---|---|---|
Tamarillo/pii-secrets-guard-tiny-en |
32.05M | 7999 | 0.984 | 0.971 | 0.622 | 0.508 | 0.888 |
Tamarillo/pii-secrets-guard-small |
140.66M | 8192 | 0.986 | 0.978 | 0.837 | 0.990 | 0.886 |
Tamarillo/pii-secrets-guard-base |
307.56M | 8192 | 0.985 | 0.976 | 0.844 | 0.990 | 0.937 |
iiiorg/piiranha-v1-detect-personal-information |
278.23M | 256 | 0.680 | 0.551 | 0.401 | 0.637 | 0.402 |
Isotonic/deberta-v3-base_finetuned_ai4privacy_v2 |
183.92M | 512 | 0.481 | 0.434 | 0.318 | 0.406 | 0.404 |
vllm-sr/mmbert32k-pii-detector-merged |
307.56M | 8192 | 0.193 | 0.209 | 0.147 | 0.257 | 0.059 |
Wismut/nym-pii-multilingual |
307.59M | 2048 | 0.622 | 0.688 | 0.444 | 0.999 | 0.172 |
kalyan-ks/ettin-68m-nemotron-pii |
68.46M | 2048 | 0.291 | 0.173 | 0.357 | 0.187 | 0.080 |
YalenLabs/yalen-pii-ner-bias-audit (benchmark/train, EN+FR, n=600) and BTX24/turkish-privacy-pii-ner (test, Turkish, n=600).HN FP, lower is better): % of n=500 clean developer/prose documents (git SHAs, SHA-256 digests, UUIDs, placeholder keys, env lookups) triggering >=1 false alarm (scripts/synth_secrets.py, split-disjoint test templates).LC @ 800 / 3.2K / 5K): Recall (n=60 docs per token depth) for PII & secrets buried past 800 / 3,200 / 5,000 tokens in a single forward pass. Note that 0.000 for <=2,048-token baselines reflects single-pass native context truncation without sliding-window chunking.transformers.pipeline on NVIDIA L4 (24 GB), batch_size=1, ~40-token input (n=15 runs after 3 warmups). At batch_size=1 on short inputs, 22-layer small (140M) and base (307M) are kernel-launch-bound (~26–28 ms). CPU ONNX p50 latencies in Available Runtime Artifacts were measured on an 8-vCPU x86_64 GCP host (CPUExecutionProvider, default ORT thread pool, batch_size=1, median over 4 short ~45–55-token inputs), where tiny-en (8.85 ms FP32), small (21.5 ms INT8), and base (34.2 ms INT8) scale cleanly with parameter count.| Model (HF Repo ID) | Params | OOD Yalen | OOD BTX24-TR | HN FP (↓) | LC Recall @ 800 / 3.2K / 5K | GPU p50 (L4, b=1) |
|---|---|---|---|---|---|---|
Tamarillo/pii-secrets-guard-tiny-en |
32.05M | 0.594 | 0.163 | 0.018 | 0.968 / 0.973 / 0.963 | 14.3 ms |
Tamarillo/pii-secrets-guard-small |
140.66M | 0.725 | 0.536 | 0.060 | 0.979 / 0.973 / 0.979 | 27.6 ms |
Tamarillo/pii-secrets-guard-base |
307.56M | 0.711 | 0.526 | 0.002 | 0.995 / 0.989 / 0.984 | 26.1 ms |
iiiorg/piiranha-v1-detect-personal-information |
278.23M | 0.715 | 0.379 | 0.000 | 0.000 / 0.000 / 0.000 | 25.8 ms |
Isotonic/deberta-v3-base_finetuned_ai4privacy_v2 |
183.92M | 0.746 | 0.141 | 0.344 | 0.000 / 0.000 / 0.000 | 26.4 ms |
vllm-sr/mmbert32k-pii-detector-merged |
307.56M | 0.606 | 0.196 | 0.684 | 0.779 / 0.647 / 0.559 | 27.8 ms |
Wismut/nym-pii-multilingual |
307.59M | 0.825 | 0.496 | 0.560 | 0.647 / 0.000 / 0.000 | 26.9 ms |
kalyan-ks/ettin-68m-nemotron-pii |
68.46M | 0.523 | 0.053 | 0.546 | 0.371 / 0.000 / 0.000 | 25.6 ms |
OOD Yalen & Wismut-Multi: Wismut/nym-pii-multilingual (0.825 on OOD Yalen, 0.999 on its own Wismut-Multi split) and Isotonic/deberta-v3-base_finetuned_ai4privacy_v2 (0.746 on OOD Yalen) outperform this model (0.594 on OOD Yalen, 0.508 on Wismut-Multi); on OOD Yalen, iiiorg/piiranha-v1-detect-personal-information (0.715) and Tamarillo/pii-secrets-guard-small (0.725) also score equal to or above base/tiny-en. However, wismut-nym-base and isotonic-deberta-v3 carry much higher developer hard-negative false-positive rates (0.560 and 0.344 vs. 0.018), miss agent secrets (0.172 and 0.404 vs. 0.888), and truncate single-pass inputs at 2,048 / 512 tokens (while Isotonic is non-commercial CC-BY-NC-4.0).piiranha-v1: iiiorg/piiranha-v1-detect-personal-information achieves 0.000 FP on developer/code hard negatives largely because it does not detect developer secrets (API_KEY, AUTH_TOKEN, DATABASE_URI, PRIVATE_KEY) and scores 0.402 on Agent-Secrets. This model trades a small non-zero FP rate (0.018) to achieve 0.888 F1 on agent secrets.tiny-en: Tamarillo/pii-secrets-guard-tiny-en (32M) is trained strictly on English prose and developer logs; on multilingual splits (Gretel-Multi, Wismut-Multi, OOD BTX24-TR) it underperforms multilingual models.OOD Yalen (0.594) and OOD BTX24-TR (0.163) are substantially lower than in-distribution synthetic splits; benchmark on your own production traffic before deployment.Trained with exact BIO token classification cross-entropy (group_by_length=True, cosine schedule, bf16, max_length=2048 with sliding-window overflow) on commercially permissive datasets only (zero ai4privacy data):
nvidia/Nemotron-PII (CC-BY-4.0)gretelai/gretel-pii-masking-en-v1 (Apache-2.0)scripts/synth_secrets.py). Uses strictly disjoint template families and separate RNG seeds across train, validation, and test splits (Agent-Secrets and HN FP), plus MD5 exact-text deduplication of all train rows against every validation and test split (scripts/data_builder.py).Best validation checkpoint (epoch 3.0): micro-F1 0.8865, macro-F1 0.8363, precision 0.8533, recall 0.9224.
LC@5K recall 0.963); inputs between 5,000 and 7,999 tokens were not separately benchmarked.tiny-en is trained strictly for English text and developer code/logs; use Tamarillo/pii-secrets-guard-small or Tamarillo/pii-secrets-guard-base for non-English languages.transformers >= 4.48.0 (native ModernBERT support).onnx/model.onnx 128 MBmodel.safetensors 128 MBonnx/model_fp16.onnx 64 MB