Token Classification
Transformers
Safetensors
lfm2
liquid
lfm2.5
bidirectional
masked-lm
encoder
pii
ner
privacy
multilingual
custom_code
Run this model with HF Jobs
Run LiquidAI/LFM2.5-Encoder-350M-PII-Detector on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M-PII-Detector. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/LiquidAI/LFM2.5-Encoder-350M-PII-Detector on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
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)# pip install -U transformers accelerate # 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
Files changed (26)
- .gitattributes-1
- README.md+18-18
- leaderboard_18lang.png
- plots/candidates_comparison.pngAdded
- plots/internal_v1/by_domain_f1.pngAdded
- plots/internal_v1/by_edge_f1.pngAdded
- plots/internal_v1/by_language_f1.pngAdded
- plots/internal_v1/gap_probe_recall.pngAdded
- plots/internal_v1/overall_summary.pngAdded
- plots/internal_v1/partial_vs_exact.pngAdded
- plots/internal_v1/per_type_f1.pngAdded
- plots/v7/by_domain_f1.pngAdded
- plots/v7/by_edge_f1.pngAdded
- plots/v7/by_language_f1.pngAdded
- plots/v7/gap_probe_recall.pngAdded
- plots/v7/overall_summary.pngAdded
- plots/v7/partial_vs_exact.pngAdded
- plots/v7/per_type_f1.pngAdded
- plots/v8/by_domain_f1.pngAdded
- plots/v8/by_edge_f1.pngAdded
- plots/v8/by_language_f1.pngAdded
- plots/v8/gap_probe_recall.pngAdded
- plots/v8/overall_summary.pngAdded
- plots/v8/partial_vs_exact.pngAdded
- plots/v8/per_type_f1.pngAdded
- plots/vs_external.pngAdded
34 unmodified lines3536373834 unmodified lines*tfevents* filter=lfs diff=lfs merge=lfs -textleaderboard.png filter=lfs diff=lfs merge=lfs -textleaderboard_18lang.png filter=lfs diff=lfs merge=lfs -textper_language_internal.png filter=lfs diff=lfs merge=lfs -text34 unmodified lines35363734 unmodified lines*tfevents* filter=lfs diff=lfs merge=lfs -textleaderboard.png filter=lfs diff=lfs merge=lfs -textleaderboard_18lang.png filter=lfs diff=lfs merge=lfs -text
52 unmodified lines5354555657585960616263646513 unmodified lines79808182838485868788899091929394959697989910010110210352 unmodified lines# LFM2.5-Encoder-350-PII-DetectorA 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**.Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).> [!NOTE]> 💻 **Demos**: Try this fine-tuned model running in a CPU-only Hugging Face space:> **[PII detection](https://huggingface.co/spaces/LiquidAI/pii-detection)** — spot and remove 40 kinds of personal information across 16 languages.## Entity types (40 PII types across 11 domains)13 unmodified lines## Benchmarks (18-locale-filtered, partial-F1, hybrid decode)| Benchmark | **this model** | detection tier | SauerkrautLM GLiNER | openai/privacy-filter | Piiranha-v1 | OpenMed privacy-filter | regex + validators ||---|---|---|---|---|---|---|---|| SPY | **0.428** | 0.509 | 0.280 | 0.264 | 0.232 | 0.226 | 0.358 || Gretel | **0.880** | 0.885 | 0.663 | 0.458 | 0.553 | 0.770 | 0.337 || TAB | **0.867** | 0.888 | 0.685 | 0.543 | 0.262 | 0.672 | 0.000 || ai4privacy | **0.715** | 0.774 | 0.488 | 0.394 | 0.946 | 0.432 | 0.195 || Nemotron | **0.855** | 0.863 | 0.639 | 0.572 | 0.658 | 0.918 | 0.335 || MAPA | **0.236** | 0.267 | 0.416 | 0.288 | 0.228 | 0.164 | 0.000 |- **Best on every benchmark except MAPA**, whose idiosyncratic date-as-`date_of_birth` labelingconvention penalises correctly-typed predictions. Only two external scores land higheranywhere — Piiranha-v1's 0.946 on ai4privacy and OpenMed's 0.918 on Nemotron — and both arein-distribution: each model trains on that exact corpus, as did our own encoder's pretrainingon those same two.- **Detection tier** is the same model and the same predictions, scored with the type labelignored — did it find the PII span at all, which is the metric that matters for redaction. Thegap to exact-type is the type-confusion rate, e.g. SPY 0.428 → 0.509.## Usage52 unmodified lines5354555657585960616263646566676813 unmodified lines82838485868788899091929394959697989910010110210352 unmodified lines# LFM2.5-Encoder-350-PII-DetectorA 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).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.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.Find more details about our encoders in our [blog post](https://www.liquid.ai/blog/lfm2-5-encoders).> [!NOTE]> 💻 **Demos**: Try this fine-tuned model running in a CPU-only Hugging Face space:> [PII detection](https://huggingface.co/spaces/LiquidAI/pii-detection)** — spot and remove 40 kinds of personal information across 16 languages.## Entity types (40 PII types across 11 domains)13 unmodified lines## Benchmarks (18-locale-filtered, partial-F1, hybrid decode)| Benchmark | **this model** | detection-tier | prev (v8) | GLiNER | LFM-demo-q4 ||---|---|---|---|---|---|| SPY | **0.428** | 0.509 | 0.351 | 0.280 | 0.192 || Gretel | **0.880** | 0.885 | 0.758 | 0.663 | 0.804 || TAB | **0.867** | 0.888 | 0.749 | 0.685 | 0.490 || ai4privacy | **0.715** | 0.774 | 0.643 | 0.488 | 0.500 || Nemotron | **0.855** | 0.863 | 0.773 | 0.639 | 0.656 || MAPA | **0.236** | 0.267 | 0.486 | 0.416 | 0.250 || Internal (40-type) | **0.720** | 0.829 | 0.616 | 0.479 | 0.466 || ShieldFlow | **0.901** | 0.911 | 0.847 | 0.646 | 0.839 || ShieldFlow-xl | **0.859** | 0.871 | 0.797 | 0.658 | 0.842 |- **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.- **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.## Usage
.gitattributes-1
README.md+18-18
leaderboard_18lang.png

Large File Pointer Details
- SHA256: e07a7e7a92156948ab7fa700a6aab58385588712f8559b92d8e0414c5a81bbd8
- Pointer size: 131 Bytes
- Size of remote file: 174 kB

Large File Pointer Details
- SHA256: da826baa3ee36608bde022a59a18e3307904c3964c08e14b9a0a6980f864e2c6
- Pointer size: 131 Bytes
- Size of remote file: 123 kB
plots/candidates_comparison.pngAdded

plots/internal_v1/by_domain_f1.pngAdded

plots/internal_v1/by_edge_f1.pngAdded

plots/internal_v1/by_language_f1.pngAdded

plots/internal_v1/gap_probe_recall.pngAdded

plots/internal_v1/overall_summary.pngAdded

plots/internal_v1/partial_vs_exact.pngAdded

plots/internal_v1/per_type_f1.pngAdded

plots/v7/by_domain_f1.pngAdded

plots/v7/by_edge_f1.pngAdded

plots/v7/by_language_f1.pngAdded

plots/v7/gap_probe_recall.pngAdded

plots/v7/overall_summary.pngAdded

plots/v7/partial_vs_exact.pngAdded

plots/v7/per_type_f1.pngAdded

plots/v8/by_domain_f1.pngAdded

plots/v8/by_edge_f1.pngAdded

plots/v8/by_language_f1.pngAdded

plots/v8/gap_probe_recall.pngAdded

plots/v8/overall_summary.pngAdded

plots/v8/partial_vs_exact.pngAdded

plots/v8/per_type_f1.pngAdded

plots/vs_external.pngAdded
