monju-mask-ja-01
lightweight CPU model for detecting and masking Japanese PII
2 min readupdated
This compact ONNX-based model detects and redacts personally identifiable information (PII) and credentials in Japanese text. Running locally on the CPU, it combines three lightweight experts: a bidirectional GRU, dilated convolutions, and a small Transformer. It lets you quickly and safely scrub sensitive data right on your device before sending text to cloud AI services. Released with open weights under the CC BY-SA 4.0 license, the entire model weighs just 234 MB.
Key features
- Fast CPU inference: processing roughly 900 characters takes between 16.8 and 40.7 milliseconds, depending on the thread count.
- Three-expert ensemble: three distinct architectures analyze the text in parallel, averaging their output probabilities to boost accuracy.
- Complete privacy: runs locally via ONNX Runtime without relying on third-party cloud APIs.
- Eight redaction categories: recognizes names, addresses, email addresses, phone numbers, dates, IDs, URLs, and credentials.
What you can do
- Embed in a CLI tool: run it through the Toramon Mask utility to filter text files and data streams.
- Secure a local API: set up a local gateway to automatically strip personal data before forwarding prompts to LLMs.
- Integrate into Python apps: connect via onnxruntime adapters to sanitize user input in real time.
Example
from toramon.adapters.monju_onnx import load_monju
from toramon.filter import ToramonFilter
filt = ToramonFilter(load_monju("models/monju-mask-ja-01", threads=4), "monju-mask-ja-01")
print(filt.redact("山田太郎様の電話は090-1234-5678です。").redacted_text)
# → [PERSON_1]様の電話は[PHONE_1]です。Read more
DetailsBenchmarks: achieves a strict F1 score of 0.943 on Monju PII Bench.
Requirements: no GPU needed; requires numpy, onnxruntime, and tiktoken.
Limitations: does not guarantee 100% anonymization; false positives may occur on unfamiliar text types.










Comments