ModelRefs / PII Detection — AI Glossary
PII Detection — AI Glossary
Automated identification of personally identifiable information (names, emails, SSNs, addresses) in text before model processing.
Overview
PII detection uses NER models (spaCy, Presidio, AWS Comprehend) or regex patterns to identify and flag sensitive data in prompts, documents, and LLM outputs. Critical for GDPR, HIPAA, and enterprise data governance. Microsoft Presidio is the leading open-source PII detection library with 20+ entity types.
Reference details
| Topic | safety |
|---|---|
| Last reviewed | 2026-06-24 |
Related terms
Example: Two places to scan, not one
A regex for a social security number matches “123-45-6789” and misses “123 45 6789” written with spaces. A named-entity model catches the spaced form and also catches names, but flags the product name in “our Bean integration failed” as a person. Neither is sufficient alone, and both should run twice: once on the inbound prompt, once on the model's output. The output scan is the one teams skip and the one that matters — a retrieval step can pull a customer record into context that the user never typed, and the model will quote it back.
Commonly confused with
Detection is not redaction and not anonymisation. Detection locates spans; redaction removes or masks them; anonymisation additionally aims to prevent re-identification from the remainder. A transcript with names masked but a rare job title, city and date left intact is redacted, not anonymised.
When to use it
Reach for it when:
- Any pipeline where user text is logged, retained for evaluation, or sent to a third-party model
- Both inbound prompts and outbound completions, especially with retrieval in the loop
- Before data leaves a regulated boundary, where the legal test is on transfer, not on display
Reach for something else when:
- As the only control — treat it as defence in depth beside access control and retention limits
- Where false negatives are catastrophic and volume is low; human review is more reliable
- On structured data you already control: mask at the query, do not detect after the fact
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to PII Detection — AI Glossary.
Frequently asked questions
What is PII Detection?
Automated identification of personally identifiable information (names, emails, SSNs, addresses) in text before model processing.
What concepts are related to PII Detection?
Closely related concepts include pii redaction, differential privacy, data privacy.