MLX 8-bit (this repo) — Apple Silicon, ~1.4 GB, ~1.7× faster than BF16.
Why 8-bit?
BF16 sibling
This repo (Q8)
weights.safetensors size
2.6 GB
1.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
Demographic — race_ethnicity, religious_belief, political_view, sexuality, language
Vehicles — license_plate, vehicle_identifier
Time — date, date_time, time
Misc — biometric_identifier, unique_id
Full label schema (221 labels)
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.
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
File
Size
Purpose
weights.safetensors
1.4 GB
Q8 packed weights + scales/biases (uint32 packed for quantized modules, BF16 for norms/sinks)
config.json
20 KB
Model + MLX runtime config (with _mlx_quantization block)
The MLX runtime uses tiktokeno200k_base directly for tokenization;
the tokenizer.json is kept so consumers can inspect or re-tokenize via
transformers if desired.
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)
python
1from huggingface_hub import snapshot_download
2from openmed.mlx.inference import PrivacyFilterMLXPipeline
34model_path = snapshot_download("OpenMed/privacy-filter-nemotron-mlx-8bit")5pipe = PrivacyFilterMLXPipeline(model_path)67print(pipe("Email me at alice.smith@example.com after 5pm."))8# [{'entity_group': 'email',9# 'score': 0.92,10# 'word': 'alice.smith@example.com',11# 'start': 12,12# 'end': 35}]
The pipeline returns a list of dicts with entity_group, score, word,
start, and end (character offsets into the input string).
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.