PrivacyGuard-NER is a compact, high-efficiency token classification model fine-tuned from distilbert-base-uncased for detecting 16 categories of Personally Identifiable Information (PII) with empirically verified ~17ms latency on standard CPU hardware.
DistilBertForTokenClassification)distilbert-base-uncased (~66M parameters)| Entity Label | Description |
|---|---|
PERSON |
Full names, given names, family names |
EMAIL |
Personal and corporate email addresses |
PHONE |
International, national, and local telephone numbers |
ADDRESS |
Street addresses, residential locations |
LOCATION |
Cities, regions, states, countries |
ORGANIZATION |
Companies, institutions, government bodies |
DATE_OF_BIRTH |
Birth dates across multiple standard date formats |
CREDIT_CARD |
Credit and debit card numbers |
BANK_ACCOUNT |
Bank account numbers and IBANs |
PAN |
Indian Permanent Account Number |
AADHAAR |
Indian 12-digit Unique Identification Number |
PASSPORT |
International passport identification codes |
IP_ADDRESS |
IPv4 network addresses |
USERNAME |
Account handles, system user identifiers |
URL |
Web URLs, domains, endpoints |
EMPLOYEE_ID |
Organizational staff and badge IDs |
privacyguard Python Libraryfrom privacyguard import PrivacyGuard
# Load model
guard = PrivacyGuard.from_pretrained("VrajGoti/privacyguard-ner")
# Detect
text = "Contact Alice at alice@company.com or phone +1-555-0199"
result = guard.detect(text)
for ent in result.entities:
print(f"{ent.label}: '{ent.text}' ({ent.confidence:.2%})")
# Redact
clean_text = guard.redact(text, mode="label").redacted_text
print(clean_text)
# Contact [PERSON] at [EMAIL] or phone [PHONE]
pipelinefrom transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
model_id = "VrajGoti/privacyguard-ner"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id)
ner_pipeline = pipeline(
"token-classification",
model=model,
tokenizer=tokenizer,
aggregation_strategy="simple"
)
results = ner_pipeline("Please email john.doe@secure.io")
print(results)
The model was trained on a deterministically generated, balanced dataset of 3,000 synthetic text samples with strict boundary validation:
0.99900.99900.9990| Entity Type | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
AADHAAR |
1.0000 | 1.0000 | 1.0000 | 51 |
ADDRESS |
1.0000 | 1.0000 | 1.0000 | 40 |
BANK_ACCOUNT |
1.0000 | 1.0000 | 1.0000 | 34 |
CREDIT_CARD |
1.0000 | 1.0000 | 1.0000 | 36 |
DATE_OF_BIRTH |
1.0000 | 1.0000 | 1.0000 | 34 |
EMAIL |
1.0000 | 1.0000 | 1.0000 | 108 |
EMPLOYEE_ID |
1.0000 | 1.0000 | 1.0000 | 31 |
IP_ADDRESS |
1.0000 | 1.0000 | 1.0000 | 44 |
LOCATION |
1.0000 | 1.0000 | 1.0000 | 49 |
ORGANIZATION |
1.0000 | 1.0000 | 1.0000 | 73 |
PAN |
1.0000 | 1.0000 | 1.0000 | 55 |
PASSPORT |
1.0000 | 1.0000 | 1.0000 | 42 |
PERSON |
1.0000 | 1.0000 | 1.0000 | 209 |
PHONE |
1.0000 | 1.0000 | 1.0000 | 79 |
URL |
1.0000 | 1.0000 | 1.0000 | 29 |
USERNAME |
0.9756 | 0.9756 | 0.9756 | 41 |
17.02 ms (p50: 16.28 ms, min: 14.02 ms)9.88 ms / text (79.06 ms per batch)58.74 texts / second17.82 ms (verified exact parity with PyTorch logits)xlm-roberta-base model is on the roadmap.checkpoint-132/optimizer.pt 507 MiBcheckpoint-264/optimizer.pt 507 MiBcheckpoint-132/model.safetensors 253 MiBcheckpoint-264/model.safetensors 253 MiBmodel.safetensors 253 MiBcheckpoint-132/rng_state.pth 14.1 KiBcheckpoint-264/rng_state.pth 14.1 KiBcheckpoint-132/training_args.bin 5.1 KiBcheckpoint-264/training_args.bin 5.1 KiBtraining_args.bin 5.1 KiBcheckpoint-132/scheduler.pt 1.4 KiBcheckpoint-264/scheduler.pt 1.4 KiB