Downloads · 30 days
58
6% of all-time downloads
Meddies/meddies-pii-v2
meddies-pii-v2 is a token classification model from Meddies. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
<p align="left" <a href="https://huggingface.co/spaces/Meddies/meddies-pii-extractor"<img alt="Try the browser demo" src="https://img.shields.io/badge/Demo-0F172A?style=flat&logo=googlechrome&logoColor=white"</a <a hr…
Downloads · 30 days
58
6% of all-time downloads
All-time downloads
1K
Public
Parameters
355M
901 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors901 MB · 99%
From the Hugging Face model README
A 350M encoder that finds nine types of personally identifiable information across 17 languages and returns exact character spans for review and redaction.
[!CAUTION] Keep a human in the loop
This model can miss identifiers. It cannot certify that text is safe to share. Test it on your documents and keep human review in any regulated workflow.
<p align="center"> <img src="./assets/hero-meddies-pii-v2.png" alt="Meddies PII v2 detects nine PII entity families across 17 languages and returns exact character spans" width="100%" /> </p>[!NOTE] Commercial licensing
CC BY-NC 4.0 applies to the rights MeddiesAI can license in this release. Contact [email protected] about commercial terms for those contributions. The underlying LiquidAI materials remain subject to LFM Open License v1.0.
Clinical records rarely keep identifiers tidy. One note can mix a patient name, hospital ID, phone number, signed portal link, login secret, and a date format that only makes sense locally. Rules catch the obvious cases, then lose ground when the language or document template changes.
Meddies PII v2 handles those cases through one span extraction interface. We built it for clinical text, but its nine labels also cover general documents that need review before release.
Pass in raw text. The model returns the label, text, start offset, and end offset for every detected span.
address, company_name, date, email_address, human_name, id_number, phone_number, private_url, and secret.import sys
from huggingface_hub import snapshot_download
path = snapshot_download("Meddies/meddies-pii-v2")
sys.path.insert(0, path)
from modeling_meddies_pii import MeddiesPiiExtractor
model = MeddiesPiiExtractor.from_pretrained(path)
spans = model.extract(
"Bệnh nhân Nguyễn Văn A, SĐT 0912 345 678, tái khám ngày 12/08/2026."
)
for span in spans:
print(span.label, span.start, span.end, span.text)
Expected output
human_name 10 22 Nguyễn Văn A
phone_number 28 40 0912 345 678
date 56 66 12/08/2026
| Form | Load | Parity check | Use it when |
|---|---|---|---|
| Adapter | from_pretrained(path) | 0 of 200 rows differed | You need the evaluated execution path. |
| Merged | from_pretrained(path, weights="merged") | 14 of 200 rows differed | You need one self-contained weight file and can accept the measured delta. |
Merging folds the adapter into the base weights and changes the numerical path. Borderline BIOES decisions can move. Use the adapter when exact release reproduction matters.
The ONNX companion packages the same checkpoint for ONNX Runtime and WebGPU. Its full precision graph matched the PyTorch adapter on all 200 parity rows. The current int8 graph differed on 12 of 200 rows.
The browser demo runs on the user's device. Raw clinical text never leaves the device.
Meddies PII v2 reached 0.8937 exact typed micro F1 and 0.9429 containment typed micro F1 on 263,785 benchmark rows. It had the highest exact typed F1 in all 17 evaluation cells, all 17 language slices, and all nine entity families against the six reference systems in this comparison.
<p align="center"> <img src="./assets/evaluation-meddies-pii-v2.png" alt="Meddies PII v2 evaluation snapshot with overall, comparative, entity, and language results" width="100%" /> </p>Exact typed F1 requires the label and both character boundaries to match. Containment typed F1 accepts a correct label when one span contains the other. Each macro average gives the same weight to the unit named in the column.
| Model | Evaluation cell macro F1 | Language macro F1 | Entity family macro F1 |
|---|---|---|---|
| Meddies PII v2 | 0.833 | 0.852 | 0.907 |
| OpenAI Privacy Filter | 0.644 | 0.592 | 0.673 |
| Meddies PII v1 | 0.602 | 0.574 | 0.676 |
| GLiNER2 | 0.581 | 0.539 | 0.682 |
| OpenMed PII | 0.538 | 0.439 | 0.617 |
| LFM2.5 PII Detector | 0.536 | 0.446 | 0.552 |
The v2 preview is the earlier 150-step checkpoint that preceded this release.
| Evaluation cell | Meddies v2 | GLiNER2 | v2 preview | Meddies v1 | OpenMed | OpenAI PF | LFM2.5 PII |
|---|---|---|---|---|---|---|---|
ai4privacy_de | 0.827 | 0.663 | 0.664 | 0.616 | 0.620 | 0.716 | 0.610 |
ai4privacy_en | 0.878 | 0.687 | 0.673 | 0.667 | 0.656 | 0.745 | 0.568 |
ai4privacy_es | 0.870 | 0.732 | 0.725 | 0.649 | 0.683 | 0.794 | 0.655 |
ai4privacy_fil | 0.848 | 0.690 | 0.590 | 0.606 | 0.584 | 0.667 | 0.600 |
ai4privacy_fr | 0.844 | 0.674 | 0.679 | 0.618 | 0.604 | 0.738 | 0.611 |
ai4privacy_id | 0.848 | 0.688 | 0.601 | 0.588 | 0.566 | 0.664 | 0.627 |
ai4privacy_ja | 0.750 | 0.366 | 0.499 | 0.659 | 0.493 | 0.549 | 0.479 |
ai4privacy_ko | 0.739 | 0.322 | 0.523 | 0.611 | 0.545 | 0.554 | 0.460 |
ai4privacy_ms | 0.839 | 0.692 | 0.586 | 0.598 | 0.547 | 0.640 | 0.587 |
ai4privacy_pt | 0.855 | 0.692 | 0.691 | 0.643 | 0.687 | 0.756 | 0.651 |
ai4privacy_vi | 0.880 | 0.628 | 0.615 | 0.644 | 0.499 | 0.634 | 0.615 |
ai4privacy_zh | 0.816 | 0.453 | 0.600 | 0.643 | 0.428 | 0.572 | 0.548 |
creddata_en | 0.590 | 0.357 | 0.226 | 0.035 | 0.150 | 0.370 | 0.263 |
gretel_en | 0.872 | 0.588 | 0.734 | 0.743 | 0.715 | 0.697 | 0.729 |
nemotron_en | 0.956 | 0.692 | 0.792 | 0.837 | 0.878 | 0.778 | 0.574 |
v2-eval | 0.863 | 0.478 | 0.504 | 0.525 | 0.260 | 0.523 | 0.277 |
v2-eval-challenge | 0.893 | 0.473 | 0.568 | 0.551 | 0.228 | 0.557 | 0.260 |
| Macro average | 0.833 | 0.581 | 0.604 | 0.602 | 0.538 | 0.644 | 0.536 |
| Entity family | Exact F1 | Containment F1 |
|---|---|---|
address | 0.681 | 0.866 |
company_name | 0.939 | 0.946 |
date | 0.957 | 0.961 |
email_address | 0.984 | 0.990 |
human_name | 0.917 | 0.951 |
id_number | 0.954 | 0.958 |
phone_number | 0.919 | 0.951 |
private_url | 0.902 | 0.925 |
secret | 0.913 | 0.936 |
The benchmark combines synthetic and public corpora. A strong benchmark score does not tell you how the model behaves inside one hospital. Evaluate it on local document types before deployment.
We adapted LiquidAI LFM2.5 Encoder 350M PII Detector with rank 128 Low-Rank Adaptation and a 37-tag BIOES classification head.
Training used the Meddies PII v2 dataset and external public corpora rebuilt from their original sources. We do not rehost those external corpora. Checkpoint selection used a pinned control set before the full benchmark. The complete recipe and release checks live in TRAINING.md.
MeddiesAI applies CC BY-NC 4.0 to the copyright and related rights it can license in this release. See LICENSE.
The underlying LiquidAI materials remain under LFM Open License v1.0. Upstream attribution and the MeddiesAI change record are preserved in NOTICE. Review both licenses before redistribution.
Found a bad miss or a wrong boundary? Share the language, document type, expected span, predicted span, and whether optical character recognition was involved. Use a safe synthetic example. Never post real patient text or credentials in a public issue.
Open a thread in the Community tab or email [email protected].
We are looking for hospitals, research groups, and privacy teams that can contribute de-identified failure cases, independent evaluations, or review in underrepresented languages. Email [email protected] to work with us.
@misc{meddies-pii-v2,
title={Meddies PII v2 for multilingual clinical de-identification},
author={MeddiesAI},
year={2026},
url={https://huggingface.co/Meddies/meddies-pii-v2}
}