newmean-pii-small

A small multilingual model that finds personal information (PII) in text so it can be masked in the browser, before the text leaves the device. It is the small tier (9.6M parameters, 7.1 MB download) of the models behind the JavaScript SDK @newmean-ai/pii. Other tiers: newmean-pii-large, newmean-pii-medium, newmean-pii-nano.

  • 54 languages, 11 labels at the character level: PERSON, EMAIL, PHONE, ADDRESS, ID_NUMBER, FINANCIAL, ORG, USERNAME, URL, DATE_OF_BIRTH, SECRET; persons and URLs carry a level (1 = directly identifying, 2 = indirect). IP addresses are covered only by the SDK's optional pattern layer (off by default).
  • Built for real input: forms, chats, spreadsheet cells, logs, JSON, OCR text, e-mails, speech transcripts.
  • Apache-2.0, free for any use including commercial use; ONNX with 4-bit weights; runs in WebAssembly (onnxruntime-web or the SDK's own built-in engine).

Use

Try it in your browser first: pii.newmean.ai.

npm install @newmean-ai/pii
import { createRedactor } from "@newmean-ai/pii";

const redactor = await createRedactor({ size: "small" });   // downloads this repository's files once, checks their SHA-256
const { text, spans } = await redactor.redact("Hi, I'm Kim Minji, call me at 010-2345-6789.");

The SDK pins revision v1.0.0 of this repository. The files can also be used directly with onnxruntime: the model takes input_ids and attention_mask (windows of 256 tokens, stride 64) and returns BIO logits for the tags in config.json.

file
onnx/model_q4e.onnx 6.2 MB, 4-bit weights and 4-bit embeddings
onnx/model_q4.onnx 7.1 MB, 4-bit weights (SDK default)
tokenizer.web.json compact Unigram tokenizer for the browser
tokenizer.json, tokenizer_config.json the same tokenizer for Hugging Face tokenizers
config.json tags, window settings, architecture

Results

Model only (no pattern layer), default file, scored on a Colab L4 VM. Miss = share of PII characters left unmasked (lower is better; what matters most for masking); over = share of non-PII characters masked.

set miss % / over %
newmean-pii-dataset (public test) (54 languages, 17,058 rows) 2.7 / 1.2 (exact F1 0.68)
KDPII (Korean) 9.5 / 3.2
OpenPII 1.5M (30 languages) 5.6 / 5.5
Nemotron-PII (English) 10.6 / 1.0
Gretel finance (7 languages) 24.1 / 5.7

Speed on the VM's CPU (Xeon 2.20 GHz, onnxruntime): 59 ms per text with one thread, 16 ms with 12 threads, on the public test's texts. The public test of newmean-pii-dataset is generated with the same design and guideline as the training data, so these models have an in-distribution advantage there; the external sets were never used for training. On the public test the closest of the eight public detectors we compared (gliner-pii-edge, 176 MB) misses 19.6%; the leaderboard scores them weekly on its public and private test. The full comparison, per-label and per-language results are in the technical report.

Model

4 layers, embeddings rank 64; 9.6M parameters. All four tiers start from mMiniLMv2-L6-H384 with the XLM-R vocabulary pruned to the 35,298 pieces that occur in the training data, and are distilled from two larger private teacher models (mDeBERTa-v3-base and XLM-R-large, fine-tuned for this task). Training data: about 1.07 million synthetic texts in 54 languages generated with Claude models from a written labelling guideline; no real personal data and no external dataset was used for training.

Limitations

  • No detector finds everything: use the result to reduce what is sent, not as a guarantee of anonymity.
  • Trained on synthetic text; rare formats, very long documents and languages outside the 54 may be weaker.
  • Context decides some labels (an organisation is masked only when a person belongs to it; dates only when they are birth dates), so results depend on the surrounding text. sensitivity in the SDK trades misses for over-masking.

License and attribution

Apache-2.0 (LICENSE), like the SDK. If you use the model in a product, we would appreciate a "Powered by newmean.ai" mention in your docs or an about or licenses screen, and "Based on newmean-pii-small" in the card of a model you derive from it (requests, not license conditions).

Built on mMiniLMv2 (Microsoft, MIT License) and the XLM-R SentencePiece tokenizer (Facebook AI, MIT License); see NOTICE. Made by newmean.ai โ€” questions and commercial inquiries: hoonjae@newmean.ai.

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

Space using newmean-ai/pii-small 1