How to use from the
Use from the
MLX library
# Download the model from the Hub
pip install huggingface_hub[hf_xet]

huggingface-cli download --local-dir privacy-filter-mlx kokluch/privacy-filter-mlx

privacy-filter-mlx (int4)

MLX-converted, int4-quantized weights of openai/privacy-filter, packaged for use with PrivacyFilterKit โ€” a Swift package that runs on-device PII detection on Apple platforms via MLX-Swift.

Bundle contents

File Purpose
weights.safetensors int4 affine-quantized weights (group_size=64). Embedding + classifier head kept full-precision.
tokenizer.json Hugging Face tokenizer (copied verbatim from upstream).
tokenizer_config.json Tokenizer config.
id2label.json 33-label BIOES table (8 entity types: account_number, private_address, private_date, private_email, private_person, private_phone, private_url, secret).
model_config.json Architecture parameters consumed by the Swift runtime.
MANIFEST.json SHA-256 hashes of every file in the bundle.

Architecture

  • 8 transformer layers, hidden size 640, 14 attention heads (2 KV heads, GQA)
  • 128 local experts, top-4 MoE routing
  • 200 064 vocab, 131 072 max position embeddings, sliding-window attention (128)
  • 33-label BIOES head; the Swift decoder derives a BIOES validity mask at runtime (no learned CRF transition matrix in the upstream checkpoint)

Usage (Swift)

import PrivacyFilterKit

let bundle = URL(fileURLWithPath: "/path/to/privacy-filter-int4-v0.1.0")
let filter = try await PrivacyFilter(source: .directory(bundle))
let entities = try await filter.detect(in: "Email me at jane@example.com")

See the PrivacyFilterKit README for the full API.

Conversion pipeline

The conversion was produced by the scripts in privacy-filter-swift/scripts/:

  1. 01_download_hf.py โ€” download the upstream checkpoint
  2. 02_export_config.py โ€” extract label table, tokenizer, normalized model config
  3. 03_convert_mlx.py โ€” rename keys, downcast to bf16, write MLX-friendly safetensors
  4. 04_quantize_mlx.py โ€” int4 affine quantization (embedding + classifier head full-precision)
  5. 06_export_bundle.py โ€” assemble bundle + MANIFEST + tar.gz archive

License

Apache 2.0, inherited from the upstream model. See LICENSE.

Modifications from upstream

This bundle is a derivative of openai/privacy-filter. Significant changes:

  • Weights converted from PyTorch safetensors to MLX-format safetensors (key rename + bf16 cast).
  • int4 affine-quantized (group_size=64). Embedding, classifier head, and any transition matrix are kept full-precision.
  • Bundle adds model_config.json, id2label.json, and MANIFEST.json for the Swift runtime; no model logic is changed.

Credits

Downloads last month

-

Downloads are not tracked for this model. How to track
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for kokluch/privacy-filter-mlx

Finetuned
(30)
this model