加载中…
加载中…
A small Indonesian PII detector: 11.1M parameters, 11.7 MB as quantized ONNX, small enough to run in a browser tab. It is distilled from ner-roberta-large-bahasa-indonesia-finetuned, which is 2,235 MB, so this is roughly 191 times smaller and about 4 times faster on CPU.
Entity types: PER, LOC, DATE_TIME, EMAIL, PHONE, GENDER, SSN (Indonesian NIK).
The teacher is XLM-R large. Nearly half its parameters are a 250k piece vocabulary covering 100
languages, which is wasted on a single language task, and its label set has no I- tag for
EMAIL, PHONE, SSN or GENDER, so it fragments identifiers across tokens. This student
fixes both: an Indonesian only vocabulary, and a complete BIO inventory with B- and I- for
all seven types.
Measured on 1,626 held out sentences labelled by the teacher, so these numbers describe how closely the student reproduces the teacher rather than performance on an independent benchmark.
| F1 | ms/doc CPU | Size | |
|---|---|---|---|
| Teacher, original | 0.9098 | 48.8 | 2,235 MB |
| Teacher, trimmed and INT8 | 0.8883 | 18.6 | 337 MB |
| This model, INT8 ONNX | 0.9049 | 12.1 | 11.7 MB |
Per type F1 for the INT8 build:
| Type | F1 | Held out spans |
|---|---|---|
| PHONE | 0.9966 | 447 |
| SSN | 0.9963 | 273 |
| 0.9933 | 448 | |
| PER | 0.9103 | 1824 |
| LOC | 0.8605 | 1015 |
| GENDER | 0.8217 | 67 |
| DATE_TIME | 0.8056 | 646 |
from transformers import pipeline
ner = pipeline("token-classification", model="0xcynyx/ner-pii-indonesian-mini",
aggregation_strategy="simple")
ner("Nama saya Budi, NIK 3204 0125 0990 0001, HP 081234567890.")
In the browser with transformers.js, the quantized ONNX build is used automatically:
import { pipeline } from "@huggingface/transformers";
const ner = await pipeline("token-classification", "0xcynyx/ner-pii-indonesian-mini");
const out = await ner("Silakan hubungi Siti di siti.rahma@contoh.co.id");
Because it runs client side, text never leaves the user's device, which matters more for PII than for most tasks.
GENDER and DATE_TIME are the weak types. GENDER had only 1,280 training examples,
and DATE_TIME covers many surface forms.Character span annotations from the teacher, with production post processing applied before they became labels, so the student learns corrected boundaries rather than the teacher's fragments. One epoch, batch 16, lr 5e-5, max length 160, on an Apple M4 GPU.
Pipeline and scripts: ner-app-gradio/tools/compress.
MIT.