Downloads · 30 days
50
29% of all-time downloads
OpenMed/privacy-filter-multilingual-v2-mlx-8bit
privacy-filter-multilingual-v2-mlx-8bit is a token classification model from OpenMed. Use it when you need labels on individual words, such as names. It is set up for openmed. The card lists the license as apache-2.0.
A native MLX port of OpenMed/privacy-filter-multilingual-v2, affine-quantized to 8-bit for faster and smaller Apple Silicon PII detection with OpenMed. For the unquantized BF16 reference, see OpenMed/privacy-filter-mu…
Downloads · 30 days
50
29% of all-time downloads
All-time downloads
174
Public
Repo size
1.5 GB
Likes
2
Public
Click a slice to open those files.
.safetensors1.5 GB · 98%
From the Hugging Face model README
A native MLX port of OpenMed/privacy-filter-multilingual-v2, affine-quantized to 8-bit for faster and smaller Apple Silicon PII detection with OpenMed. For the unquantized BF16 reference, see OpenMed/privacy-filter-multilingual-v2-mlx.
Family at a glance:
- PyTorch source:
OpenMed/privacy-filter-multilingual-v2- MLX BF16:
OpenMed/privacy-filter-multilingual-v2-mlx- Apple Silicon,2.6 GiBweights- MLX 8-bit (this repo): Apple Silicon,
1.4 GiBweights, ~1.8x faster than BF16 in the local golden-sample run
| BF16 sibling | This repo (Q8) | |
|---|---|---|
weights.safetensors size | 2.6 GiB | 1.4 GiB |
| Average forward pass | 15.1 ms | 8.4 ms (~1.8x faster) |
| Average argmax agreement vs. BF16 | reference | 100.00% |
| Entity-span preservation | reference | identical on all 10 golden samples |
Validation used 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).
| Field | Value |
|---|---|
| Bits | 8 |
| Group size | 64 |
| Mode | affine MLX weight-only quantization |
| Quantized modules | embedding, attention projections, MoE router/expert matrices, output head |
| Kept in BF16 | RMSNorm scales and attention sinks |
This model is an MLX packaging of OpenMed/privacy-filter-multilingual-v2, the second-generation multilingual checkpoint for fine-grained PII extraction across 16 languages. It uses OpenAI's Privacy Filter architecture and predicts 217 BIOES classes (O plus B/I/E/S for each category). The OpenMed PrivacyFilterMLXPipeline runs BIOES-aware Viterbi decoding so callers receive grouped spans instead of raw token tags.
Label coverage highlights:
The full label map is included in id2label.json.
| Field | Value |
|---|---|
| Source model type | openai_privacy_filter |
| Source architecture | OpenAIPrivacyFilterForTokenClassification |
| Hidden size | 640 |
| Transformer layers | 8 |
| Attention | Grouped-query attention (14 query heads / 2 KV heads, head_dim=64) with attention sinks |
| FFN | Sparse Mixture-of-Experts - 128 experts, top-4 routing, SwiGLU |
| Position encoding | YARN-scaled RoPE (rope_theta=150000, factor=32) |
| Context length | 131,072 tokens (initial 4,096) |
| Tokenizer | o200k_base / tiktoken-compatible tokenizer assets, vocab 200,064 |
| Output head | Linear(640 -> 217) with bias |
| File | Size | Purpose |
|---|---|---|
weights.safetensors | 1.4 GiB | MLX weights |
config.json | 17.7 KiB | Model and OpenMed MLX runtime config |
id2label.json | 4.8 KiB | Numeric ID to BIOES label mapping |
openmed-mlx.json | 0.8 KiB | OpenMed MLX artifact manifest |
tokenizer.json | 27 MiB | Tokenizer asset kept with the artifact |
tokenizer_config.json | 0.2 KiB | Tokenizer metadata |
The MLX runtime uses the tiktoken-compatible o200k_base tokenizer path. tokenizer.json and tokenizer_config.json are bundled so consumers can inspect the tokenizer assets and keep the artifact self-contained.
pip install -U "openmed[mlx]"
from openmed import extract_pii, deidentify
from openmed.core import OpenMedConfig
model_name = "OpenMed/privacy-filter-multilingual-v2-mlx-8bit"
text = (
"Patient Sarah Johnson (DOB 03/15/1985), MRN 4872910, "
"phone 415-555-0123, email [email protected]."
)
result = extract_pii(
text,
model_name=model_name,
config=OpenMedConfig(backend="mlx"),
)
for ent in result.entities:
print(ent.label, ent.text, round(ent.confidence, 4))
masked = deidentify(
text,
method="mask",
model_name=model_name,
config=OpenMedConfig(backend="mlx"),
)
print(masked.deidentified_text)
For non-MLX hosts, use the source PyTorch checkpoint OpenMed/privacy-filter-multilingual-v2.
from huggingface_hub import snapshot_download
from openmed.mlx.inference import PrivacyFilterMLXPipeline
model_path = snapshot_download("OpenMed/privacy-filter-multilingual-v2-mlx-8bit")
pipe = PrivacyFilterMLXPipeline(model_path)
print(pipe("Email me at [email protected] after 5pm."))
from openmed.mlx.models import load_model
import mlx.core as mx
model = load_model("/path/to/privacy-filter-multilingual-v2-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)
print(logits.shape)
pip install -U "openmed[mlx]".This artifact builds on:
OpenMed/privacy-filter-multilingual-v2 by OpenMedopenai/privacy-filter and OpenAI's opf training/evaluation toolingApache 2.0, matching the source checkpoint metadata.