/ Модель

Характеристики

Контекст
512 токенов
Параметры
124 млн
Лицензия
BSD 3-Clause
Архитектура
bert · dense
Базовая модель
Multilingual-MiniLM-L12-H384
Библиотека
transformers
Опубликована
30 окт 2026

privaite-pii-minilm

Разметка токеновТекст → label7 профессий
515скачиваний за 30 дней4лайкавеса обновлены2 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Многоязычная модель для обнаружения и разметки персональных данных в тексте перед их маскированием.

PrivAiTe PII MiniLM — дообученный классификатор токенов на базе многоязычной MiniLM от Microsoft, разработанный для локального обнаружения персональных данных перед отправкой текста, например, в запросе к LLM. Модель размечает текст по схеме BIO и распознаёт 15 типов сущностей; архитектура — BERT, около 124 млн параметров по метаданным и контекст до 512 токенов. В README описано применение окон по 256 токенов с перекрытием 64 токена.

Модель рассчитана на выявление и маскирование имён, контактов, адресов и других персональных данных. Она доступна в PyTorch, ONNX и Core ML; README сообщает о варианте ONNX INT8 для CPU и Core ML для Apple Neural Engine. Указаны результаты на нескольких наборах данных, включая сравнительно высокую точность маскирования, однако модель может пропускать данные и ошибаться на коротких запросах без контекста. Маскирование является псевдонимизацией, а не анонимизацией, поэтому модель не следует использовать как единственную защиту. Лицензия — BSD-3-Clause.

Сценарии применения

  • поиск имён и фамилий в тексте
  • обнаружение адресов электронной почты и телефонов
  • выявление адресов и идентификаторов перед отправкой текста в LLM
  • разметка персональных данных для последующего маскирования
  • локальная фильтрация персональных данных в трафике LLM

Ограничения

Модель может пропускать персональные данные, особенно имена в коротких запросах без контекста; для секретов в коде README сообщает о низком обнаружении. Маскирование не является анонимизацией, поэтому результаты следует проверять и дополнять правилами для структурированных идентификаторов.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит7

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

PrivAiTe PII MiniLM

A small multilingual token classifier that finds personal data in text so it can be masked before the text leaves your machine, for example before a prompt is sent to an LLM. It was built for PrivAiTe, a local proxy that masks personal data in LLM traffic.

  • 117M parameters, of which 96M are the frozen multilingual embedding table (MiniLM L12 H384, XLM-R vocabulary).
  • 15 entity types, BIO tagging (31 labels).
  • Ships in three forms: PyTorch (model.safetensors), ONNX for CPU (onnx/model.onnx, onnx/model_int8.onnx) and Core ML for the Apple Neural Engine (coreml/pilot_ane_256.mlpackage).
  • On 6 of the 9 unseen test sets below it masks as many persons as the best of five open PII models (2.5 to 7 times its size on disk) or more, usually with higher precision, at 9 ms per 1,000 characters on an M1 Pro Neural Engine (23 ms on CPU with int8).

Masking replaces what the model finds; it is pseudonymisation, not anonymisation, and the model will miss some personal data (see Limitations).

Entity types

TypeExamples
PERSONfirst names, last names, full names
CONTACTemail addresses, phone and fax numbers, URLs, user names
ADDRESSstreet addresses, building numbers
LOCATIONcities, regions, countries, postcodes, coordinates
ORGANIZATIONcompanies and other organizations
DATEdates and times
DATE_OF_BIRTHdates of birth
AGEages
DEMOGRAPHICgender, ethnicity, religion, political view, occupation and similar
GOV_IDnational IDs, passport, driver licence, tax and social security numbers
FINANCIALIBAN, account and card numbers, routing and SWIFT codes
NETWORK_IDIP and MAC addresses, device identifiers
RECORD_IDcustomer, employee, medical record and similar identifiers, licence plates
SECRETpasswords, PINs, API keys, card security codes, cookies
OTHERother personal data in the training sets (for example titles)

Usage

In PrivAiTe

Since PrivAiTe 0.8.0, two opt-in presets use this model in place of the Privacy Filter:

pii:
  preset: minilm      # ONNX on CPU, any platform
  # preset: ultrafast # Core ML on the Apple Neural Engine (macOS, pip install 'privaite[ane]')

Transformers

from transformers import pipeline

pii = pipeline("token-classification", model="crp4222/privaite-pii-minilm",
               aggregation_strategy="simple", stride=64)
pii("Hi, I'm Marie Dupont, call me at +33 6 12 34 56 78 or write to marie.dupont@example.fr.")
# PERSON 'Marie', PERSON 'Dupont', CONTACT '+33 6 12 34 56 78', CONTACT 'marie.dupont@example.fr'

The model was trained and evaluated on windows of 256 tokens with 64 tokens of overlap; the tokenizer is set to 256 so that stride=64 reproduces that on long text. Adjacent spans of the same type (a first and a last name) can be merged before masking.

ONNX (CPU)

import numpy as np, onnxruntime as ort
from huggingface_hub import snapshot_download
from transformers import AutoConfig, AutoTokenizer

path = snapshot_download("crp4222/privaite-pii-minilm", allow_patterns=["*.json", "onnx/model_int8.onnx"])
tok = AutoTokenizer.from_pretrained(path)
labels = AutoConfig.from_pretrained(path).id2label
sess = ort.InferenceSession(f"{path}/onnx/model_int8.onnx", providers=["CPUExecutionProvider"])

def find_pii(text):
    enc = tok(text, return_offsets_mapping=True, truncation=True, max_length=256, stride=64,
              return_overflowing_tokens=True)
    best = {}  # each token keeps the prediction of the window where it sits furthest from an edge
    for ids, offsets in zip(enc["input_ids"], enc["offset_mapping"]):
        a = np.array([ids], dtype=np.int64)
        pred = sess.run(None, {"input_ids": a, "attention_mask": np.ones_like(a)})[0][0].argmax(-1)
        for k, (s, e) in enumerate(offsets):
            dist = min(k, len(ids) - 1 - k)
            if s < e and ((s, e) not in best or dist > best[(s, e)][0]):
                best[(s, e)] = (dist, labels[int(pred[k])])
    spans, cur = [], None
    for (s, e), (_, label) in sorted(best.items()):
        if label == "O":
            cur = None
        elif cur and label == "I-" + cur[2]:
            cur[1] = e
        else:
            cur = [s, e, label[2:]]
            spans.append(cur)
    return spans

onnx/model.onnx (fp32) gives exactly the PyTorch predictions; onnx/model_int8.onnx is 4 times smaller and about twice as fast, with the same accuracy within a point (table below).

Core ML (Apple Neural Engine)

coreml/pilot_ane_256.mlpackage is the same encoder rewritten in Apple's layout for the Neural Engine, fp16, with a fixed input of 256 tokens: inputs input_ids and attention_mask (int32, shape 1 x 256, padded with the tokenizer's pad id and a zero mask), output logits (1 x 256 x 31). Use the same windows as above and pad each one:

import coremltools as ct
ml = ct.models.MLModel(f"{path}/coreml/pilot_ane_256.mlpackage", compute_units=ct.ComputeUnit.CPU_AND_NE)
ids_pad = np.full((1, 256), tok.pad_token_id, dtype=np.int32); mask = np.zeros((1, 256), dtype=np.int32)
ids_pad[0, :len(ids)], mask[0, :len(ids)] = ids, 1
logits = ml.predict({"input_ids": ids_pad, "attention_mask": mask})["logits"][0, :len(ids)]

Evaluation

All numbers come from the scorer of privaite-bench, with the competitors run as that benchmark runs them:

  • Persons fully masked: share of person mentions whose every non-space character is masked (a half-masked name counts as missed).
  • Precision: share of masked characters that fall inside an annotated span of any class. Where a corpus annotates only some classes (persons, places, organizations), correct masks of other personal data count against precision, for every system alike.
  • Verdicts use a paired bootstrap of the difference (2,000 resamples, 95%): bold marks the best system, and a model is called ahead or behind only when the interval excludes zero.

Test sets never seen in training

Each suite was built from public datasets that were never used for training or model selection, before the training it was meant to judge, with every training document sharing a 10-word sequence with a test document removed. Lower-cased suites test text typed without capitals (chat, voice transcripts).

Persons fully masked (%)

Test setThis modelGLiNER PIINVIDIA GLiNER-PIIGLiNER2 PIIPiiranhaOpenAI privacy-filter
WikiNER fr, GermEval de, UNER de and pt93.690.686.982.636.315.8
Europarl de, en, es, it and SwissNER de, fr, it97.095.0 (tie)94.186.261.744.4
VoxPopuli, Few-NERD, UNER en and da (lower case)89.287.9 (tie)82.083.071.820.7
WikiGold (lower case)92.188.484.676.473.919.9
CrossNER, UNER English PUD (lower case)92.692.3 (tie)91.1 (tie)87.774.39.2
MASSIVE de, en, es, fr, it, pt (voice requests)82.787.970.379.222.913.1
MTOP de, en, es, fr and SGD en, natural and lower case97.998.991.588.732.243.4
TAB, European Court of Human Rights (en)63.562.4 (tie)74.657.145.052.6
PIILO, student essays (en)91.690.9 (tie)86.283.441.969.7

"(tie)" means no significant difference with this model. Against GLiNER PII, this model is ahead on two sets, tied on five and behind on two (short voice and assistant requests, where GLiNER PII also masks more text that is not personal data); NVIDIA GLiNER-PII is ahead on TAB.

Precision (%)

Test setThis modelGLiNER PIINVIDIA GLiNER-PIIGLiNER2 PIIPiiranhaOpenAI privacy-filter
WikiNER fr, GermEval de, UNER de and pt91.169.974.080.287.182.6
Europarl and SwissNER82.964.069.879.798.775.4
VoxPopuli, Few-NERD, UNER en and da (lower case)83.062.970.178.585.679.2
CrossNER, UNER English PUD (lower case)91.176.379.483.191.089.0
MASSIVE (voice requests)85.475.487.789.387.392.6
MTOP and SGD95.095.097.798.598.395.3
TAB94.967.886.192.298.598.5

High precision with low recall (Piiranha, privacy-filter on several sets) means a system masks little; the useful comparison is precision at a given level of persons masked.

privaite-bench, the corpora this model never saw (TAB, PIILO, Privy; 627 documents)

Here the measure covers every direct identifier (names, emails, phone numbers, IDs, card and account numbers, secrets, addresses), not only persons. The benchmark's 5 other corpora are left out: this model trained on their train splits.

This model (ONNX fp32)GLiNER PIINVIDIA GLiNER-PIIGLiNER2 PIIPiiranhaOpenAI privacy-filter
Direct identifiers fully masked82.772.381.373.642.964.8
Precision86.452.663.865.577.668.6

Precision is on TAB and Privy (PIILO annotates only part of its personal data). On direct identifiers this model is tied with NVIDIA GLiNER-PII (difference +1.4, interval -1.3 to +4.1) and ahead of the others; on precision it is ahead of all five.

By build

The same nine test sets through the detector PrivAiTe ships (256-token windows, spans extended to whole words, which is why fp32 here can sit up to a point above the table above), persons fully masked (%):

Test setONNX fp32ONNX int8Core ML fp16 (Neural Engine)
WikiNER fr, GermEval de, UNER de and pt93.992.793.9
Europarl and SwissNER97.597.197.5
VoxPopuli, Few-NERD, UNER en and da (lower case)90.188.790.2
WikiGold (lower case)92.491.992.4
CrossNER, UNER English PUD (lower case)93.692.593.6
MASSIVE (voice requests)83.680.683.7
MTOP and SGD98.097.698.0
TAB63.563.063.5
PIILO91.992.591.9

Core ML is tied with fp32 on all nine sets. int8 is behind on five of them (paired bootstrap), by 0.4 to 3 points, most on short voice requests.

Secrets in code

Samsung's CredData: real code from public repositories, credentials reviewed by hand, split by repository so 154 repositories (7,852 credentials, 4,649 values labeled not-a-credential) were never seen in training. A credential counts only if every non-space character is masked.

Credentials fully maskedFalse alarms
This model alone22.0%15.6%
PrivAiTe minilm preset (model + rules, 0.8.1)35.2%25.1%
PrivAiTe onnx preset (openai/privacy-filter + rules)59.8%30.6%

Alone, the model is fine on passwords (61%) and tokens (56%), near zero on private keys, JWTs and generic keys. PrivAiTe's rules take care of private keys, JWTs and Basic headers; generic keys and secrets assigned under arbitrary names stay far behind the Privacy Filter (keys 7% against 34%, secrets 13% against 86%). For code full of keys, use the onnx preset.

Speed

Measured by the benchmark's own worker on all 1,607 documents of privaite-bench (a warm-up call first, then wall time around detection for each whole document, windows included), Apple M1 Pro, 8 CPU threads.

Median per documentMedian per 1,000 charactersSize
This model, Core ML (Neural Engine)5.6 ms9.3 ms224 MB
This model, ONNX int8 (CPU)14.8 ms22.7 ms113 MB
This model, ONNX fp32 (CPU)29.5 ms41.2 ms448 MB
OpenAI privacy-filter134.6 ms186 ms3.1 GB
Piiranha113.1 ms233 ms1.1 GB
GLiNER PII184.8 ms258 ms1.1 GB
GLiNER2 PII218.3 ms305 ms1.2 GB
NVIDIA GLiNER-PII413.5 ms621 ms1.7 GB

The competitors run on CPU through their own libraries, as in the benchmark.

Training

  • Base: microsoft/Multilingual-MiniLM-L12-H384 (revision 6e8c1ec), word embeddings frozen.
  • Stage 1: 2 epochs on real and synthetic annotated text (table below), batches of 256-token windows. Stage 2: 0.35 epoch at a learning rate of 3e-5 on the same data plus structured records (the same annotated values laid out as JSON, YAML, SQL, HTML, .env, CSV and log lines under field names, with look-alike fields that hold no personal data), so that values in agent traffic are read with their keys.
  • 20% of documents lower-cased and 5% upper-cased, character by character.
  • MultiCoNER sentences in which an earlier checkpoint found a person that the dataset left unannotated were dropped (MultiCoNER only annotates the mentions linked in Wikipedia).
  • Checkpoint selected on the mean token F1 over the dev sets of every source, plus GermEval 2014 dev and a lower-cased copy of the multilingual dev sets.
  • This checkpoint is training seed 20261028, the first of three seeds trained with this recipe. On the suites above the two others score from 2.6 points lower (MASSIVE) to 1.6 points higher (TAB); the decision to use this recipe was taken on the mean of the three seeds.
DataTextLanguagesLicense
nvidia/Nemotron-PIIsynthetic documentsenCC BY 4.0
ai4privacy/pii-masking-openpii-1msynthetic textde, en, es, fr, it, nl, ptCC BY 4.0
gretelai/gretel-pii-masking-en-v1synthetic documentsenApache 2.0
gretelai/synthetic_pii_finance_multilingualsynthetic financial documentsde, en, es, fr, it, nlApache 2.0
MAPA (joelniklaus/mapa)EU legal text21 EU languagesCC BY 4.0
MultiCoNER v2Wikipedia sentences, lower casede, en, es, fr, it, pt, sv, ukCC BY 4.0
NewsEye (HIPE-2022 subset)historical newspapersde, fi, fr, svCC BY 4.0
Europeana Newspapers NERhistorical newspapersde, fr, nlCC0
LeNER-Brcourt decisionsptMIT
SmartDatanews, tweetsdeCC BY 4.0
MEDDOCANclinical casesesCC BY 4.0
NERDEcompetition law documentsptCC BY 4.0
SEIuniversity administrative actsptCC BY 4.0
InLegalNERIndian court judgmentsenMIT
Broad Twitter CorpustweetsenCC BY 4.0
WNUT-17social mediaenCC BY 4.0

Revisions and attributions are in NOTICE. None of these licenses restricts commercial use; the CC BY 4.0 ones require the attribution given there.

Limitations

  • Short voice or chat requests that name a person without context ("call maria", "how old is tom cruise"), especially without capitals: GLiNER PII finds 1 to 5 more names in 100 there.
  • Long legal judgments (TAB): NVIDIA GLiNER-PII masks more persons.
  • Persons, contacts and identifiers were evaluated most; dates and demographics follow the training data and were not tested on unseen data. Secrets were tested on unseen code (see Secrets in code): the model alone masks 22% of real credentials.
  • Names are often tagged word by word (first name and last name as two spans); mask both, or merge adjacent spans of the same type.
  • Do not rely on it as the only safeguard for sensitive data: review what it masks, and combine it with rules for structured identifiers where needed.

License

BSD 3-Clause (see LICENSE). The base model is MIT (Microsoft) and the training data licenses are listed in NOTICE.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · token-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForTokenClassification
Ревизия весов
e5f6a01

0 моделей