Instructions to use LoyalAI/pii-30M-mlx-4bit-v1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use LoyalAI/pii-30M-mlx-4bit-v1.0 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download LoyalAI/pii-30M-mlx-4bit-v1.0 --local-dir pii-30M-mlx-4bit-v1.0
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
PII 30M MLX 4-bit v1.0
A compact, fine-tuned model for local detection and redaction of personally identifiable information (PII), packaged for Apple Silicon with MLX.
Designed for browser observations, form content, documents, and application text. The model is English-focused, with additional multilingual training. Applications can use the detected spans to decide which information to retain, replace, or handle locally.
Model details
- Parameters: 28,502,531 (approximately 28.5 million, in the 30M class).
- Quantization: affine 4-bit, group size 64, for eligible weight matrices. Other tensors and activations remain float32.
- Weight file size: approximately 17.9 MB; complete download approximately 19 MB.
- Architecture: a four-layer BERT token classifier with a 512-token context window. The included runtime handles longer text with overlapping windows.
- Input: text, including plain text, JSON, HTML, XML, and browser tool output.
- Output: PII spans with character offsets, or redacted text. Internal labels are
O,B-PII, andI-PII.
Fine-tuned and converted to MLX by ConwayResearch. The merged weights, tokenizer, and Python inference runtime are included.
Usage
On an Apple Silicon Mac with Python 3.10 or later, download the repository and install its dependencies:
python -m pip install huggingface-hub
hf download ConwayResearch/pii-30M-mlx-4bit-v1.0 --local-dir pii-model
cd pii-model
python -m pip install -r requirements.txt
python pii.py --text "Contact Alice Smith at alice@example.com."
Use the Python API to keep the model loaded across requests:
from pii import PIIDetector
model = PIIDetector()
text = "Contact Alice Smith at alice@example.com."
print(model.detect(text))
print(model.redact(text))
detect() returns start, end, and label for each span. Offsets use Unicode characters, with an exclusive end: text[start:end]. redact() replaces detected spans with [PII] by default. Inference uses the included MLX runtime and runs locally after download.
License
CC BY-NC 4.0 (see LICENSE). You can use, share and adapt it for non-commercial purposes with credit to Underdog. Commercial use needs a separate license: write to license@conway.tech.
Upstream components keep their original licenses (see LICENSE-APACHE).
- Downloads last month
- 112
Quantized