PII/PHI Gate (Qwen3.5-4B, AnyJev L2) β€” trained on Nemotron-PII

A calibrated "does this text contain PII/PHI that must be masked?" decision model. It answers in one forward pass with no text generation and returns a probability you can threshold β€” so it can sit in front of an expensive redaction / de-identification step and skip text that confidently contains nothing to mask.

It is a closed-form linear head on the hidden state of Qwen/Qwen3.5-4B, built with AnyJev. The base model is unchanged; this repo is only the head (~55 KB). Trained only on the open, fully synthetic NVIDIA Nemotron-PII dataset (CC BY 4.0).

License (this head) CC BY 4.0
Training data nvidia/Nemotron-PII only β€” fully synthetic, CC BY 4.0 (Β© NVIDIA)
Base model Qwen/Qwen3.5-4B β€” unchanged, under its own license (download it separately)
Method AnyJev L2: closed-form linear head on the hidden state, no fine-tuning
Real personal data used None

Triage, not redaction. "No" means "safe to skip at your chosen risk level", never "this text is anonymised".

Results β€” Nemotron-PII test split

4,976 held-out examples (train and test records never overlap), 50% containing PII/PHI; positives and negatives are length-matched so text length cannot give the answer away.

Target missed-PII rate Skip when P(PII) ≀ Texts skipped Share of the PII-free texts skipped
≀ 0.1% 0.0039 25.4% 51%
≀ 0.5% 0.0297 40.9% 81%
≀ 1% 0.0545 43.8% 87%
≀ 2% 0.1899 48.4% 96%

Accuracy at 0.5: 96.8–97.1% Β· expected calibration error 0.010 Β· ~65 decisions/s on one GPU.

Out-of-domain caution. These numbers are in-distribution. On document styles unlike Nemotron-PII β€” for example template-heavy EHR / XML exports β€” the head transfers much less well (far fewer texts can be skipped at the same miss rate). Measure on a labelled sample of your data and pick your threshold there before relying on it.

Training data and label mapping

  • 13,935 examples from the Nemotron-PII train split: whole records and their natural pieces (paragraphs / form sections), 50% with and 50% without PII/PHI, length-matched, deduplicated; 30 industries, structured and unstructured, US and international.
  • A text is positive if it contains at least one span of a label that must be masked. 38 of the 55 Nemotron labels count (names, date of birth, contact details, street address / city / county / postcode / coordinates, and every identifier: medical record, health plan, SSN, national / tax / customer / employee / account / card / routing numbers, licences and plates, device / biometric / vehicle IDs, IP / MAC, usernames, passwords, PINs, API keys, CVV, cookies); age counts only for 90+. Not counted: ordinary dates and times, country, state, company, occupation, education, employment status, gender, race/ethnicity, religion, language, blood type, political view, sexuality. Full mapping: label_mapping.json.
  • Head, layer and regularisation chosen by AnyJev's 5-fold cross-validation (out-of-fold accuracy 96.8%).

Usage

import json
from huggingface_hub import hf_hub_download
from anyjev import Decider, Question
from anyjev.backends.hf import HFBackend

art = json.load(open(hf_hub_download("Jayant9928/pii-gate-qwen3.5-4b-nemotron", "contains_phi.head.json")))
Q = Question.noul(art["text"], name="contains_phi")
gate = Decider(HFBackend("Qwen/Qwen3.5-4B"), level="L2")
gate.load_artifact(Q, art)

p = gate.decide_batch(["The change control process is reviewed every quarter."], Q, level="L2")[0].distribution["Yes"]
print("skip" if p <= 0.0297 else "send to redaction")

See example.py. Requires anyjev>=0.2.0 and Qwen/Qwen3.5-4B. Use the exact question text stored in the artifact.

Limitations

  • English only; synthetic training data; validate on your own data before choosing a threshold.
  • A missed-PII rate is never zero β€” keep full redaction on everything the gate does not skip.
  • One question, one base model: the head works only with Qwen/Qwen3.5-4B and this question text.
  • Not a compliance determination (HIPAA, GDPR or otherwise).

Attribution and license

  • Training data: NVIDIA Nemotron-PII β€” https://huggingface.co/datasets/nvidia/Nemotron-PII β€” licensed under CC BY 4.0. The data was filtered, split into pieces, relabelled to a binary PII/PHI target and length-matched as described above.
  • This head is released under CC BY 4.0. The base model Qwen/Qwen3.5-4B is under its own license.
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Jayant9928/PII-Gate-Nemotron-Anyjev

Finetuned
Qwen/Qwen3.5-4B
Finetuned
(1126)
this model

Dataset used to train Jayant9928/PII-Gate-Nemotron-Anyjev