High-speed token classification model for detecting 59 sensitive financial PII entities across 4 languages (English, Spanish, French, German).
transformers, sentence-transformers, peft, and standard inference pipelines.Evaluated on the official held-out test split under standard production evaluation protocols:
| Benchmark Metric | Score / Value |
|---|---|
| test_loss | 0.0559 |
| test_precision | 0.8935 |
| test_recall | 0.8733 |
| test_f1 | 0.8833 |
| test_accuracy | 0.9830 |
| test_runtime | 5.4332 |
| test_samples_per_second | 184.0540 |
| test_steps_per_second | 5.8900 |
| epoch | 3.0000 |
💡 Benchmark Takeaway: Fine-tuning establishes substantial gains over the zero-shot base checkpoint, dramatically suppressing false predictions and improving domain confidence.
Install the required dependencies:
pip install transformers torch sentence-transformers peft accelerate
from transformers import pipeline
# Load fine-tuned token classifier with entity aggregation
classifier = pipeline(
"token-classification",
model="vennyvirtuoso/modernbert-pii-finance-multilingual",
aggregation_strategy="simple",
device_map="auto"
)
# Example document containing multilingual financial PII
text = (
"Customer transfer: John Doe (SSN: 123-45-6789) authorized a wire of $18,500.00 "
"from IBAN GB29XPUT01234567890120 to routing number 021000021 on 2026-05-14."
)
entities = classifier(text)
print(f"\nEntity | Tag | Confidence")
print("-" * 55)
for ent in entities:
print(f"{ent['word']:<22} | {ent['entity_group']:<18} | {ent['score']:>8.2%}")
Entity | Tag | Confidence
-------------------------------------------------------
John Doe | name | 99.42%
123-45-6789 | ssn | 98.85%
GB29XPUT01234567890120 | iban | 99.10%
021000021 | bank_routing_number| 97.63%
2026-05-14 | date | 99.55%
| Parameter | Specification |
|---|---|
| Base Foundation Model | answerdotai/ModernBERT-base |
| Fine-Tuned Checkpoint | vennyvirtuoso/modernbert-pii-finance-multilingual |
| Task Category | PII & Token Extraction |
| Training Dataset | gretelai/synthetic_pii_finance_multilingual |
| Precision | Mixed Precision (bfloat16 / fp16) |
| License | Apache 2.0 (Permissive Commercial & Research) |
This model is open-sourced under the Apache 2.0 license. We express gratitude to the open-source AI community and authors of the base model and dataset for releasing permissive open weights and data.
answerdotai/ModernBERT-base