knoveleng/pii-masking-contrastive-en
PII Masking Contrastive (English) Contrastive pairs for PII masking and PII-leak steering. Each row has a general user prompt and two versions of the same answer: masked_response, where personal information is replaced by [LABEL] placeholders, and pii_response, identical except that the placeholders are filled with realistic PII values. Size: 400 train, 100 test. Language: English. Source: derived from the English part of ai4privacy/pii-masking-300k. Columns… See the full description on the dataset page: https://huggingface.co/datasets/knoveleng/pii-masking-contrastive-en.
PII Masking Contrastive (English)
Contrastive pairs for PII masking and PII-leak steering. Each row has a general user prompt and two versions of the same answer: masked_response, where personal information is replaced by [LABEL] placeholders, and pii_response, identical except that the placeholders are filled with realistic PII values.
- Size: 400 train, 100 test.
- Language: English.
- Source: derived from the English part of ai4privacy/pii-masking-300k.
Columns
masked_response equals pii_response with every span replaced by [label] (checked for every row). For preference-style training you can map chosen = masked_response, rejected = pii_response.
from datasets import load_dataset
ds = load_dataset("knoveleng/pii-masking-contrastive-en")How it was made
- Take source rows, drop those with no PII, broken span offsets, odd-looking values (
None,September/54, a bare21as a time, leaked annotation markup) or literal placeholder-like text. Merge the source'sGIVENNAME*/LASTNAME*labels into oneNAMEspan per person. Keep one chunk per source document and sample with a fixed seed. The test split is drawn from the source's validation split. - Send the placeholder text (never the real values) to
gpt-5.6-luna, which writes a clean, complete response that keeps the placeholders, plus a general prompt. The values never pass through the model: they are filled back from the source annotations in code. - Programmatic validation (placeholder ids and labels, no leaked values or PII patterns in the masked text or the prompt, prompt length), then an LLM review of each pair for prompt plausibility, residual PII and whether each filled value fits its slot. About two thirds of candidates survive.
Labels present (23, rows containing each): TIME (175), NAME (156), USERNAME (126), TEL (123), IDCARD (118), EMAIL (117), DATE (116), SOCIALNUMBER (113), IP (113), STATE (112), STREET (111), CITY (109), POSTCODE (109), PASSPORT (108), BUILDING (94), DRIVERLICENSE (93), BOD (81), COUNTRY (80), PASS (74), TITLE (73), SEX (72), SECADDRESS (47), GEOCOORD (13). Rows have 6.6 PII spans on average and a median of 454 characters in masked_response.
Limitations
- The PII values come from pii-masking-300k, which is synthetic (no real individuals), so some have unusual formats (for example ISO timestamps as dates of birth) and label noise carried over from the source.
- Responses and prompts are LLM-written and were reviewed by an LLM (the same model), not by humans, apart from spot checks.
- Prompts are not very diverse: 83% start with "Create a" or "Write a".
- Small dataset (500 rows), English only.
Attribution and license
Released under CC BY 4.0 with the permission of Ai4Privacy. This dataset is derived from ai4privacy/pii-masking-300k © Ai4Privacy. If you use it, please credit Ai4Privacy and link to the source dataset.
