Views
No views yet
| Metric | Score |
|---|---|
| Micro F1 | 0.9509 |
| Precision | 0.9611 |
| Recall | 0.9409 |
| Macro F1 | 0.9523 |
| Weighted F1 | 0.9489 |
| Accuracy | 0.9932 |
| Rank | Model | F1 | Precision | Recall |
|---|---|---|---|---|
| 1 | OpenMed-PII-SuperClinical-Large-434M-v1 | 0.9608 | 0.9685 | 0.9532 |
| 2 | OpenMed-PII-BigMed-Large-560M-v1 | 0.9604 | 0.9644 | 0.9565 |
| 3 | OpenMed-PII-EuroMed-210M-v1 | 0.9600 | 0.9681 | 0.9521 |
| 4 | OpenMed-PII-SnowflakeMed-568M-v1 | 0.9594 | 0.9640 | 0.9548 |
| 5 | OpenMed-PII-SuperMedical-Large-355M-v1 | 0.9592 | 0.9632 | 0.9553 |
| 6 | OpenMed-PII-ClinicalBGE-568M-v1 | 0.9587 | 0.9636 | 0.9538 |
| 7 | OpenMed-PII-mClinicalE5-Large-560M-v1 | 0.9582 | 0.9631 | 0.9533 |
| 8 | OpenMed-PII-ModernMed-Large-395M-v1 | 0.9579 | 0.9639 | 0.9520 |
| 9 | OpenMed-PII-BioClinicalModern-Large-395M-v1 | 0.9579 | 0.9656 | 0.9502 |
| 10 | OpenMed-PII-ClinicalE5-Large-335M-v1 | 0.9577 | 0.9604 | 0.9550 |
| Entity | F1 | Precision | Recall | Support |
|---|---|---|---|---|
biometric_identifier | 0.998 | 0.996 | 1.000 | 228 |
credit_debit_card | 0.998 | 0.995 | 1.000 | 213 |
race_ethnicity | 0.997 | 1.000 | 0.995 | 193 |
blood_type | 0.996 | 0.993 | 1.000 | 133 |
email | 0.993 | 0.993 | 0.993 | 745 |
| Entity | F1 | Precision | Recall | Support |
|---|---|---|---|---|
unique_id | 0.889 | 0.919 | 0.861 | 79 |
education_level | 0.875 | 0.916 | 0.837 | 196 |
fax_number | 0.856 | 0.786 | 0.939 | 98 |
time | 0.848 | 0.886 | 0.813 | 460 |
occupation | 0.602 | 0.704 | 0.526 | 688 |
| Entity | Description |
|---|---|
account_number | Account Number |
api_key | Api Key |
bank_routing_number | Bank Routing Number |
certificate_license_number | Certificate License Number |
credit_debit_card | Credit Debit Card |
cvv | Cvv |
employee_id | Employee Id |
health_plan_beneficiary_number | Health Plan Beneficiary Number |
mac_address | Mac Address |
medical_record_number | Medical Record Number |
| ... | and 6 more |
| Entity | Description |
|---|---|
age | Age |
biometric_identifier | Biometric Identifier |
blood_type | Blood Type |
date_of_birth | Date Of Birth |
education_level | Education Level |
first_name | First Name |
last_name | Last Name |
gender | Gender |
language | Language |
occupation | Occupation |
| ... | and 4 more |
| Entity | Description |
|---|---|
email | |
phone_number | Phone Number |
fax_number | Fax Number |
url | Url |
| Entity | Description |
|---|---|
city | City |
coordinate | Coordinate |
country | Country |
county | County |
state | State |
street_address | Street Address |
| Entity | Description |
|---|---|
device_identifier | Device Identifier |
ipv4 | Ipv4 |
ipv6 | Ipv6 |
| Entity | Description |
|---|---|
date | Date |
date_time | Date Time |
time | Time |
| Entity | Description |
|---|---|
company_name | Company Name |
1from transformers import pipeline
2
3# Load the PII detection pipeline
4ner = pipeline("ner", model="openmed/OpenMed-PII-BioClinicalModern-Base-149M-v1", aggregation_strategy="simple")
5
6text = """
7Patient John Smith (DOB: 03/15/1985, SSN: 123-45-6789) was seen today.
8Contact: john.smith@email.com, Phone: (555) 123-4567.
9Address: 456 Oak Street, Boston, MA 02108.
10"""
11
12entities = ner(text)
13for entity in entities:
14 print(f"{entity['entity_group']}: {entity['word']} (score: {entity['score']:.3f})")1def redact_pii(text, entities, placeholder='[REDACTED]'):
2 """Replace detected PII with placeholders."""
3 # Sort entities by start position (descending) to preserve offsets
4 sorted_entities = sorted(entities, key=lambda x: x['start'], reverse=True)
5 redacted = text
6 for ent in sorted_entities:
7 redacted = redacted[:ent['start']] + f"[{ent['entity_group']}]" + redacted[ent['end']:]
8 return redacted
9
10# Apply de-identification
11redacted_text = redact_pii(text, entities)
12print(redacted_text)1from transformers import AutoModelForTokenClassification, AutoTokenizer
2import torch
3
4model_name = "openmed/OpenMed-PII-BioClinicalModern-Base-149M-v1"
5model = AutoModelForTokenClassification.from_pretrained(model_name)
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7
8texts = [
9 "Contact Dr. Jane Doe at jane.doe@hospital.org",
10 "Patient SSN: 987-65-4321, MRN: 12345678",
11]
12
13inputs = tokenizer(texts, return_tensors='pt', padding=True, truncation=True)
14with torch.no_grad():
15 outputs = model(**inputs)
16 predictions = torch.argmax(outputs.logits, dim=-1)label_all_tokens=False)occupation, time, and sexuality have lower F1 scores1@misc{openmed-pii-2026,
2 title = {OpenMed-PII-BioClinicalModern-Base-149M-v1: PII Detection Model},
3 author = {OpenMed Science},
4 year = {2026},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/openmed/OpenMed-PII-BioClinicalModern-Base-149M-v1}
7}