This repository contains an 8-bit OpenMed MLX artifact for openai/privacy-filter, packaged for local PII detection on Apple Silicon with OpenMed.
OpenAI Privacy Filter is a bidirectional token-classification model for detecting personally identifiable information in text. This OpenMed MLX build keeps the original BIOES token-label head, uses the o200k_base tokenizer assets, and runs with OpenMed's Python and Swift MLX runtimes.
After the model is downloaded once, inference runs locally. No document text is sent to a server.
This artifact uses expert-aware MLX quantization: embeddings, attention projections, MoE gates, sparse-MoE expert tensors, and the token-classification head are all stored in 8-bit packed form. The resulting weights.safetensors file is about 1.39 GiB, compared with about 2.61 GiB for the BF16 OpenMed MLX artifact.
Quick Start: Python
pip install -U openmed "openmed[mlx]"
python
1from huggingface_hub import snapshot_download
2from openmed.mlx.inference import create_mlx_pipeline
34model_path = snapshot_download("OpenMed/privacy-filter-mlx-8bit")5pipe = create_mlx_pipeline(model_path)67text ="My name is Alice Smith and my email is alice.smith@example.com."8entities = pipe(text)910for entity in entities:11print(entity)
Open Xcode and choose File > Add Package Dependencies.
Paste https://github.com/maziyarpanahi/openmed.
Select the OpenMedKit package product.
Download and cache the MLX model once, then run inference locally.
swift
1importOpenMedKit23let modelURL =tryawaitOpenMedModelStore.downloadMLXModel(4 repoID:"OpenMed/privacy-filter-mlx-8bit"5)67let openmed =tryOpenMed(backend:.mlx(modelDirectoryURL: modelURL))8let entities =try openmed.extractPII(9"My name is Alice Smith and my email is alice.smith@example.com."10)1112for entity in entities {13print(entity.text, entity.label, entity.score)14}
For iOS, run on Apple Silicon hardware. The iOS Simulator is not the recommended acceptance target for MLX inference.
Validation
The 8-bit artifact was validated against the unquantized OpenMed MLX artifact with fixed text samples. BF16 and Q8 returned identical grouped spans for person, date, phone, email, address, and account-number examples.
OpenMed also includes unit tests for:
q8 artifact loading
quantization metadata decoding
expert tensor packing and .scales coverage
finite logits from the q8 runtime
bf16/q8 shape and argmax-label coherence
BIOES/Viterbi span decoding
Intended Use
Use this model for local privacy filtering, PII detection, redaction workflows, and evaluation on Apple devices. For high-risk domains such as healthcare, legal, finance, education, and government, evaluate against your own data and policy requirements before production use.