The base model ships with 8 coarse PII categories (private_person,
private_email, etc.). This model trades that coarse vocabulary for a
5× more granular one — first_name, last_name, medical_record_number,
credit_debit_card, ssn, and so on — matching what downstream redaction
and masking pipelines typically need.
Family at a glance. Same architecture, three runtimes:
PyTorch (this repo) — CPU + CUDA, anywhere transformers runs.
OpenMed gives you extract_pii() / deidentify() with built-in BIOES Viterbi
decoding, span refinement, and a Faker-backed obfuscation engine. Same call
on every host — Apple Silicon picks up MLX automatically; everywhere else uses
this PyTorch checkpoint.
pip install -U "openmed[hf]"
python
1from openmed import extract_pii, deidentify
23text =(4"Patient Sarah Johnson (DOB 03/15/1985), MRN 4872910, "5"phone 415-555-0123, email sarah.johnson@example.com."6)78# Extract grouped entity spans9result = extract_pii(text, model_name="OpenMed/privacy-filter-nemotron")10for ent in result.entities:11print(f"{ent.label:30s}{ent.text!r} conf={ent.confidence:.2f}")1213# De-identify with any of the supported methods14masked = deidentify(text, method="mask", model_name="OpenMed/privacy-filter-nemotron")15removed = deidentify(text, method="remove", model_name="OpenMed/privacy-filter-nemotron")16hashed = deidentify(text, method="hash", model_name="OpenMed/privacy-filter-nemotron")1718# Faker-backed locale-aware obfuscation, deterministic with consistent=True+seed19fake = deidentify(20 text,21 method="replace",22 model_name="OpenMed/privacy-filter-nemotron",23 consistent=True,24 seed=42,25)26print(fake.deidentified_text)
OpenMed/privacy-filter-nemotron-mlx* model names also work in the same
extract_pii() / deidentify() calls — on a non-Apple-Silicon host they
automatically fall back to this PyTorch checkpoint with a one-time
warning. So you can ship MLX names in code and still run on Linux/Windows.
The OpenMed wrapper passes trust_remote_code=True for you, runs the
model's own BIOES Viterbi decoder, and skips OpenMed's regex
smart-merging (the model already produces clean spans).
With opf — OpenAI's official CLI
bash
1pip install'opf @ git+https://github.com/openai/privacy-filter.git'23opf redact \4 --checkpoint OpenMed/privacy-filter-nemotron \5 --text "Patient Sarah Johnson (DOB 03/15/1985), MRN 4872910, phone 415-555-0123."
With transformers directly
python
1import torch
2from transformers import AutoModelForTokenClassification, AutoTokenizer
34model_id ="OpenMed/privacy-filter-nemotron"5tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)6model = AutoModelForTokenClassification.from_pretrained(7 model_id, trust_remote_code=True, dtype=torch.bfloat16
8).to("cuda")9model.eval()1011text ="Patient Sarah Johnson (DOB 03/15/1985), MRN 4872910, phone 415-555-0123."12enc = tok(text, return_tensors="pt").to("cuda")13with torch.no_grad():14 out = model(**enc).logits.argmax(-1).cpu()[0].tolist()1516id2label ={int(k): v for k, v in model.config.id2label.items()}17tokens = tok.convert_ids_to_tokens(enc["input_ids"][0].cpu().tolist())18for t, l inzip(tokens, out):19if l !=0:20print(f"{t}\t{id2label[l]}")
For best results use Viterbi decoding (not argmax) — both opf and OpenMed
do this by default. If you're doing argmax with the HF transformers API, you'll
see slightly more boundary errors but still excellent label accuracy.
Performance
Evaluated with opf eval --decode-mode viterbi --eval-mode typed --span-metrics-space char
on the 10K label-stratified held-out val from nvidia/Nemotron-PII:test.
Head initialization: opf's default "copy-from-matching-base" head init.
Of the 221 new BIOES classes, 5 had exact matches in the base
(O, B/I/E/S-account_number); the other 216 were copied from
semantically-adjacent coarse rows and fine-tuned end-to-end.
Router: base model has 128 MoE experts per layer with top-4 routing.
Routers were kept trainable during full fine-tuning; no collapse was
observed.
Limitations & intended use
English-only training data. Nemotron-PII is predominantly English
with a 50/50 US/international locale split. Performance on non-English
text is not guaranteed.
occupation, language, gender, state, race_ethnicity,
political_view, education_level are fuzzier categories than the
strict identifiers — F1 lands in 0.65–0.89 vs 0.95+ for formatted
identifiers. If your downstream only cares about strict PII, you can
ignore low-confidence predictions on these.
Synthetic training data. Nemotron-PII is a synthesized dataset; real
clinical notes, legal documents, and web text may show different
surface forms. For high-stakes deployments, collect a domain-specific
eval set and re-calibrate thresholds.
Not a substitute for legal compliance review. Use alongside a
governance layer (human review, deterministic regex pre-filters, etc.).
Credits & Acknowledgements
This model wouldn't exist without two open-source releases — sincere thanks
to both teams:
OpenAI for open-sourcing the Privacy Filter
(architecture, modeling code, and opf training/eval CLI). Everything in
this repo is a fine-tune on top of that release.
NVIDIA for releasing the Nemotron-PII dataset
with its 100K-row train split and 55 fine-grained PII labels.
Additional thanks to the HuggingFace team for the transformers /
huggingface_hub ecosystem this model ships through.
License
Apache 2.0, same as the base model.
Citation
If you use this model, please cite this model, the organization behind
it (OpenMed), and the upstream base model + dataset:
bibtex
1@misc{openmed_privacy_filter_nemotron_2026,
2 author = {OpenMed},
3 title = {{OpenMed/privacy-filter-nemotron}: fine-grained PII extraction with 55 categories},
4 year = {2026},
5 publisher = {Hugging Face},
6 howpublished = {\url{https://huggingface.co/OpenMed/privacy-filter-nemotron}}
7}
89@misc{openmed_2026,
10 author = {OpenMed},
11 title = {{OpenMed}: open models and resources for healthcare NLP},
12 year = {2026},
13 publisher = {Hugging Face},
14 howpublished = {\url{https://huggingface.co/OpenMed}}
15}
1617@misc{openai_privacy_filter_2025,
18 author = {OpenAI},
19 title = {{openai/privacy-filter}},
20 year = {2025},
21 publisher = {Hugging Face},
22 howpublished = {\url{https://huggingface.co/openai/privacy-filter}}
23}
2425@misc{nemotron_pii_2025,
26 author = {NVIDIA},
27 title = {{Nemotron-PII}},
28 year = {2025},
29 publisher = {Hugging Face},
30 howpublished = {\url{https://huggingface.co/datasets/nvidia/Nemotron-PII}}
31}