Instructions to use pii-engineer/PII-Engineer-Multi-NER-v2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER
How to use pii-engineer/PII-Engineer-Multi-NER-v2.1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("pii-engineer/PII-Engineer-Multi-NER-v2.1") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,139 +1,171 @@
|
|
| 1 |
---
|
| 2 |
-
library_name: onnxruntime
|
| 3 |
-
tags:
|
| 4 |
-
- ner
|
| 5 |
-
- pii
|
| 6 |
-
- gliner
|
| 7 |
-
- onnx
|
| 8 |
-
- privacy
|
| 9 |
-
- pdpa
|
| 10 |
-
- pdpd
|
| 11 |
-
- pipl
|
| 12 |
-
- multilingual
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
-
- ms
|
| 16 |
-
- ta
|
| 17 |
- zh
|
|
|
|
| 18 |
- id
|
| 19 |
- vi
|
|
|
|
| 20 |
- th
|
| 21 |
- hi
|
| 22 |
- bn
|
| 23 |
- ko
|
|
|
|
| 24 |
- de
|
| 25 |
- fr
|
| 26 |
- ru
|
| 27 |
license: agpl-3.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
pipeline_tag: token-classification
|
| 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 |
## Quick Start
|
| 87 |
|
| 88 |
-
|
| 89 |
|
| 90 |
```bash
|
|
|
|
|
|
|
| 91 |
cargo build --release --package pii-engineer-server
|
| 92 |
cargo run --release --package pii-engineer-server
|
| 93 |
-
# Models download
|
|
|
|
| 94 |
```
|
| 95 |
|
| 96 |
-
Or download manually:
|
| 97 |
-
|
| 98 |
```bash
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
```
|
| 101 |
|
| 102 |
-
##
|
| 103 |
|
| 104 |
-
|
|
|
|
| 105 |
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
- PDPD (Vietnam) compliance scanning
|
| 112 |
-
- PDP Law (Indonesia) compliance scanning
|
| 113 |
-
- PIPL (China) compliance scanning
|
| 114 |
-
- PII detection in documents, chat logs, databases
|
| 115 |
-
- Pre-processing for data anonymization pipelines
|
| 116 |
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
-
|
| 120 |
-
- May underperform on highly informal social media text
|
| 121 |
-
- Date-of-birth detection requires contextual birth cues (e.g., "born", "DOB", "lahir")
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
| 133 |
```
|
| 134 |
|
| 135 |
## License
|
| 136 |
|
| 137 |
AGPL-3.0 — free for open-source use. Commercial license available at [pii.engineer](https://pii.engineer).
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
|
|
|
|
|
|
| 4 |
- zh
|
| 5 |
+
- ms
|
| 6 |
- id
|
| 7 |
- vi
|
| 8 |
+
- ta
|
| 9 |
- th
|
| 10 |
- hi
|
| 11 |
- bn
|
| 12 |
- ko
|
| 13 |
+
- ja
|
| 14 |
- de
|
| 15 |
- fr
|
| 16 |
- ru
|
| 17 |
license: agpl-3.0
|
| 18 |
+
tags:
|
| 19 |
+
- pii
|
| 20 |
+
- ner
|
| 21 |
+
- gliner
|
| 22 |
+
- privacy
|
| 23 |
+
- gdpr
|
| 24 |
+
- pdpa
|
| 25 |
+
- multilingual
|
| 26 |
+
- onnx
|
| 27 |
+
datasets:
|
| 28 |
+
- custom
|
| 29 |
+
metrics:
|
| 30 |
+
- f1
|
| 31 |
pipeline_tag: token-classification
|
| 32 |
---
|
| 33 |
|
| 34 |
+
<p align="center">
|
| 35 |
+
<a href="https://pii.engineer">
|
| 36 |
+
<img src="https://pii.engineer/static/banner.webp" alt="PII Engineer" width="100%" />
|
| 37 |
+
</a>
|
| 38 |
+
</p>
|
| 39 |
+
|
| 40 |
+
# PII Engineer — Multilingual NER v2.1
|
| 41 |
+
|
| 42 |
+
Fast, multilingual PII detection model. Detects 30+ PII types across 50+ languages from a single model, no GPU required.
|
| 43 |
+
|
| 44 |
+
**[Live Demo](https://pii.engineer)** · **[Benchmarks](https://pii.engineer/benchmarks)** · **[GitHub](https://github.com/gantz-ai/pii.engineer)** · **[Blog](https://pii.engineer/blog)**
|
| 45 |
+
|
| 46 |
+
## Benchmarks
|
| 47 |
+
|
| 48 |
+
| | PII Engineer | Presidio | spaCy | AWS Comprehend |
|
| 49 |
+
|---|---|---|---|---|
|
| 50 |
+
| **F1 (multilingual)** | **0.86** | 0.44 | 0.64 | 0.52 |
|
| 51 |
+
| **F1 (English)** | **0.88** | 0.80 | 0.83 | 0.82 |
|
| 52 |
+
| **Languages** | **50+** | ~10 locales | 1 per model | 12 |
|
| 53 |
+
| **Latency (p50)** | 180ms | 80ms (w/ NER) | 120ms | 200ms |
|
| 54 |
+
| **GPU required** | No | No | Optional | N/A |
|
| 55 |
+
| **Cost (1M req/mo)** | **$42** | $42 | $42 | ~$1,000 |
|
| 56 |
+
|
| 57 |
+
[Full benchmarks →](https://pii.engineer/benchmarks)
|
| 58 |
+
|
| 59 |
+
### Accuracy by Language
|
| 60 |
+
|
| 61 |
+
| Language | F1 |
|
| 62 |
+
|----------|-----|
|
| 63 |
+
| English | 0.931 |
|
| 64 |
+
| Chinese | 0.918 |
|
| 65 |
+
| Vietnamese | 0.912 |
|
| 66 |
+
| Korean | 0.905 |
|
| 67 |
+
| Indonesian | 0.901 |
|
| 68 |
+
| Malay | 0.895 |
|
| 69 |
+
| Hindi | 0.892 |
|
| 70 |
+
| Thai | 0.885 |
|
| 71 |
+
| Tamil | 0.878 |
|
| 72 |
+
|
| 73 |
+
### Per-Entity Accuracy
|
| 74 |
+
|
| 75 |
+
| Entity Type | F1 |
|
| 76 |
+
|-------------|-----|
|
| 77 |
+
| email_address | 0.970 |
|
| 78 |
+
| phone_number | 0.968 |
|
| 79 |
+
| government_id | 0.920 |
|
| 80 |
+
| bank_account_number | 0.915 |
|
| 81 |
+
| street_address | 0.891 |
|
| 82 |
+
| date_of_birth | 0.887 |
|
| 83 |
+
| passport_number | 0.880 |
|
| 84 |
+
| license_plate | 0.833 |
|
| 85 |
+
| person_name | 0.823 |
|
| 86 |
+
|
| 87 |
+
## PII Types Detected
|
| 88 |
+
|
| 89 |
+
`person_name` · `phone_number` · `government_id` · `street_address` · `date_of_birth` · `email_address` · `passport_number` · `license_plate` · `bank_account_number`
|
| 90 |
+
|
| 91 |
+
## Model Architecture
|
| 92 |
+
|
| 93 |
+
- **Base:** [GLiNER2](https://huggingface.co/fastino/gliner2-multi-v1) (span-based NER)
|
| 94 |
+
- **Encoder:** mDeBERTa-v3-base (280M params), fine-tuned with LoRA on PII data
|
| 95 |
+
- **Inference:** 5 ONNX models (encoder, span_rep, count_embed, count_pred, classifier)
|
| 96 |
+
- **Quantization:** INT8 encoder available (~15-20% faster on x86 CPU)
|
| 97 |
+
- **Total size:** ~620MB (all languages)
|
| 98 |
|
| 99 |
## Quick Start
|
| 100 |
|
| 101 |
+
### With PII Engineer Server (Rust)
|
| 102 |
|
| 103 |
```bash
|
| 104 |
+
git clone https://github.com/gantz-ai/pii.engineer
|
| 105 |
+
cd pii.engineer
|
| 106 |
cargo build --release --package pii-engineer-server
|
| 107 |
cargo run --release --package pii-engineer-server
|
| 108 |
+
# Models auto-download on first run
|
| 109 |
+
# API at http://localhost:8000
|
| 110 |
```
|
| 111 |
|
|
|
|
|
|
|
| 112 |
```bash
|
| 113 |
+
curl -X POST http://localhost:8000/api/detect \
|
| 114 |
+
-H "Content-Type: application/json" \
|
| 115 |
+
-d '{"text": "John Doe, NRIC S9012345B, born 12 March 1985"}'
|
| 116 |
```
|
| 117 |
|
| 118 |
+
### With Python
|
| 119 |
|
| 120 |
+
```python
|
| 121 |
+
import requests
|
| 122 |
|
| 123 |
+
resp = requests.post("http://localhost:8000/api/detect", json={
|
| 124 |
+
"text": "John Doe lives at 42 Orchard Road, Singapore 238879",
|
| 125 |
+
"labels": ["person_name", "street_address", "phone_number", "email_address"]
|
| 126 |
+
})
|
| 127 |
|
| 128 |
+
for entity in resp.json()["entities"]:
|
| 129 |
+
print(f'{entity["type"]}: {entity["value"]} (score: {entity["score"]:.2f})')
|
| 130 |
+
```
|
| 131 |
|
| 132 |
+
### Download Models Manually
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
+
```bash
|
| 135 |
+
pip install huggingface_hub
|
| 136 |
+
huggingface-cli download pii-engineer/PII-Engineer-Multi-NER-v2.1 --local-dir models/PII-Engineer-Multi-NER-v2.1
|
| 137 |
+
huggingface-cli download pii-engineer/PII-Engineer-Chinese-NER-v1.0 --local-dir models/PII-Engineer-Chinese-NER-v1.0
|
| 138 |
+
```
|
| 139 |
|
| 140 |
+
## Use Cases
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
- **PDPA/GDPR/CCPA compliance** — detect PII in databases, logs, documents
|
| 143 |
+
- **Data anonymization** — redact PII before sharing datasets
|
| 144 |
+
- **CI/CD scanning** — catch leaked PII in code and configs
|
| 145 |
+
- **Chat/support data** — clean PII from customer interactions
|
| 146 |
+
- **Healthcare** — detect PHI in clinical notes
|
| 147 |
|
| 148 |
+
## GitHub Action
|
| 149 |
+
|
| 150 |
+
Scan your codebase for PII in CI/CD:
|
| 151 |
+
|
| 152 |
+
```yaml
|
| 153 |
+
- uses: gantz-ai/pii.engineer@v1.0.1
|
| 154 |
+
with:
|
| 155 |
+
path: "src/"
|
| 156 |
+
fail_on_pii: "true"
|
| 157 |
```
|
| 158 |
|
| 159 |
## License
|
| 160 |
|
| 161 |
AGPL-3.0 — free for open-source use. Commercial license available at [pii.engineer](https://pii.engineer).
|
| 162 |
|
| 163 |
+
## Citation
|
| 164 |
+
|
| 165 |
+
```bibtex
|
| 166 |
+
@software{pii_engineer,
|
| 167 |
+
title = {PII Engineer: Multilingual PII Detection},
|
| 168 |
+
url = {https://github.com/gantz-ai/pii.engineer},
|
| 169 |
+
year = {2026}
|
| 170 |
+
}
|
| 171 |
+
```
|