--- license: apache-2.0 library_name: transformers pipeline_tag: token-classification base_model: FacebookAI/xlm-roberta-large language: - en - ru - de - fr - es - it - nl - pt - pl - uk - tr - kk - be tags: - pii - privacy - redaction - anonymization - data-masking - named-entity-recognition - xlm-roberta --- # PIIX-560m PIIX-560m is a multilingual model for detecting and masking personally identifiable information (PII) and secrets in text. It combines a fine-tuned XLM-RoBERTa-large token classifier (560M parameters) with a rule layer for structured identifiers such as card numbers, IBANs and API keys. - **Developed by:** [Tracer](https://tracerml.ai) - **Model type:** token classification with rule-based post-processing - **Languages:** English, Russian, German, French, Spanish, Italian, Dutch, Portuguese, Polish, Ukrainian, Turkish, Kazakh, Belarusian - **License:** Apache 2.0 - **Base model:** [FacebookAI/xlm-roberta-large](https://huggingface.co/FacebookAI/xlm-roberta-large) ## Usage The full pipeline lives in `piix.py` (tagger, rules, type filter, whole-word masking). Download `piix.py`, `rules.py` and `type_filter.py` from this repository. ```bash pip install torch transformers safetensors ``` ```python from piix import Redactor redactor = Redactor() # loads Tracer-ML/PIIX-560m on CUDA, Apple GPU or CPU redactor.redact("Hi, this is Maria Gonzalez from Acme Corp. Reach me at maria.g@acme.io or +1 415 555 0134.") # 'Hi, this is [REDACTED] from [REDACTED] Reach me at [REDACTED] or [REDACTED]' result = redactor.find( ["Contact jdoe_91, tel 415-555-0134"], types=["user name", "phone number"], recall=4, )[0] result["findings"] # typed spans with character offsets result["mask"] # merged spans to hide ``` Command line: ```bash echo "some text" | python piix.py --recall 4 ``` ### Parameters | Parameter | Description | |---|---| | `recall` | Sensitivity. `0` (default) favours precision, `4` is balanced, `8` maximises coverage. | | `types` | Optional list of entity type names to keep, in plain English. If a name is not recognised, all types are kept and the name is listed in `redactor.unrecognised_types`. | | `use_rules` | Enable the rule layer for structured identifiers. Default `True`. | | `widen` | Extend every finding to whole words. Default `True`. | `Redactor(adapter=...)` loads a fine-tuned adapter (see Fine-tuning). Documents of any length are supported through overlapping 512-token windows. > The reported results use the full pipeline. Loading the checkpoint as a plain `token-classification` pipeline skips > the rule layer and masking logic and gives lower coverage. ## Fine-tuning PIIX-560m can be adapted to a specific labelling policy with a LoRA adapter trained on a few hundred hand-labelled documents. See [FINETUNING.md](FINETUNING.md). ```bash pip install peft python piix_finetune.py fit labelled.jsonl --out my_adapter ``` ```python redactor = Redactor(adapter="my_adapter") ``` | Labelled documents | Gretel PII masking | ai4privacy 300k (English) | ai4privacy 300k (de, es, fr, it, nl) | |---|---|---|---| | 0 (base model) | 89.2 | 85.8 | 83.5 | | 50 | 93.3 | 91.0 | 89.9 | | 200 | 94.1 | 92.1 | 90.8 | | 1,000 | 95.6 | 93.7 | 92.1 | F1 on held-out documents after fine-tuning on documents from the same dataset. The base model row is measured with no `types` list. ## Entity types | Group | Types | |---|---| | People | given name, family name, person, username | | Organizations | organization | | Contact | email, phone number, postal address, location | | Identifiers | account number, employee ID, national ID, passport, tax number, other ID numbers | | Technical | URL, IP address, MAC address, hostname | | Secrets | API keys, tokens, passwords, private keys, credentials in connection strings | | Dates | dates | | Sensitive attributes | age, gender, marital status, nationality, belief, medical, financial, HR record | ## Evaluation Character-level precision, recall and F1 are computed on masked characters, ignoring entity type. **Not fully hidden** is the share of gold spans with at least one visible character after masking (lower is better). ### PII Arena Tracer evaluated the released PIIX-560m on 40 of the 41 frozen [PII Arena v1.0.3](https://www.piiarena.com/methodology) datasets. Each setting covered 40,147 records and 226,720 annotated spans. Arena’s strict scorer reproduced all 80 per-dataset results. Rows marked * use Arena’s published counts for the same 40 datasets. | Model | Not fully hidden ↓ | Missed ↓ | Precision | Recall | F1 | |---|---|---|---|---|---| | **PIIX-560m** (`recall=8`) | **3.46%** | 2.16% | 54.26 | 97.45 | 69.71 | | PII-Tracer + GLiNER2 + BardsAI + mmBERT ensemble* | 5.61% | **1.44%** | 53.2 | 96.6 | 68.6 | | **PIIX-560m** (default) | 9.36% | 6.55% | 69.26 | 93.04 | **79.41** | | Fastino GLiNER2* | 20.17% | 13.22% | 75.1 | 77.7 | 76.4 | | Perplexity PII-Tracer* | 25.14% | 21.00% | 64.9 | 79.6 | 71.5 | | OpenAI Privacy Filter* | 40.43% | 34.72% | | | | The submission requests evaluation on the remaining dataset, `secrets-rules`. [Tracer’s measurements, adapter, and reproduction instructions](https://github.com/Quakeer444/pii-arena/pull/3) ### PrivacyBench+ [PrivacyBench+](https://huggingface.co/datasets/Tracer-ML/PrivacyBench-Plus): enterprise chat messages and documents, 1,877 records. | Model | Precision | Recall | F1 | |---|---|---|---| | **PIIX-560m** | 96.5 | 97.2 | **96.9** | | Fastino GLiNER2.5-base | 89.3 | 83.4 | 86.2 | | Perplexity PII-Tracer | 86.1 | 72.9 | 79.0 | | OpenAI Privacy Filter | 87.6 | 64.1 | 74.1 | ### Additional benchmarks F1, with the share of spans not fully hidden in parentheses. | Model | Gretel PII masking (test) | ai4privacy 300k (English) | ai4privacy 300k (de, es, fr, it, nl) | |---|---|---|---| | Perplexity PII-Tracer | 95.4 (1.47%) | 95.5 (0.39%) | 95.0 (0.65%) | | Nym base | 93.9 (12.84%) | 91.4 (13.52%) | 91.2 (13.18%) | | **PIIX-560m** | 92.1 (1.19%) | 85.7 (5.99%) | 83.5 (6.53%) | | OpenAI Privacy Filter | 90.2 (16.16%) | 91.1 (21.11%) | 90.6 (21.00%) | Gretel: 5,000 test documents. ai4privacy: 3,000 validation rows per column. All models evaluated with the PII Arena runner and the same scorer. ### Speed | Hardware | Chat message | Document page | |---|---|---| | NVIDIA A100 | 26.5 ms | 61.9 ms | | Apple M5 Max | 32 ms | 214 ms | | NVIDIA T4 | 48 ms | 300 ms | ## Limitations - At the default setting the model masks all dates and organization names it finds. Use `types` to restrict the output when a narrower definition of PII is needed. - Higher `recall` values increase coverage and also increase over-masking. - Indirect identifiers, such as a product name that reveals an employer, are only partially covered. - Results on domains far from the training data may be lower than those of large language models. - Outputs can differ slightly across hardware because of mixed-precision inference. - The model does not guarantee anonymization. Review its output before relying on it for compliance. ## Training Trained on 31M tokens. The training data is not released. ## License Apache License 2.0. ## Citation ```bibtex @misc{piix560m2026, title = {PIIX-560m}, author = {Tracer}, year = {2026}, url = {https://huggingface.co/Tracer-ML/PIIX-560m} } ```