Chapter 34: Privacy and PII
Language models memorize, and repeated or rare strings (emails, phone numbers, keys) are the easiest to extract. What is in the corpus can come out of the model. Privacy in an ML system is therefore a data-flow property: personal data enters through the corpus and through user requests, and leaves through model outputs and logs. A policy names each flow and its control, the pipeline and the gateway enforce it, and tests on labelled fixtures show it works.
Concepts from other sections (8)
This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.
- Typed placeholder: a token such as
<EMAIL>that replaces a detected value while keeping the text’s shape. Read more: 34.1 Privacy and PII policy - Data minimization: not collecting or keeping data you do not need, the cheapest privacy control. Read more: 34.1 Privacy and PII policy
- Model card: the model’s interface documentation: details, intended and out-of-scope use, evaluation with uncertainty, limitations, and data. Read more: 35.1 Datasheet and model card
- PII policy: the per-source rule from the ledger:
scrub,drop, ornone. Read more: 5.5 PII scrub with typed placeholders and audit spans in Data Engineering - Luhn check: the checksum every card number satisfies; the Luhn sum must be a multiple of 10. Read more: 34.1 Privacy and PII policy
- reference policy: the frozen model (usually the SFT checkpoint) against which the policy’s log-ratios are measured. Read more: 18.2 Direct preference optimization and IPO
- word error rate (WER): pooled substitutions, deletions and insertions divided by the total reference word count. Read more: 15.5 Multimodal eval metrics: WER, CER, VQA, captions, zero-shot
- Threat model: a structured answer to four questions about a system: what are we building, what can go wrong, what are we going to do about it, and did we do a good job? It turns an architecture into a list of threats, each tied to a control and a test. Read more: Chapter 9: Security in Software Engineering
This chapter writes that policy and then extends it to media. The first section, on PII, covers what counts as personal data, where it enters and leaves, and why you scrub before training and redact before logging: the corpus pipeline replaces PII with typed placeholders such as <EMAIL>, and the gateway applies the same detector list to its logs. It treats a detector as a classifier with a precision and a recall, measured on labelled fixtures that include the lookalikes (ISBNs, version strings, trace ids) that cause false positives. Throughout, data minimization is the cheapest control: what you never collect or keep cannot leak or need erasing. The second section turns to images and voice, where a license to a recording is not consent to use a person’s face or voice, and builds the evidence program that keeps multimodal model cards honest.
Learning objectives
- Map every flow by which personal data enters and leaves an LLM system, and assign each a control.
- Write a PII policy with typed placeholders, an audit that never stores values, log retention, and an erasure procedure.
- Measure a detector’s precision and recall, and use structural rules such as the Luhn check to keep precision high.
- Keep license and consent as separate records for biometric media, and bind a model card’s numbers to their evidence.
Before you begin
Section titled “Before you begin”The reading has no prerequisites. The first section follows the shape of Data Licensing, a policy as prose plus decisions a program checks, so reading that chapter first helps. The policy is implemented by the scrub in PII scrub with typed placeholders and audit spans in Data Engineering, which runs after deduplication. The second section assumes the vision and speech towers of AI Engineering and the model card from Model and Data Cards. Good preparation is Carlini et al., sections 1 to 5, and the core of the NIST Privacy Framework.
In this chapter
Section titled “In this chapter”- Privacy and PII policy: the five kinds of personal data and secrets the system detects, the flows they travel, detectors as classifiers, the Luhn check, and a walkthrough of the reference policy, its machine-readable half, and twelve review cases.
- Consent and biometric evidence in model cards: consent fields on the ledger, pooled WER per group, digest-bound model cards, and an evidence program that refuses changed or revoked media before inference.
The policy also touches other books. What traces and logs may contain is a concern of Observability in Systems Engineering, and the secrets review and threat model live in Security in Software Engineering.
Further reading
Section titled “Further reading”- NIST Privacy Framework 1.0 (free).
- Carlini et al., Extracting Training Data from Large Language Models (free).
- GDPR (free), especially articles 5 (principles) and 17 (erasure).
- Microsoft, Presidio (free), a reference PII detector.
- Lukas et al., Analyzing Leakage of Personally Identifiable Information in Language Models (free).