Instructions to use Wismut/nym-pii-multilingual with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wismut/nym-pii-multilingual with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="Wismut/nym-pii-multilingual")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("Wismut/nym-pii-multilingual") model = AutoModelForTokenClassification.from_pretrained("Wismut/nym-pii-multilingual") - Notebooks
- Google Colab
- Kaggle
nym-pii-multilingual
Multilingual PII token-classification model for the
nym anonymization CLI — a fine-tune of
jhu-clsp/mmBERT-base
(ModernBERT architecture, 1,800-language pretraining) on fully synthetic,
exactly-labeled PII data.
40 entity types / 81 BIO labels across ~23 languages and 6 scripts
(Latin, Cyrillic, CJK, Korean, Arabic, Devanagari): names, dates of birth,
emails, phones, street addresses, cities, government/medical/financial IDs,
credit cards, IBANs, API keys, passwords, and more. Trained with ~20% OCR-style
corruption (o→0, rn→m, typos, spacing), so it catches PII that scanning
mangles and exact regex misses.
Files
| File | Use |
|---|---|
model.safetensors |
PyTorch / transformers (fine-tuning, GPU inference) |
model.onnx |
ONNX fp32 — nym's default (accuracy-first) |
int8/ |
ONNX dynamic int8 variant: 309 MB vs 1.2 GB and ~3-4× faster on CPU, at a measured accuracy cost (see below). Use via token_model = "Wismut/nym-pii-multilingual/int8" |
Benchmarks
Cross-dataset (out-of-distribution for this model), span-level, label-agnostic
matching on 1,000 examples of ai4privacy/pii-masking-300k, via nym bench:
| Model | Precision | Recall | F1 |
|---|---|---|---|
| regex only | 79.2 | 27.8 | 41.2 |
| Rampart (MiniLM, in-distribution) | 80.9 | 68.5 | 74.2 |
| OpenMed-small (DeBERTa) | 77.8 | 74.1 | 75.9 |
| this model | 80.6 | 79.0 | 79.8 |
Held-out synthetic test set (in-distribution): P 99.0 / R 99.3 / F1 99.1.
int8 trade-off (same ai4privacy protocol, n=200): fp32 F1 81.0 → int8 76.7 (recall 79.9 → 72.6; hits person/time/zip recall hardest). Pick fp32 for accuracy, int8 for constrained machines.
Use with nym
This is nym's default token-classification model — with NER enabled it is downloaded and cached automatically. Explicitly:
[ner]
enabled = true
backend = "tokens" # or "both" to also run GLiNER
token_model = "Wismut/nym-pii-multilingual"
threshold = 0.5
Use with transformers
from transformers import pipeline
nlp = pipeline("token-classification", model="Wismut/nym-pii-multilingual",
aggregation_strategy="simple")
nlp("Patient John Smith, SSN 123-45-6789, lives at Hauptstraße 42, München.")
Training
- Data:
Wismut/nym-pii-multilingual-data— 69,000 synthetic examples (62,100 train), generated by an LLM writing[LABEL]-placeholder templates across a (language × topic × style × flavor) rubric, filled by Faker with locale-matched values so character-level labels are exact by construction; ~13% PII-free negatives; ~20% OCR/typo noise. Generation pipeline:scripts/datagenin the nym repo. - 3 epochs, lr 3e-5, batch 32, max_length 256, bf16, single RTX A6000
(~17 min). Training script:
scripts/train_ner.py. - ONNX export: opset 18 via optimum; int8 via onnxruntime dynamic quantization (functional — unlike DeBERTa-v2 it does not collapse — but with the accuracy cost quantified above).
Limitations
- Synthetic training data: strong on structured/semi-structured PII patterns; free-prose edge cases may differ from human-annotated data.
- Labels are English-named regardless of text language (by design — they map to nym's pattern names).
- No claim of HIPAA/GDPR compliance by itself; it is a detection component.
License
MIT (inherited from mmBERT-base). Synthetic training data contains no real personal information.
- Downloads last month
- 77
Model tree for Wismut/nym-pii-multilingual
Base model
jhu-clsp/mmBERT-base