ritual-pii-redactor
fine-tuned model for detecting and hiding personal data and secrets
2 min readupdated
The ritual-pii-redactor model is built on praveen-ritual/pii-redactor and specializes in detecting personally identifiable information (PII) in texts, logs, and HTTP request bodies. This new fine-tune trained the model to reliably find cryptocurrency mnemonics, private keys, authorization tokens, and credentials while leaving public addresses and blockchain hashes unchanged. The model weights are quantized to INT8 and exported to the ONNX format for quick integration into data processing pipelines. This model will be useful for developers and security engineers looking to automatically filter confidential information before sending it to LLMs.
Key features
- Specialization in crypto secrets: precise identification of seed phrases, private keys, RPC links, and tokens.
- Accuracy boost: secret search recall increased from a baseline of 1.4% to 73.9%, and the overall micro F1 metric increased to 84.9%.
- Preservation of public data: wallet addresses and transaction hashes are not masked and pass through unchanged.
- Ready-to-use INT8 ONNX: weights are optimized and quantized to INT8 grid for efficient inference via ONNX Runtime.
What you can do
- Filtering LLM requests: integrate the model into a proxy server to clean text of personal data and secrets before calling language models.
- Log protection: set up automatic scanning of backend logs and HTTP bodies for accidentally leaked private keys.
- Dataset analysis: use the model for batch markup and masking of confidential information in text corpora.
Example
Example commands for preparing, training, ONNX exporting, and testing the model via the console:
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
uv run prepare-ritual --config configs/ritual_b.toml
uv run train --config configs/ritual_b.toml
uv run export-onnx --model runs/ritual_b/model --output exports/ritual-pii-redactor --group-size 2
uv run gate --parent praveen-ritual/pii-redactor --candidate exports/ritual-pii-redactor --ritual-eval data/prepared/ritual/ritual_b/eval.jsonlRead more
DetailsMetrics: secret recall 0.7397 (baseline 0.0145), personal data recall 0.9963, micro F1 0.8497.
Training: LR 5e-06, 1 epoch, 30,000 replay documents and 4,000 specific documents.
Format: ONNX opset 17 weight-only INT8 with
input_ids and attention_mask inputs.Limitations: additional documents were generated using public templates rather than real live traffic.










Comments