Why AI systems leak PII: masking treated as text replacement, not data classification

arpit_bhayani · x · 2026-11-04

A common failure mode in AI systems is PII leakage, and the root cause is treating masking as a text-replacement problem rather than a data-classification problem. Typical anti-pattern: a support bot or RAG pipeline connected to real customer data, with regex stripping emails and phone numbers before shipping. Regex only catches fixed-shape PII; it misses context-dependent PII like "the patient in room 4B", where sensitivity lies in token relationships. NER catches free-text entities via context but misses domain-specific identifiers. What works is layering: 1) structural detectors for fixed-shape data, 2) NER for free-text entities, 3) a domain-specific rule layer for your own schema.

Original post →

More from coding & agent

coding & agent channel →