Token Classification
Transformers
Safetensors
lfm2
liquid
lfm2.5
bidirectional
masked-lm
encoder
pii
ner
privacy
multilingual
custom_code
Instructions to use LiquidAI/LFM2.5-Encoder-350M-PII-Detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2.5-Encoder-350M-PII-Detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="LiquidAI/LFM2.5-Encoder-350M-PII-Detector", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2.5-Encoder-350M-PII-Detector", trust_remote_code=True) model = AutoModelForTokenClassification.from_pretrained("LiquidAI/LFM2.5-Encoder-350M-PII-Detector", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update PII detector model card
#1
by iamleonie - opened
- .gitattributes +0 -1
- README.md +18 -18
- leaderboard_18lang.png +2 -2
- plots/candidates_comparison.png +0 -0
- plots/internal_v1/by_domain_f1.png +0 -0
- plots/internal_v1/by_edge_f1.png +0 -0
- plots/internal_v1/by_language_f1.png +0 -0
- plots/internal_v1/gap_probe_recall.png +0 -0
- plots/internal_v1/overall_summary.png +0 -0
- plots/internal_v1/partial_vs_exact.png +0 -0
- plots/internal_v1/per_type_f1.png +0 -0
- plots/v7/by_domain_f1.png +0 -0
- plots/v7/by_edge_f1.png +0 -0
- plots/v7/by_language_f1.png +0 -0
- plots/v7/gap_probe_recall.png +0 -0
- plots/v7/overall_summary.png +0 -0
- plots/v7/partial_vs_exact.png +0 -0
- plots/v7/per_type_f1.png +0 -0
- plots/v8/by_domain_f1.png +0 -0
- plots/v8/by_edge_f1.png +0 -0
- plots/v8/by_language_f1.png +0 -0
- plots/v8/gap_probe_recall.png +0 -0
- plots/v8/overall_summary.png +0 -0
- plots/v8/partial_vs_exact.png +0 -0
- plots/v8/per_type_f1.png +0 -0
- plots/vs_external.png +0 -0
.gitattributes
CHANGED
|
@@ -35,4 +35,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
leaderboard.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
leaderboard_18lang.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
-
per_language_internal.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
leaderboard.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
leaderboard_18lang.png filter=lfs diff=lfs merge=lfs -text
|
|
|
README.md
CHANGED
|
@@ -53,13 +53,16 @@ base_model:
|
|
| 53 |
|
| 54 |
# LFM2.5-Encoder-350-PII-Detector
|
| 55 |
|
| 56 |
-
A full fine-tune of [LFM2.5-Encoder-350M](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M) with a token-classification head, covering **40 PII types** across **16 languages**.
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).
|
| 59 |
|
| 60 |
> [!NOTE]
|
| 61 |
> 💻 **Demos**: Try this fine-tuned model running in a CPU-only Hugging Face space:
|
| 62 |
-
>
|
| 63 |
|
| 64 |
## Entity types (40 PII types across 11 domains)
|
| 65 |
|
|
@@ -79,25 +82,22 @@ Find more details about our encoders in our [blog post](https://www.liquid.ai/bl
|
|
| 79 |
|
| 80 |
## Benchmarks (18-locale-filtered, partial-F1, hybrid decode)
|
| 81 |
|
| 82 |
-
| Benchmark | **this model** | detection
|
| 83 |
-
|---|---|---|---|---|---|
|
| 84 |
-
| SPY | **0.428** | 0.509 | 0.
|
| 85 |
-
| Gretel | **0.880** | 0.885 | 0.
|
| 86 |
-
| TAB | **0.867** | 0.888 | 0.
|
| 87 |
-
| ai4privacy | **0.715** | 0.774 | 0.
|
| 88 |
-
| Nemotron | **0.855** | 0.863 | 0.
|
| 89 |
-
| MAPA | **0.236** | 0.267 | 0.
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |

|
| 92 |
|
| 93 |
-
- **Best on every benchmark except MAPA
|
| 94 |
-
|
| 95 |
-
anywhere — Piiranha-v1's 0.946 on ai4privacy and OpenMed's 0.918 on Nemotron — and both are
|
| 96 |
-
in-distribution: each model trains on that exact corpus, as did our own encoder's pretraining
|
| 97 |
-
on those same two.
|
| 98 |
-
- **Detection tier** is the same model and the same predictions, scored with the type label
|
| 99 |
-
ignored — did it find the PII span at all, which is the metric that matters for redaction. The
|
| 100 |
-
gap to exact-type is the type-confusion rate, e.g. SPY 0.428 → 0.509.
|
| 101 |
|
| 102 |
## Usage
|
| 103 |
|
|
|
|
| 53 |
|
| 54 |
# LFM2.5-Encoder-350-PII-Detector
|
| 55 |
|
| 56 |
+
A full fine-tune of [LFM2.5-Encoder-350M](https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M) with a token-classification head, covering **40 PII types** across **16 languages** (en, de, fr, es, pt, it, pl, ru, zh, ja, ko, ar, hi, id, vi, th).
|
| 57 |
+
Ships with an inference-timem**hybrid regex decode** (`pii_hybrid_decode.py`) that adds validator-gated formats (email/IBAN/credit-card/IP/JWT/…) and cue-gated IDs on top of the model.
|
| 58 |
+
|
| 59 |
+
Trained on a persona-driven, gemma-generated synthetic corpus (coherent locale-personas × scenarios × cue/inline/structured embedding × ID-contrastive disambiguation), LLM-judge-filtered and contamination-cleaned against all evaluation sets.
|
| 60 |
|
| 61 |
Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).
|
| 62 |
|
| 63 |
> [!NOTE]
|
| 64 |
> 💻 **Demos**: Try this fine-tuned model running in a CPU-only Hugging Face space:
|
| 65 |
+
> [PII detection](https://huggingface.co/spaces/LiquidAI/pii-detection)** — spot and remove 40 kinds of personal information across 16 languages.
|
| 66 |
|
| 67 |
## Entity types (40 PII types across 11 domains)
|
| 68 |
|
|
|
|
| 82 |
|
| 83 |
## Benchmarks (18-locale-filtered, partial-F1, hybrid decode)
|
| 84 |
|
| 85 |
+
| Benchmark | **this model** | detection-tier | prev (v8) | GLiNER | LFM-demo-q4 |
|
| 86 |
+
|---|---|---|---|---|---|
|
| 87 |
+
| SPY | **0.428** | 0.509 | 0.351 | 0.280 | 0.192 |
|
| 88 |
+
| Gretel | **0.880** | 0.885 | 0.758 | 0.663 | 0.804 |
|
| 89 |
+
| TAB | **0.867** | 0.888 | 0.749 | 0.685 | 0.490 |
|
| 90 |
+
| ai4privacy | **0.715** | 0.774 | 0.643 | 0.488 | 0.500 |
|
| 91 |
+
| Nemotron | **0.855** | 0.863 | 0.773 | 0.639 | 0.656 |
|
| 92 |
+
| MAPA | **0.236** | 0.267 | 0.486 | 0.416 | 0.250 |
|
| 93 |
+
| Internal (40-type) | **0.720** | 0.829 | 0.616 | 0.479 | 0.466 |
|
| 94 |
+
| ShieldFlow | **0.901** | 0.911 | 0.847 | 0.646 | 0.839 |
|
| 95 |
+
| ShieldFlow-xl | **0.859** | 0.871 | 0.797 | 0.658 | 0.842 |
|
| 96 |
|
| 97 |

|
| 98 |
|
| 99 |
+
- **Best overall** across general/multilingual benchmarks and the ShieldFlow product gate; beats SauerkrautLM-GLiNER and the LFM demo on every benchmark except MAPA's idiosyncratic date-as-`date_of_birth` labeling convention.
|
| 100 |
+
- **Detection-tier** (did it find the PII span, ignoring fine type — the metric that matters for redaction) is markedly higher than exact-type, e.g. Internal 0.83 / ShieldFlow 0.91.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
## Usage
|
| 103 |
|
leaderboard_18lang.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
plots/candidates_comparison.png
ADDED
|
plots/internal_v1/by_domain_f1.png
ADDED
|
plots/internal_v1/by_edge_f1.png
ADDED
|
plots/internal_v1/by_language_f1.png
ADDED
|
plots/internal_v1/gap_probe_recall.png
ADDED
|
plots/internal_v1/overall_summary.png
ADDED
|
plots/internal_v1/partial_vs_exact.png
ADDED
|
plots/internal_v1/per_type_f1.png
ADDED
|
plots/v7/by_domain_f1.png
ADDED
|
plots/v7/by_edge_f1.png
ADDED
|
plots/v7/by_language_f1.png
ADDED
|
plots/v7/gap_probe_recall.png
ADDED
|
plots/v7/overall_summary.png
ADDED
|
plots/v7/partial_vs_exact.png
ADDED
|
plots/v7/per_type_f1.png
ADDED
|
plots/v8/by_domain_f1.png
ADDED
|
plots/v8/by_edge_f1.png
ADDED
|
plots/v8/by_language_f1.png
ADDED
|
plots/v8/gap_probe_recall.png
ADDED
|
plots/v8/overall_summary.png
ADDED
|
plots/v8/partial_vs_exact.png
ADDED
|
plots/v8/per_type_f1.png
ADDED
|
plots/vs_external.png
ADDED
|