mateoopa/gliner2-privacy-filter-PII-multi
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;"> <a href="https://arxiv.org/abs/2605.09973" target="blank" rel="noreferrer" style="text-decoration:none;"> <img src="https://img.shields.io/badge/arXiv-2605.07982-b31b1b.svg?logo=arxiv" alt="arXiv Paper" style="vertical-align:middle;"> </a> <a href="https://pioneer.ai?utmsource=huggingface" target="blank" rel="noreferrer" style="text-decoration:none;"> <img src="https://img.shields.io/badge/Deploy-GLiNER2%20PII-FF7345" alt="Deploy GLiNER2-PII model with Pioneer" style="vertical-align:middle;"> </a> <a href="https://x.com/fastinoAI" target="blank" rel="noreferrer" style="text-decoration:none;"> <img src="https://img.shields.io/twitter/follow/:fastinoAI" alt="Follow @fastinoAI" style="vertical-align:middle;"> </a> </div>
GLiNER2-PII: Multilingual PII Detection & Masking
GLiNER2-PII is a fine-tune of the GLiNER2 model (205M parameters) for detecting and masking personally identifiable information across 42 entity types and 7 languages.
Trained entirely on a constraint-driven synthetic corpus of 4,910 annotated texts, it achieves the highest span-level F1 (0.477) on the SPY benchmark among four compared systems โ including OpenAI Privacy Filter, NVIDIA GLiNER-PII, and urchade/gliner\multi\pii-v1.
๐ [Technical Report](https://arxiv.org/abs/2605.09973) ๐ [GitHub](https://github.com/fastino-ai/GLiNER2)
Quick Start
pip install gliner2from gliner2 import GLiNER2
model = GLiNER2.from_pretrained("fastino/gliner2-pii-v1")
text = "Email john.smith@acme.com or call +1 415 555 0199."
labels = ["email", "phone_number", "person"]
result = model.extract_entities(
text,
labels,
threshold=0.5,
include_confidence=True,
include_spans=True,
)
print(result)You can pass any subset of the 42 supported labels โ the model conditions on the labels you provide at inference time.
Supported PII Labels (42 types)
Benchmark Results (SPY)
Evaluated on the SPY benchmark (Savkin et al., 2025) with exact-match span-level metrics:
Key takeaways
- Highest F1 on both legal and medical domains.
- Best recall among GLiNER-based detectors (0.718 avg) โ critical for redaction workflows where missed spans are data leaks.
- Consistent performance across domains (< 2-point F1 difference).
When to Use This Model
Redaction Example
def redact(text, labels, threshold=0.5):
model = GLiNER2.from_pretrained("fastino/gliner2-pii-v1")
result = model.extract_entities(
text, labels, threshold=threshold,
include_spans=True,
)
entities = result.get("entities", {})
spans = []
for label, values in entities.items():
for value in values:
start = text.find(value)
if start != -1:
spans.append((start, start + len(value), label))
spans.sort(key=lambda s: s[0], reverse=True)
redacted = text
for start, end, label in spans:
redacted = redacted[:start] + f"[{label.upper()}]" + redacted[end:]
return redacted
text = "Please contact Maria Jensen at maria.jensen@example.dk or +45 20 12 34 56."
labels = ["person", "email", "phone_number"]
print(redact(text, labels))
# "Please contact [PERSON] at [EMAIL] or [PHONE_NUMBER]."Training Details
Limitations
- Precision (0.35โ0.37 on SPY) leaves room for improvement; the model tends to over-predict
nameentities, sometimes confusing common nouns, organisation names, and product names with personal names. - Evaluated on a single benchmark (SPY) covering two domains. Broader multilingual and fine-grained evaluation is ongoing.
- Training data is fully synthetic and has not been validated by human annotators.
- Performance on non-European locales and scripts has not been measured.
Improving precision
For production use, consider:
- Per-label confidence thresholds (raise threshold for
person/full_name) - Dictionary-based filtering for common false positives
- Calibration on a small domain-specific development set
Citation
@misc{fastino2026gliner2pii,
title = {GLiNER2-PII: Multilingual PII Extraction via Synthetic Fine-Tuning},
author = {{Fastino AI Team}},
year = {2026},
url = {https://huggingface.co/fastino/gliner2-pii-v1}
}Related work
@misc{zaratiana2026gliner2piimultilingualmodelpersonally,
title={GLiNER2-PII: A Multilingual Model for Personally Identifiable Information Extraction},
author={Urchade Zaratiana and Ash Lewis and George Hurn-Maloney},
year={2026},
eprint={2605.09973},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2605.09973},
}
@inproceedings{zaratiana-etal-2025-gliner2,
title = {GLiNER2: Schema-Driven Multi-Task Learning for Structured Information Extraction},
author = {Zaratiana, Urchade and Pasternak, Gil and Boyd, Oliver and Hurn-Maloney, George and Lewis, Ash},
booktitle = {Proceedings of EMNLP 2025: System Demonstrations},
year = {2025}
}
@inproceedings{zaratiana-etal-2024-gliner,
title = {GLiNER: Generalist Model for Named Entity Recognition using Bidirectional Transformer},
author = {Zaratiana, Urchade and Tomeh, Nadi and Holat, Pierre and Charnois, Thierry},
booktitle = {Proceedings of NAACL 2024},
year = {2024}
}
@misc{atreja2026pioneeragent,
title = {Pioneer Agent: Continual Improvement of Small Language Models in Production},
author = {Atreja, Dhruv and White, Julia and Nayak, Nikhil and Zhang, Kelton and Princis, Henrijs and Hurn-Maloney, George and Lewis, Ash and Zaratiana, Urchade},
year = {2026},
url = {https://arxiv.org/abs/2604.09791}
}License
Apache 2.0
