File size: 9,712 Bytes
3c3f1b0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
---
language:
- de
license: apache-2.0
base_model: microsoft/deberta-v3-base
tags:
- token-classification
- ner
- pii
- pii-detection
- de-identification
- privacy
- healthcare
- medical
- clinical
- phi
- german
- pytorch
- transformers
- openmed
pipeline_tag: token-classification
library_name: transformers
metrics:
- f1
- precision
- recall
model-index:
- name: OpenMed-PII-German-SuperClinical-Base-184M-v1
results:
- task:
type: token-classification
name: Named Entity Recognition
dataset:
name: AI4Privacy (German subset)
type: ai4privacy/pii-masking-400k
split: test
metrics:
- type: f1
value: 0.9627
name: F1 (micro)
- type: precision
value: 0.9603
name: Precision
- type: recall
value: 0.9651
name: Recall
widget:
- text: "Dr. Hans Müller (Sozialversicherungsnummer: 12 150385 M 123) ist erreichbar unter hans.mueller@krankenhaus.de oder 0171 234 5678. Er wohnt in der Hauptstraße 42, 10115 Berlin."
example_title: Clinical Note with PII (German)
---
# OpenMed-PII-German-SuperClinical-Base-184M-v1
**German PII Detection Model** | 184M Parameters | Open Source
[]() []() []()
## Model Description
**OpenMed-PII-German-SuperClinical-Base-184M-v1** is a transformer-based token classification model fine-tuned for **Personally Identifiable Information (PII) detection in German text**. This model identifies and classifies **54 types of sensitive information** including names, addresses, social security numbers, medical record numbers, and more.
### Key Features
- **German-Optimized**: Specifically trained on German text for optimal performance
- **High Accuracy**: Achieves strong F1 scores across diverse PII categories
- **Comprehensive Coverage**: Detects 55+ entity types spanning personal, financial, medical, and contact information
- **Privacy-Focused**: Designed for de-identification and compliance with GDPR and other privacy regulations
- **Production-Ready**: Optimized for real-world text processing pipelines
## Performance
Evaluated on the German subset of AI4Privacy dataset:
| Metric | Score |
|:---|:---:|
| **Micro F1** | **0.9627** |
| Precision | 0.9603 |
| Recall | 0.9651 |
| Macro F1 | 0.9457 |
| Weighted F1 | 0.9604 |
| Accuracy | 0.9939 |
### Top 10 German PII Models
| Rank | Model | F1 | Precision | Recall |
|:---:|:---|:---:|:---:|:---:|
| 1 | [OpenMed-PII-German-SuperClinical-Large-434M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-SuperClinical-Large-434M-v1) | 0.9761 | 0.9744 | 0.9778 |
| 2 | [OpenMed-PII-German-SnowflakeMed-Large-568M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-SnowflakeMed-Large-568M-v1) | 0.9724 | 0.9705 | 0.9743 |
| 3 | [OpenMed-PII-German-ClinicalBGE-568M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-ClinicalBGE-568M-v1) | 0.9724 | 0.9702 | 0.9745 |
| 4 | [OpenMed-PII-German-BigMed-Large-560M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-BigMed-Large-560M-v1) | 0.9714 | 0.9696 | 0.9732 |
| 5 | [OpenMed-PII-German-NomicMed-Large-395M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-NomicMed-Large-395M-v1) | 0.9713 | 0.9690 | 0.9735 |
| 6 | [OpenMed-PII-German-SuperMedical-Large-355M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-SuperMedical-Large-355M-v1) | 0.9701 | 0.9684 | 0.9719 |
| 7 | [OpenMed-PII-German-EuroMed-210M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-EuroMed-210M-v1) | 0.9683 | 0.9667 | 0.9699 |
| 8 | [OpenMed-PII-German-ClinicalBGE-Large-335M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-ClinicalBGE-Large-335M-v1) | 0.9652 | 0.9624 | 0.9680 |
| 9 | [OpenMed-PII-German-ClinicalE5-Large-335M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-ClinicalE5-Large-335M-v1) | 0.9646 | 0.9620 | 0.9672 |
| 10 | [OpenMed-PII-German-BiomedELECTRA-Large-335M-v1](https://huggingface.co/OpenMed/OpenMed-PII-German-BiomedELECTRA-Large-335M-v1) | 0.9638 | 0.9598 | 0.9677 |
## Supported Entity Types
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* |
</details>
<details>
<summary><strong>Personal Info</strong> (11 types)</summary>
| 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* |
</details>
<details>
<summary><strong>Contact Info</strong> (2 types)</summary>
| Entity | Description |
|:---|:---|
| `EMAIL` | Email |
| `PHONE` | Phone |
</details>
<details>
<summary><strong>Location</strong> (9 types)</summary>
| Entity | Description |
|:---|:---|
| `BUILDINGNUMBER` | Buildingnumber |
| `CITY` | City |
| `COUNTY` | County |
| `GPSCOORDINATES` | Gpscoordinates |
| `ORDINALDIRECTION` | Ordinaldirection |
| `SECONDARYADDRESS` | Secondaryaddress |
| `STATE` | State |
| `STREET` | Street |
| `ZIPCODE` | Zipcode |
</details>
<details>
<summary><strong>Organization</strong> (3 types)</summary>
| Entity | Description |
|:---|:---|
| `JOBDEPARTMENT` | Jobdepartment |
| `JOBTITLE` | Jobtitle |
| `ORGANIZATION` | Organization |
</details>
<details>
<summary><strong>Financial</strong> (5 types)</summary>
| Entity | Description |
|:---|:---|
| `AMOUNT` | Amount |
| `CURRENCY` | Currency |
| `CURRENCYCODE` | Currencycode |
| `CURRENCYNAME` | Currencyname |
| `CURRENCYSYMBOL` | Currencysymbol |
</details>
<details>
<summary><strong>Temporal</strong> (2 types)</summary>
| Entity | Description |
|:---|:---|
| `DATE` | Date |
| `TIME` | Time |
</details>
## Usage
### Quick Start
```python
from transformers import pipeline
# Load the PII detection pipeline
ner = pipeline("ner", model="OpenMed/OpenMed-PII-German-SuperClinical-Base-184M-v1", aggregation_strategy="simple")
text = """
Patient Hans Schmidt (geboren am 15.03.1985, SVN: 12 150385 M 234) wurde heute untersucht.
Kontakt: hans.schmidt@email.de, Telefon: 0171 234 5678.
Adresse: Mozartstraße 15, 80336 München.
"""
entities = ner(text)
for entity in entities:
print(f"{entity['entity_group']}: {entity['word']} (score: {entity['score']:.3f})")
```
### De-identification Example
```python
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)
```
### Batch Processing
```python
from transformers import AutoModelForTokenClassification, AutoTokenizer
import torch
model_name = "OpenMed/OpenMed-PII-German-SuperClinical-Base-184M-v1"
model = AutoModelForTokenClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
texts = [
"Patient Hans Schmidt (geboren am 15.03.1985, SVN: 12 150385 M 234) wurde heute untersucht.",
"Kontakt: hans.schmidt@email.de, Telefon: 0171 234 5678.",
]
inputs = tokenizer(texts, return_tensors='pt', padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=-1)
```
## Training Details
### Dataset
- **Source**: [AI4Privacy PII Masking 400k](https://huggingface.co/datasets/ai4privacy/pii-masking-400k) (German subset)
- **Format**: BIO-tagged token classification
- **Labels**: 109 total (54 entity types × 2 BIO tags + O)
### Training Configuration
- **Max Sequence Length**: 512 tokens
- **Epochs**: 3
- **Framework**: Hugging Face Transformers + Trainer API
## Intended Use & Limitations
### Intended Use
- **De-identification**: Automated redaction of PII in German clinical notes, medical records, and documents
- **Compliance**: Supporting GDPR, and other privacy regulation compliance
- **Data Preprocessing**: Preparing datasets for research by removing sensitive information
- **Audit Support**: Identifying PII in document collections
### Limitations
**Important**: This model is intended as an **assistive tool**, not a replacement for human review.
- **False Negatives**: Some PII may not be detected; always verify critical applications
- **Context Sensitivity**: Performance may vary with domain-specific terminology
- **Language**: Optimized for German text; may not perform well on other languages
## Citation
```bibtex
@misc{openmed-pii-2026,
title = {OpenMed-PII-German-SuperClinical-Base-184M-v1: German PII Detection Model},
author = {OpenMed Science},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/OpenMed/OpenMed-PII-German-SuperClinical-Base-184M-v1}
}
```
## Links
- **Organization**: [OpenMed](https://huggingface.co/OpenMed)
|