Instructions to use ChadTollison/pii-distilbert-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ChadTollison/pii-distilbert-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ChadTollison/pii-distilbert-v2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ChadTollison/pii-distilbert-v2") model = AutoModelForTokenClassification.from_pretrained("ChadTollison/pii-distilbert-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# PII Detector (DistilBERT v2)
Token-classification model that tags PERSON, EMAIL, PHONE, SSN, CREDIT_CARD, and IP_ADDRESS spans with BIO labels. Fine-tuned from distilbert-base-cased on 8,000 synthetic, template-generated examples.
Intended use: as the candidate-finding stage of a pipeline where format validators (Luhn checksum for cards, structural rules for SSNs and IPs) confirm structured types. Code, evaluation, and the FastAPI service are at https://github.com/chadtollison/PII-Detector
## Results (span-level exact match, 1,000-example held-out set with unseen templates and names)
| Setup | Precision | Recall | F1 |
|---|---|---|---|
| Model alone | 0.97 | 0.98 | 0.97 |
| Model + validators | 0.98 | 0.98 | 0.98 |
## Limitations
- Trained and tested only on synthetic data; real-world text will be harder.
- US formats only (SSN, phone numbers, Visa prefix).
- Cannot verify checksums itself; pair it with validators for card numbers.
- Capitalized words at the start of a sentence are sometimes tagged as names.
- Downloads last month
- 90
Model tree for ChadTollison/pii-distilbert-v2
Base model
distilbert/distilbert-base-cased