Espejo: A compact ONNX personal data detector
2 min readupdated
The Espejo model is designed to find confidential information (such as names, phone numbers, emails, and secrets) in text and source code in English, Chinese, and code. It is based on the lightweight multilingual-e5-small architecture (around 39 million parameters) and exported into a single INT8 ONNX file of 37.8 MB. The model's key feature is its high-recall operation mode, which helps discover the maximum amount of hidden data. The tool comes in handy for developers and cybersecurity specialists looking to locally filter logs and text.
Key features
- High accuracy: The macro-F1 score reaches 0.920 on specialized benchmarks.
- CPU operation: Running it only requires
onnxruntime,tokenizers, andnumpywithout heavy libraries. - Low leakage: Minimal percentage of undetected confidential entities among small-sized alternatives.
- Compactness: The model weighs under 40 MB and runs without a graphics card or Docker.
What you can do
- Text filtering: Integrate the detector into user message and document processing pipelines.
- Code scanning: Search for accidentally left keys, tokens, and secrets in repositories.
- Local execution: Process data directly on an Apple M3 processor or a standard CPU at a speed of about 6 ms per short request.
Example
pip install -r requirements.txt # onnxruntime, tokenizers, numpy
hf download zhangyvjing/espejo-redact-v3-12l-int8 --local-dir espejo
cd espejo
python espejo.py -t "Contact: 沈文博, phone 13910284476, email shenwb@example-corp.com"Read more
DetailsMacro F1: 0.920 across 10 sensitive evaluation sets.
System requirements: standard CPU, ~0.8 s cold start, 6 ms per inference.
Limitations: produces more false positives on legal tables, license not yet finalized.










Comments