pii-extractor-68M
Finds personal information (PII) in English text and returns the exact position of each value with one of 12 labels. 68M parameters, about 23 ms per 1,000 tokens on a T4 GPU.
Fine-tuned from jhu-clsp/ettin-encoder-68m.
Current version: v0.1 (use --revision v0.1 to pin it). Also available in 32M and 17M sizes.
Labels
| Label | Covers |
|---|---|
| PERSON | Names, including first names only, initials and nicknames |
| Email addresses | |
| PHONE | Phone and fax numbers |
| ADDRESS | Street addresses (a city or country on its own is not labelled) |
| DATE | Dates of birth only |
| URL | Web addresses, with or without https:// |
| ACCOUNT_NUMBER | Bank, card, IBAN and customer account numbers (not ticket or order numbers) |
| GOV_ID | Social security, passport, national ID, tax ID and driving licence numbers |
| USERNAME | Usernames and handles |
| SECRET | Passwords, PINs, access codes, API keys and tokens |
| IP_ADDRESS | IPv4 and IPv6 addresses |
| OTHER_ID | Employee, patient, member and device IDs |
How to use
1. Download and install
pip install -U huggingface_hub
hf download CobuildX-AI/pii-extractor-68M --revision v0.1 --local-dir pii-extractor-68M
cd pii-extractor-68M
pip install -r requirements.txt
2. Use it in your code
PIIExtractor (in pii.py, part of this repo) loads the model once:
from pii import PIIExtractor
pii = PIIExtractor() # uses a GPU if one is available
pii.extract("Hi team, I'm Priya Raman (priya.raman@northwind.com).")
# [{'label': 'PERSON', 'text': 'Priya Raman', 'start': 13, 'end': 24},
# {'label': 'EMAIL', 'text': 'priya.raman@northwind.com', 'start': 26, 'end': 51}]
pii.redact("Hi team, I'm Priya Raman (priya.raman@northwind.com).")
# "Hi team, I'm [PERSON] ([EMAIL])."
- The model finds the PII;
redact()replaces each found value with its label (or your owntemplate). - Context length: 7,999 tokens, read in a single pass. Only longer texts are split, automatically.
3. Optional: check your setup
python example.py runs three sample texts and prints what it finds.
Results
Exact-match span F1 on two public benchmarks never used for training: a value counts only if its start, end and label are all correct.
| Model | Size | Privacy-Bench | PII-TRACE | T4 GPU, 1,000 tokens |
|---|---|---|---|---|
| pii-extractor-68M | 68M | 88.3% | 82.4% | 23 ms |
| pii-extractor-32M | 32M | 87.5% | 84.6% | 16 ms |
| pii-extractor-17M | 17M | 86.0% | 81.2% | 15 ms |
| PII-Tracer | 596M | 86.5% | 92.6% | 271 ms |
| GLiNER2-PII | 205M | 83.7% | 62.2% | 199 ms |
Privacy-Bench: 656 human-annotated business document pages. PII-TRACE: 500 conversations; it is PII-Tracer's own benchmark, and most of our gap there comes from dates and reference codes, which we deliberately don't label.
How we evaluated
We ran every model ourselves, on the same texts, with the same scoring. Privacy-Bench contains 656 pages of Word and PDF business documents with 8,490 PII values annotated by people. PII-TRACE contains 500 multi-turn conversations with 2,442 annotated values (public subset). Neither was used for training, and any training text that also appears in either benchmark was removed.
A prediction counts as correct only when its start, end and type all match the annotation. Each benchmark's types were mapped to ours as below, and every model was scored on the types that both the benchmark and the model support.
| PII Extractor | Privacy-Bench | PII-TRACE |
|---|---|---|
| PERSON | NAME_GIVEN, NAME_FAMILY | private_person |
| EMAIL_ADDRESS | private_email | |
| PHONE | PHONE_NUMBER | private_phone |
| ADDRESS | LOCATION_ADDRESS | private_address |
| URL | URL | private_url |
| ACCOUNT_NUMBER | ACCOUNT_NUMBER | account_number |
| USERNAME | USERNAME | Not annotated |
| DATE | Not annotated | private_date |
| SECRET | Not annotated | secret |
GOV_ID, IP_ADDRESS and OTHER_ID are not annotated in either benchmark, so this evaluation does not cover them. Latency is the median of 50 texts of 1,000 tokens, one text at a time on a Tesla T4 GPU.
Limitations
- English only.
- Sensitive attributes such as health, religion or ethnicity are not detected in v0.1.
- Usernames, account numbers and links are found less reliably than names, emails and phones.
- A detection aid, not a guarantee: keep human review where redaction must be complete.
Licence
Apache-2.0. Trained on NVIDIA Nemotron-PII (CC-BY-4.0), Gretel PII masking EN v1 (Apache-2.0), Wismut nym-pii (MIT) and data we generated. Base model: Ettin (MIT, arXiv:2507.11412).
- Downloads last month
- -
Model tree for CobuildX-AI/pii-extractor-68M
Base model
jhu-clsp/ettin-encoder-68m