PII 30M Core ML (Neural Engine) v1.0
PII 30M MLX 4-bit v1.0 as a Core ML program for the Apple Neural Engine: the same four-layer BERT token classifier, labels O, B-PII and I-PII, for local detection of personally identifiable information.
Model details
- Source: the MLX release at revision
511419bc3efa3527bf695d9bdde2e0f48607999b, written directly in Core ML's MIL with coremltools 9. - Weights: the embedding tables keep the release's 4-bit weights exactly (blockwise, 64-element blocks, its scales and offsets). The linear layers are the release's weights dequantized to float16, because the Neural Engine runs only per-channel weights. Activations are float16.
- Size: about 33 MB.
- Requires: macOS 15 or iOS 18 (ML program, Core ML 8).
- Runs on: the Neural Engine with
cpuAndNeuralEngine, except the embedding lookups, which run on the CPU.
Inputs and output
Every input has a fixed shape: four rows of 512 tokens. A row may hold several windows of several texts one after another; a window doesn't cross rows.
| Name | Shape | Type | Meaning |
|---|---|---|---|
ids |
4 ร 512 | int32 | WordPiece token ids (the MLX release's tokenizer.json), each window [CLS] โฆ [SEP]; padding [PAD] (0) |
positions |
4 ร 512 | int32 | each token's position in its own window, from 0 |
segments |
4 ร 512 | int32 | each token's window, any number unique in its row; a token attends only to the tokens of its segment |
logits (output) |
4 ร 512 ร 3 | float32 | each token's scores for O, B-PII, I-PII |
Tokenize with the MLX release's tokenizer: windows of 512 tokens that share 64 tokens with the window before. Decode spans as its runtime does (BIO3, first label of each token across windows).
Evaluation
Against the MLX release's runtime (float32):
- 15 varied texts (CJK, accented and combining characters, control and space characters, emoji, JSON, HTML, a word too long for WordPiece, a text of three windows): the same spans on every text.
- A 300,000-token corpus of 3,000 log lines, chat turns and JSON strings: the same spans on 2,953 texts; 0.041% of the characters the release marks are missed and 85 characters are marked that it doesn't, from float16 arithmetic. The earlier 8-bit build missed 0.226%.
- Speed: about 13 ms per call of four 512-token rows on an M5 Max's Neural Engine; the corpus takes 2.1 s.
Conversion
Engines/pii/convert-coreml.py in Underdog's inference repository builds it from the MLX release.
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. The same terms as the MLX release.
Upstream components keep their original licenses (see LICENSE-APACHE).
- Downloads last month
- 26
Model tree for LoyalAI/pii-30M-coreml-ane-v1.0
Base model
LoyalAI/pii-30M-mlx-4bit-v1.0