You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

pii-nemotron-mmbert-base-v1

A PII detector: jhu-clsp/mmBERT-base fine-tuned to find 18 kinds of personal data in English text. It is trained on the clean rows of NVIDIA's Nemotron-PII only, with our labels (abubasith86/pii-nemotron-our-clean-v1).

At a glance

Test: all 51,225 rows of Nemotron's test file (never seen in training), scored on whole spans. The scores cover the 16 trained labels; PASSPORT and DRIVING_LICENCE are not trained and not tested (see Labels).

Recall Precision F2 Typed F1 Documents with a leaked identifier Normal text masked by mistake Speed (GPU)
0.996 0.996 0.996 0.990 0.64% 0.02% 6.8 ms / doc

Nemotron is synthetic text from one generator. These scores show how well the model learned this data; scores on real text will be lower. The test on our own real text is still to be done.

Labels

One label per token, BIO tags (37 tags = O + B-/I- for each label):

PERSON_NAME, DATE, AGE, EMAIL, PHONE, ADDRESS, BANK_ACCOUNT, CARD_NUMBER, NATIONAL_ID, TAX_ID, PASSPORT, DRIVING_LICENCE, USERNAME, URL, IP_ADDRESS, CUSTOMER_ID, PASSWORD, API_KEY

16 of the 18 labels are trained. PASSPORT and DRIVING_LICENCE have no examples in Nemotron (neither in its train nor its test file), so the model never learned them and no score in this card covers them. Their tags exist in the model, but it does not predict them.

How Nemotron's labels became ours (the dataset card has the full table and counts):

  • first_name, last_name → PERSON_NAME; a full name is one span ("Mi Patel"), names apart by a comma, full stop or new line stay separate.
  • street_address, postcode, city, state, county, country → ADDRESS; parts next to each other are one span ("84 Washington Blvd, Charlottesville, Virginia, 22901, USA"); a place name alone is ADDRESS too.
  • date, date_of_birth, date_time → DATE · phone_number, fax_number → PHONE · ssn, national_id → NATIONAL_ID · customer_id, unique_id, employee_id → CUSTOMER_ID · password, pin → PASSWORD · api_key, http_cookie → API_KEY · account_number → BANK_ACCOUNT · credit_debit_card → CARD_NUMBER · the rest one to one.
  • 24 Nemotron labels are not ours and were left as normal text: company_name, occupation, time, cvv, language, religious_belief, vehicle_identifier, license_plate, medical_record_number, and others. The model does not mask them.

Results

Split Rows Recall Precision F2 Typed F1 Leak % Over-masking
test (Nemotron test file, all rows) 51,225 0.996 0.996 0.996 0.990 0.64% 0.0002
validation (5% of the train file, per token) 2,534 0.998 0.997 0.998 – – –

Recall per label on the test rows:

Label Recall Label Recall
CARD_NUMBER 1.000 API_KEY 0.999
EMAIL 1.000 USERNAME 0.999
TAX_ID 1.000 PERSON_NAME 0.998
URL 1.000 CUSTOMER_ID 0.997
NATIONAL_ID 1.000 PASSWORD 0.995
PHONE 1.000 ADDRESS 0.991
IP_ADDRESS 1.000 DATE 0.990
BANK_ACCOUNT 0.999 AGE 0.986
PASSPORT not tested (no examples) DRIVING_LICENCE not tested (no examples)

Scoring (pii/eval/evaluate.py): recall and precision count a span found when it overlaps the true span; typed F1 needs the exact span and the right label; leak % is the share of documents where an identifier (name, email, phone, address, an ID, ...) is missed; over-masking is the share of normal characters masked by mistake. Speed: one document at a time on one NVIDIA GeForce RTX 4070 SUPER, fp16, measured while the Presidio baselines ran on the same GPU (5.7 ms on an idle GPU).

Compared with Presidio

The same 51,225 test documents through Microsoft Presidio with 7 different NER models (pii/eval/presidio_demo.py, their labels mapped to ours) and through our earlier model pii-generic-mmbert-base-v1 (trained on 5 datasets before the current cleaning and label rules), scored with the same code.

Scores of this model, our earlier model and the 7 Presidio setups on the same 51,225 test documents

Recall and precision of every model, weakest to strongest

Recall per label: our two models and the 7 Presidio setups

True and false positives and negatives, per character (48.4 million characters, 8.4% of them PII). Each character is PII or normal text, and masked or left as is:

TP, FN, FP and TN per character, every model

Every model, share of all characters:

Model TP: PII masked FN: PII left visible FP: normal text masked TN: normal text left ms / doc
This model 8.39% 0.03% 0.02% 91.57% 6.8
Presidio + OpenMed SuperClinical 434M 8.26% 0.15% 0.72% 90.86% 77.3
Presidio + OpenMed GTEMed 149M 8.12% 0.29% 1.06% 90.52% 55.8
Presidio + GLiNER PII (nvidia) 7.78% 0.64% 3.15% 88.44% 156.8
Presidio + GLiNER PII edge 7.85% 0.56% 3.59% 87.99% 46.4
Presidio + flair large 7.04% 1.37% 0.50% 91.09% 40.9
Presidio + spaCy lg 6.94% 1.48% 1.41% 90.18% 13.3 (CPU)
Presidio + Stanza 6.82% 1.59% 1.17% 90.42% 147.7
Our earlier model (pii-generic-mmbert-base-v1) 5.36% 3.05% 0.01% 91.57% 6.8

This model leaves about 6× less PII visible and masks about 40× less normal text than the best Presidio setup, and is about 11× faster. Our earlier model leaves 3.05% of the PII characters visible, mostly in five labels whose rule changed after it was trained (a city alone, every date, every URL, employee IDs, national IDs). This model was trained on the same generator's train file (different documents), which helps it here; on Presidio's own test data (presidio-research synth_dataset_v2, 1,500 documents) it finds 98.2% of the PII (precision 0.999).

Known limits

Found by testing the model alone (docs/model_tests/): the clean test with the text changed, 101 hand-written sentences, and Presidio's own test set.

  1. Capital letters change the result. Lower-case names are often labelled USERNAME ("thanks ravi"; on the test rows with only the names in lower case, 48% of names); all upper-case text leaks about 5× more (0.48% → 2.40% of documents) and 3.4× more on Presidio's test (3.1% → 10.6%).
  2. ID formats it never saw are missed or labelled wrong: IBANs (labelled NATIONAL_ID or CARD_NUMBER), driving licences and passports (never predicted: Nemotron has none), Indian PAN, order and ticket IDs, card numbers without spaces (often CUSTOMER_ID).
  3. Names with a middle initial stop at the initial: Martim A Pereira → only Martim is masked, so the surname stays visible.
  4. One data source only: every training row comes from one synthetic generator in English. Chat-style text, disguised PII ("nine eight four five…", "john dot doe at gmail dot com") and other languages are often missed; real text will score lower than the tests above.

Example

Hi, I am Priya Sharma, email priya.sharma@gmail.com, phone +91 98450 12345.
  -> Hi, I am [PERSON_NAME], email [EMAIL], phone [PHONE].
Patient Ahmed Al-Farsi (DOB 14/03/1985) was seen by Dr. Elena Rossi.
  -> Patient [PERSON_NAME] (DOB [DATE]) was seen by Dr. [PERSON_NAME].
Our support inbox is support@acme.com and the version is 2.4.1.
  -> Our support inbox is [EMAIL] and the version is 2.4.1.

How to use

from transformers import pipeline

ner = pipeline("token-classification", model="abubasith86/pii-nemotron-mmbert-base-v1",
               aggregation_strategy="simple")
ner("Hi, I am Priya Sharma, email priya.sharma@gmail.com.")

In our code: pii.eval.infer.Detector("abubasith86/pii-nemotron-mmbert-base-v1", max_len=1024, stride=256) returns character spans {start, end, label}; long texts are split into overlapping windows.

Training

Setting Value
Base model jhu-clsp/mmBERT-base
Data abubasith86/pii-nemotron-our-clean-v1, commit ebd1bf9801104af395dced68f6d60d563d3f36f2
Rows train 49,061 · validation 2,534 (from Nemotron's train file) · test 51,225 (Nemotron's test file, all used)
Window / stride 1024 / 256 tokens
Epochs 3 (9,291 steps)
Learning rate 3e-5, warmup 10%, weight decay 0.01
Batch 4 × 4 gradient accumulation = 16
Best checkpoint by F2 on validation, checked every 2,000 steps
Precision bf16
Hardware 1 × NVIDIA GeForce RTX 4070 SUPER (12 GB), about 40 minutes
Script pii/train/finetune_single.py

How the training rows were cleaned (rule checks, Microsoft Presidio, the JEV model; about half of Nemotron's rows were kept) is on the dataset card. A hand check of 200 random test rows found 98% of rows fully right with our labels.

Licence

Trained on NVIDIA's Nemotron-PII (CC-BY-4.0). The base model is jhu-clsp/mmBERT-base.

Downloads last month
-
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for abubasith86/pii-nemotron-mmbert-base-v1

Finetuned
(234)
this model