Downloads · 30 days
41
13% of all-time downloads
OpenMed/OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1
OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1 is a token classification model from OpenMed. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as apache-2.0.
Arabic PII Detection Model | 568M Parameters | Open Source
Downloads · 30 days
41
13% of all-time downloads
All-time downloads
321
Public
Parameters
567M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
Arabic PII Detection Model | 568M Parameters | Open Source
OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1 is a transformer-based token classification model fine-tuned for Personally Identifiable Information (PII) detection in Arabic text. This model identifies and classifies 54 types of sensitive information including names, addresses, social security numbers, medical record numbers, and more.
Evaluated on the Arabic test split (AI4Privacy + synthetic data):
| Metric | Score |
|---|---|
| Micro F1 | 0.8582 |
| Precision | 0.8384 |
| Recall | 0.8788 |
| Macro F1 | 0.6752 |
| Weighted F1 | 0.8582 |
| Accuracy | 0.9071 |
| Rank | Model | F1 | Precision | Recall |
|---|---|---|---|---|
| 1 | OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1 | 0.8582 | 0.8384 | 0.8788 |
| 2 | OpenMed-PII-Arabic-BigMed-Large-560M-v1 | 0.8567 | 0.8394 | 0.8747 |
This model detects 54 PII entity types organized into categories:
<details> <summary><strong>Identifiers</strong> (22 types)</summary>| Entity | Description |
|---|---|
ACCOUNTNAME | Accountname |
BANKACCOUNT | Bankaccount |
BIC | Bic |
BITCOINADDRESS | Bitcoinaddress |
CREDITCARD | Creditcard |
CREDITCARDISSUER | Creditcardissuer |
CVV | Cvv |
ETHEREUMADDRESS | Ethereumaddress |
IBAN | Iban |
IMEI | Imei |
| ... | and 12 more |
| Entity | Description |
|---|---|
AGE | Age |
DATEOFBIRTH | Dateofbirth |
EYECOLOR | Eyecolor |
FIRSTNAME | Firstname |
GENDER | Gender |
HEIGHT | Height |
LASTNAME | Lastname |
MIDDLENAME | Middlename |
OCCUPATION | Occupation |
PREFIX | Prefix |
| ... | and 1 more |
| Entity | Description |
|---|---|
EMAIL | |
PHONE | Phone |
| Entity | Description |
|---|---|
BUILDINGNUMBER | Buildingnumber |
CITY | City |
COUNTY | County |
GPSCOORDINATES | Gpscoordinates |
ORDINALDIRECTION | Ordinaldirection |
SECONDARYADDRESS | Secondaryaddress |
STATE | State |
STREET | Street |
ZIPCODE | Zipcode |
| Entity | Description |
|---|---|
JOBDEPARTMENT | Jobdepartment |
JOBTITLE | Jobtitle |
ORGANIZATION | Organization |
| Entity | Description |
|---|---|
AMOUNT | Amount |
CURRENCY | Currency |
CURRENCYCODE | Currencycode |
CURRENCYNAME | Currencyname |
CURRENCYSYMBOL | Currencysymbol |
| Entity | Description |
|---|---|
DATE | Date |
TIME | Time |
from transformers import pipeline
# Load the PII detection pipeline
ner = pipeline("ner", model="OpenMed/OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1", aggregation_strategy="simple")
text = """
المريض خالد العتيبي (تاريخ الميلاد: 15/03/1985، رقم الهوية: 9876543210) تم فحصه اليوم.
التواصل: [email protected]، الهاتف: +966 50 123 4567.
العنوان: شارع العليا 42، الرياض 11432.
"""
entities = ner(text)
for entity in entities:
print(f"{entity['entity_group']}: {entity['word']} (score: {entity['score']:.3f})")
def redact_pii(text, entities, placeholder='[REDACTED]'):
"""Replace detected PII with placeholders."""
# Sort entities by start position (descending) to preserve offsets
sorted_entities = sorted(entities, key=lambda x: x['start'], reverse=True)
redacted = text
for ent in sorted_entities:
redacted = redacted[:ent['start']] + f"[{ent['entity_group']}]" + redacted[ent['end']:]
return redacted
# Apply de-identification
redacted_text = redact_pii(text, entities)
print(redacted_text)
from transformers import AutoModelForTokenClassification, AutoTokenizer
import torch
model_name = "OpenMed/OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1"
model = AutoModelForTokenClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
texts = [
"المريض خالد العتيبي (تاريخ الميلاد: 15/03/1985، رقم الهوية: 9876543210) تم فحصه اليوم.",
"التواصل: [email protected]، الهاتف: +966 50 123 4567.",
]
inputs = tokenizer(texts, return_tensors='pt', padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=-1)
This model was trained on a combination of:
AI4Privacy PII Masking 200K: Multilingual base dataset (200K records across 8 languages)
NVIDIA Nemotron-PII: Seed dataset for synthetic data generation
Synthetic Arabic Data: ~25K high-quality samples generated with locale-specific formatting (National ID format, +966 phones, Arabic names, SAR/ر.س currency)
Format: BIO-tagged token classification
Labels: 76 BIO tags (54 entity types)
Important: This model is intended as an assistive tool, not a replacement for human review.
@misc{openmed-pii-2026,
title = {OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1: Arabic PII Detection Model},
author = {OpenMed Science},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/OpenMed/OpenMed-PII-Arabic-SnowflakeMed-Large-568M-v1}
}