/ Модель

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

Контекст
131 072 токена
Параметры
145 млн
Размер весов
1,5 ГБ
Лицензия
Apache 2.0
Архитектура
openai_privacy_filter · MoE
Базовая модель
privacy-filter-nemotron
Библиотека
openmed
Опубликована
27 апр 2026

privacy-filter-nemotron-mlx-8bit

Разметка токеновТекст → label6 профессий

Квантизированный 8-битный MLX-токен-классификатор OpenMed для поиска 55 типов персональных данных в англоязычном тексте на устройствах Apple Silicon.

1 997скачиваний за 30 дней7лайковвеса обновлены28 апр 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

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

OpenMed Privacy Filter Nemotron MLX 8-bit — квантизированная до 8 бит версия модели OpenMed для обнаружения персональных данных в тексте на устройствах Apple Silicon. Это токен-классификатор архитектуры OpenAI Privacy Filter с 145,4 млн параметров и контекстом до 131 072 токенов; он размечает токены BIOES-метками для 55 категорий персональных данных, после чего MLX-конвейер группирует их в сущности с символьными позициями и оценками. Модель предназначена для выявления и последующей маскировки или деидентификации идентификаторов, контактных, финансовых, медицинских, сетевых и других чувствительных данных.

Веса аффинно квантизированы в 8 бит с размером группы 64. README сообщает о размере весов около 1,4 ГБ и ускорении примерно в 1,7 раза относительно BF16-версии; на 10 тестовых примерах совпадение argmax с BF16 составило 100%. Модель рассчитана на MLX и Apple Silicon, включая запуск на CPU с меньшей скоростью. Карточка указывает английский язык и лицензию Apache-2.0. Проверка согласия с BF16 ограничена описанными тестовыми примерами, поэтому эти результаты не гарантируют такую же точность на произвольных данных.

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

  • поиск имён, адресов электронной почты и телефонов в тексте
  • обнаружение государственных идентификаторов и номеров банковских карт
  • выявление медицинских идентификаторов в клинических записях
  • поиск паролей, API-ключей, IP-адресов и файлов cookie
  • подготовка англоязычных текстов к маскированию и деидентификации

Ограничения

Карточка подтверждает работу на английском языке; пригодность для других языков не заявлена. Совпадение меток с BF16 проверено лишь на 10 тестовых примерах и не гарантирует одинаковые результаты на произвольных текстах.

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

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

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

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

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

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

Открыть на Hugging Face

OpenMed Privacy Filter (Nemotron) — MLX 8-bit

A native MLX port of OpenMed/privacy-filter-nemotron, affine-quantized to 8-bit for fast on-device PII detection on Apple Silicon. For the unquantized BF16 reference, see OpenMed/privacy-filter-nemotron-mlx.

Family at a glance. Same architecture and training data, three runtimes:

Why 8-bit?

BF16 siblingThis repo (Q8)
weights.safetensors size2.6 GB1.4 GB (-47%)
Forward pass (10-token PII sample)~14 ms~8 ms (~1.7× faster)
Argmax agreement vs. BF16(reference)100% on every test sample
Entity-group preservation(reference)identical on every test sample

Numbers above are from scripts/export/verify_privacy_filter_nemotron_mlx.py over 10 golden PII samples (email, phone, ssn, credit card, name, ipv4, address, date_of_birth, url, mixed). Q8 with group_size=64 was validated against BF16; argmax matched on 100% of tokens, all entity-group sets matched exactly.

What it does

The model is a token classifier built on OpenAI's open Privacy Filter architecture (the same openai_privacy_filter model type used by openai/privacy-filter). It tags each token with a BIOES label across 55 PII span classes, then a Viterbi pass over the BIOES grammar yields clean entity spans. Detected categories include:

  • Personal identifiers — first_name, last_name, user_name, gender, age, date_of_birth
  • Contact — email, phone_number, fax_number, street_address, city, state, country, county, postcode, coordinate
  • Government / legal IDs — ssn, national_id, tax_id, certificate_license_number
  • Financial — account_number, bank_routing_number, credit_debit_card, cvv, pin, swift_bic
  • Medical — medical_record_number, health_plan_beneficiary_number, blood_type
  • Workplace — company_name, occupation, employee_id, customer_id, employment_status, education_level
  • Online — url, ipv4, ipv6, mac_address, http_cookie, api_key, password, device_identifier
  • Demographic — race_ethnicity, religious_belief, political_view, sexuality, language
  • Vehicles — license_plate, vehicle_identifier
  • Time — date, date_time, time
  • Misc — biometric_identifier, unique_id

The output space is O plus B-, I-, E-, S- for each of the 55 span classes (4 × 55 + 1 = 221). The runtime PrivacyFilterMLXPipeline runs Viterbi over this BIOES grammar, so the consumer sees clean grouped entities rather than raw token tags.

The full id2label.json is shipped alongside the weights in this repo.

For per-label accuracy, training recipe, and dataset details, see the base PyTorch checkpoint.

Architecture

FieldValue
Source model typeopenai_privacy_filter
Source architectureOpenAIPrivacyFilterForTokenClassification
Hidden size640
Transformer layers8
AttentionGrouped-Query (14 query heads / 2 KV heads, head_dim=64) with attention sinks
FFNSparse Mixture-of-Experts — 128 experts, top-4 routing, SwiGLU
Position encodingYARN-scaled RoPE (rope_theta=150_000, factor=32)
Context length131,072 tokens (initial 4,096)
Tokenizero200k_base (tiktoken) — vocab 200,064
Output headLinear(640 → 221) with bias

Quantization

FieldValue
Bits8
Group size64
Modeaffine (MLX mx.quantize, weight-only)
Quantized modulesembedding, attention qkv & out, MoE gate, expert swiglu & out, unembedding
Non-quantized modulesRMSNorms, attention sinks (kept in BF16)

Expert tensors are stored in MLX's packed transposed layout and run through mx.gather_qmm at inference time. RMSNorm scales and attention sinks remain BF16 because their parameter count is negligible relative to the rest of the model.

File set

FileSizePurpose
weights.safetensors1.4 GBQ8 packed weights + scales/biases (uint32 packed for quantized modules, BF16 for norms/sinks)
config.json20 KBModel + MLX runtime config (with _mlx_quantization block)
id2label.json5.4 KBNumeric ID → BIOES label string
openmed-mlx.json0.8 KBOpenMed MLX manifest with quantization: {bits: 8, group_size: 64, mode: affine}
tokenizer.json, tokenizer_config.json27 MBSource tokenizer files (kept for reference)

The MLX runtime uses tiktoken o200k_base directly for tokenization; the tokenizer.json is kept so consumers can inspect or re-tokenize via transformers if desired.

Quick start

With OpenMed — recommended

OpenMed gives you a single extract_pii() / deidentify() API that auto-selects MLX on Apple Silicon and PyTorch elsewhere — same code on every host.

pip install -U "openmed[mlx]"
from openmed import extract_pii, deidentify

text = (
    "Patient Sarah Johnson (DOB 03/15/1985), MRN 4872910, "
    "phone 415-555-0123, email sarah.johnson@example.com."
)

# Extract grouped entity spans (runs on MLX 8-bit here, PyTorch fallback elsewhere)
result = extract_pii(text, model_name="OpenMed/privacy-filter-nemotron-mlx-8bit")
for ent in result.entities:
    print(f"{ent.label:30s} {ent.text!r}  conf={ent.confidence:.2f}")

# De-identify
masked = deidentify(text, method="mask",
                    model_name="OpenMed/privacy-filter-nemotron-mlx-8bit")
fake   = deidentify(
    text,
    method="replace",
    model_name="OpenMed/privacy-filter-nemotron-mlx-8bit",
    consistent=True,
    seed=42,   # deterministic locale-aware Faker surrogates
)

When MLX isn't available (Linux, Windows, Intel Mac, missing mlx package), this exact same call automatically falls back to the PyTorch checkpoint OpenMed/privacy-filter-nemotron with a one-time warning. Family-aware fallback: a Nemotron MLX request never substitutes the unrelated openai/privacy-filter baseline.

Direct MLX usage (lower-level)

from huggingface_hub import snapshot_download
from openmed.mlx.inference import PrivacyFilterMLXPipeline

model_path = snapshot_download("OpenMed/privacy-filter-nemotron-mlx-8bit")
pipe = PrivacyFilterMLXPipeline(model_path)

print(pipe("Email me at alice.smith@example.com after 5pm."))
# [{'entity_group': 'email',
#   'score': 0.92,
#   'word': 'alice.smith@example.com',
#   'start': 12,
#   'end': 35}]

The pipeline returns a list of dicts with entity_group, score, word, start, and end (character offsets into the input string).

Loading from a local snapshot

from openmed.mlx.models import load_model
import mlx.core as mx

model = load_model("/path/to/privacy-filter-nemotron-mlx-8bit")
ids = mx.array([[1, 100, 200, 300]], dtype=mx.int32)
mask = mx.ones((1, 4), dtype=mx.bool_)
logits = model(ids, attention_mask=mask)   # shape (1, 4, 221)

Hardware notes

  • Designed for Apple Silicon (M-series GPUs); CPU inference works but is slower.
  • Tested on macOS with mlx>=0.18.
  • Q8 inference is ~1.7× faster than the BF16 sibling on the same hardware while preserving 100% argmax agreement on the test set.

Credits & Acknowledgements

This model wouldn't exist without two open-source releases — sincere thanks to both teams:

  • OpenAI for open-sourcing the Privacy Filter (architecture, modeling code, and opf training/eval CLI). The 8-bit MLX port in this repo runs that same architecture under Apple's MLX framework with affine weight-only quantization.
  • NVIDIA for releasing the Nemotron-PII dataset used to fine-tune the source PyTorch checkpoint.

Additional thanks to Apple for MLX and the HuggingFace team for the model-distribution ecosystem.

License

Apache 2.0 (matches the source checkpoint).

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

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

GPU в ailist

Универсальный рантайм · openmed

Нельзя запустить

MLX-модели работают только на Apple Silicon.

Класс архитектуры
OpenAIPrivacyFilterForTokenClassification
Ревизия весов
32b4bb1

0 моделей