Skip to content

Commit 5f5971e

Browse files
Blaizzyclaude
andcommitted
Document openai/privacy-filter in README
Add the model to the supported architectures list and a Token Classification (PII detection) usage section with a working example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ef04c68 commit 5f5971e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ MLX-Embeddings supports a variety of model architectures for text embedding task
2121
- Qwen3-VL (multimodal Qwen3-VL embedding and reranking model)
2222
- Llama Bidirectional (Llama-based bidirectional embedding models, e.g. NVIDIA NV-Embed)
2323
- Llama Nemotron VL (multimodal vision-language embedding model with SigLIP vision + bidirectional Llama)
24+
- OpenAI Privacy Filter (bidirectional GPT-OSS variant for PII token classification with sparse MoE, GQA + attention sinks, and YARN RoPE)
2425

2526
We're continuously working to expand our support for additional model architectures. Check our GitHub repository or documentation for the most up-to-date list of supported models and their specific versions.
2627

@@ -177,6 +178,30 @@ for idx, logit in enumerate(predictions.tolist()):
177178
print(f"{label}: {logit:.3f}")
178179
```
179180

181+
#### Token Classification (PII detection)
182+
183+
`openai/privacy-filter` is a bidirectional 1.5B-parameter / 50M-active sparse-MoE token classifier that tags personally identifiable information (PII) with BIOES spans over 8 categories (person, email, phone, URL, address, date, account number, secret).
184+
185+
```python
186+
import mlx.core as mx
187+
from mlx_embeddings.utils import load
188+
189+
model, tokenizer = load("openai/privacy-filter")
190+
id2label = model.config.id2label
191+
192+
text = "My name is Alice Smith and my email is alice@example.com. Phone: 555-1234."
193+
inputs = tokenizer(text, return_tensors="mlx")
194+
195+
outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
196+
preds = mx.argmax(outputs.logits, axis=-1)[0].tolist()
197+
198+
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0].tolist())
199+
for token, pred in zip(tokens, preds):
200+
label = id2label[str(pred)]
201+
if label != "O":
202+
print(f"{token!r:20s} -> {label}")
203+
```
204+
180205
### Batch Processing
181206

182207
#### Multiple Texts Comparison

0 commit comments

Comments
 (0)