ritual-pii-redactor
Short finetune of [praveen-ritual/pii-redactor]
(revision 31e8958581e837a3de46d40ae10f403fff451ad7).
Same 15 BIO labels and the same classification head.
No labels were added or renamed.
The finetune teaches the model to mark wallet mnemonics, hex private keys,
keystore ciphertext, credentialed RPC URLs, payment keys, and bearer tokens as SECRET,
and to mark personal data inside executor-style HTTP and LLM bodies.
Wallet addresses, transaction hashes, block hashes, chain IDs, gas, fees,
token symbols, precompiles, and public URLs without credentials stay unlabeled
and must pass through unchanged.
The published checkpoint continues from a first finetune at learning rate 1e-5
(configs/ritual_a.toml). That run's secret and personal recall cleared the gates,
and general micro F1 rose, but 96 of 3656 public chain spans were still redacted.
This second run uses learning rate 5e-06, epochs 1,
O label weight 1.0,
replay documents 30000 from the parent training split,
ritual documents 4000,
and 8000 extra documents that put chain ids, hashes, and addresses beside real PII.
Seed 20261119.
The published weights are snapped onto a group-2 INT8 grid so the ONNX graph matches them.
ONNX is opset 17 weight-only INT8 with inputs input_ids and attention_mask and output logits.
Comparison against pii-redactor
Both columns are measured on the same documents.
| check | pii-redactor | ritual-pii-redactor |
|---|---|---|
| ritual eval SECRET recall | 0.0145 | 0.7397 |
| ritual eval personal recall (PERSON, CONTACT, ADDRESS, NETWORK_ID) | 0.8118 | 0.9963 |
| ritual eval all-PII recall | 0.4695 | 0.8860 |
| ritual eval micro F1 | 0.4485 | 0.8497 |
| untouched general-PII micro F1 | 0.9191 | 0.9328 |
| general-PII micro F1 drop | -0.0136 | |
| public chain fields that failed to pass through | 0 |
SECRET parent tp 12 / support 826 recall 0.0145. Candidate tp 611 / support 826 recall 0.7397. Personal parent tp 884 / support 1089 recall 0.8118. Candidate tp 1085 / support 1089 recall 0.9963. All-PII parent tp 902 fp 1199 fn 1019. All-PII candidate tp 1702 fp 383 fn 219. General parent tp 780929 fp 98634 fn 38775. General candidate tp 775710 fp 67811 fn 43994.
Per held-out file:
| file | parent micro F1 | candidate micro F1 | docs |
|---|---|---|---|
| eval_gretel_en.jsonl | 0.9121 | 0.9155 | 5000 |
| eval_gretel_finance.jsonl | 0.7443 | 0.7898 | 5295 |
| eval_nemotron.jsonl | 0.9293 | 0.9414 | 100000 |
| eval_openpii.jsonl | 0.8920 | 0.8977 | 4000 |
Gates
- all_pii_recall: pass
- general_f1_drop_at_most_0_01: pass
- pass_through: pass
- personal_recall: pass
- secret_recall: pass
Public spans checked: 3656. Pass-through failures: 0.
INT8 vs PyTorch HTTP span mismatches: 0 of 400. ORT dynamic per-channel QInt8 mismatches on the same HTTP set: 46 of 400.
Commands
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 --parent-revision 31e8958581e837a3de46d40ae10f403fff451ad7 --candidate exports/ritual-pii-redactor --ritual-eval data/prepared/ritual/ritual_b/eval.jsonl
Limitations
The extra documents are generated from public payload shapes. They are not live traffic. Replay rows are drawn from the parent training split. The parent validation and test splits were not used for this finetune. Chain addresses and hashes are treated as non-PII only in the generated shapes the gate checks. Snapping onto the INT8 grid can move a low-margin boundary. The gate numbers are for the published snapped weights.