How to Handle PII and Sensitive Data in AI Pipelines

Emily Winks, Data Governance Expert, Atlan
Data Governance Expert
Updated:07/20/2026
|
Published:07/20/2026
13 min read

Key takeaways

  • Shadow AI raises the average cost of a data breach by $670,000, per IBM, largely from context nobody classified first.
  • OWASP 2025 lists sensitive information disclosure as a core LLM application risk storage security alone cannot stop.
  • Static masks fail once copied into tickets or embeddings; semantic policies travel with meaning, not a column's name.
  • GDPR Article 5 and the EDPB's 2024 AI opinion extend data-minimization duties into training and inference, not just storage.

How Do You Handle PII in AI Pipelines?

PII governance for AI pipelines is the practice of classifying, masking, filtering, tracing, and authorizing sensitive data before any AI system consumes it. The shift is from storage security to delivery security: a locked-down database does not stop an agent from receiving unsafe context if policy checks run too late. Teams need to discover PII across tables, documents, and embeddings, link technical fields to semantic policies, mask values at the moment context reaches a model, and capture lineage from source data through to agent output.

The core controls PII governance for AI pipelines needs:

  • Discovery and classification: find PII across tables, documents, logs, tickets, and embeddings before any AI job touches it
  • Semantic policy mapping: link technical fields like customer_ssn_raw to policies like Social Security Number
  • Dynamic masking: apply masking and redaction at the moment context reaches the model
  • Lineage capture: trace sensitive data from source through transformation, embedding, and agent output

Want to see how context governs delivery, not just storage?

Download the 2026 Report

PII governance for AI pipelines is delivery-time control for sensitive data before it reaches prompts, embeddings, fine-tuning, or agents. According to IBM (2025), breaches involving shadow AI cost organizations $670,000 more on average, a gap Cybersecurity Dive traces back to unsanctioned AI tools pulling context nobody classified first. You need discovery, tagging, dynamic masking, lineage, and MCP-gated access across Snowflake, Databricks, dbt, and vector databases. Atlan’s context layer is where that classification and policy work lives, so the control travels with the data instead of stopping at the warehouse wall.


Quick facts

Permalink to “Quick facts”
Control What it protects Where it fails without context governance
Discovery and classification Finds sensitive fields and documents before AI systems use them Pattern matching misses renamed fields, free text, and copied values
Dynamic masking Protects values at inference time based on user, agent, and purpose Static masks fail when an unmasked copy reaches another pipeline path
Semantic policies Applies rules based on meaning, not fragile column names A column rename can bypass scripts that only monitor field names
Lineage and audit trails Proves which sources, transformations, and agents touched sensitive data Compliance review becomes reconstruction theater after the incident
Context delivery control Blocks unsafe context before it enters prompts, embeddings, or tool calls Model-level guardrails see the problem after exposure has occurred

What does an AI-ready context layer look like?

Get the Context Layer Ebook for a practical breakdown of the semantic infrastructure AI agents need to work with sensitive data safely.

Get the Context Layer Ebook

Why does PII risk change in AI pipelines?

Permalink to “Why does PII risk change in AI pipelines?”

PII risk changes because AI pipelines deliver data into systems that summarize, retrieve, generate, and act. A secured warehouse protects stored data; an AI pipeline must also protect the context window, embedding pipeline, retrieval layer, tool call, and output path. OWASP 2025 lists sensitive information disclosure as a core LLM risk, one entry in the wider set of AI agent risks and guardrails enterprises now manage.

A customer support agent shows the failure cleanly. It needs order status, shipping exceptions, and fraud risk, not raw Social Security numbers, full card numbers, or medical notes from a support attachment. If the retrieval layer pulls the whole account bundle into the prompt, warehouse permissions can be correct while the model context is still unsafe.

Why is storage security not enough?

Permalink to “Why is storage security not enough?”

Storage security controls who can query a system. AI delivery security controls what context reaches a model after retrieval. Encryption at rest, warehouse RBAC, and dashboard permissions protect data at rest, not agents. Agents create new paths: embedding jobs, prompt assembly, retrieval augmentation, tool invocation, and generated output. AI agent memory governance must follow the data into the workflow, not stop at the source system.

How do models expose sensitive data?

Permalink to “How do models expose sensitive data?”

Models expose sensitive data through four routes: memorization during training or fine-tuning, retrieval from unsafe context stores, output generation from prompts carrying sensitive fields, and a RAG pipeline tuned only for relevance that can leak the same context without any memorization at all. Carlini et al. (2021) demonstrated that training data extraction can recover individual examples including names, phone numbers, and email addresses. The lesson: never let sensitive data reach a model unless the use, user, purpose, and retention path are governed.


Why does static masking fail?

Permalink to “Why does static masking fail?”

Static masking fails because AI systems reuse data through many paths. A field masked in a reporting table can still appear unmasked in a support ticket, PDF, event log, cached embedding, or feature pipeline. The question becomes semantic, not syntactic: does this value mean PII wherever it appears?

Semantic policies attached to business meaning provide stability. The policy follows Social Security Number, account holder address, payment card token, or patient identifier even when a developer renames a field from ssn to tax_id_v2. Decision traces capture whether each policy fired and what the agent received.

What breaks when columns change?

Permalink to “What breaks when columns change?”

A static rule masks customer_ssn. A developer deprecates it and ships customer_tax_identifier. The data type still looks like a string. The field name changed. The PII did not. A brittle masking script sees a new column. A semantic policy sees the same sensitive concept and keeps the rule intact, the same failure mode as context drift: the schema moved, but nothing told the agent the underlying rule hadn’t.

What breaks in unstructured data?

Permalink to “What breaks in unstructured data?”

Unstructured data carries the same risk with worse visibility. A PDF may hide a tax ID in a scanned attachment. A Slack export may include an employee health detail. A call transcript may include a card number spoken aloud. Chunking and embedding turn that content into retrievable context unless discovery and access policies run before indexing. Stale, ungoverned embeddings become a durable privacy liability and a quiet route for context poisoning: an enterprise AI memory layer should expose whether a chunk is approved for this user, agent, and purpose.


How should you handle PII before it reaches LLMs?

Permalink to “How should you handle PII before it reaches LLMs?”

Handle PII before it reaches LLMs by treating every AI request as a governed context delivery event: classify sensitive assets, resolve their business meaning, check the request purpose, apply the right policy, and write an audit trail. The model receives only the context it needs to complete the task.

What should discovery classify?

Permalink to “What should discovery classify?”

Discovery must classify direct identifiers, quasi-identifiers, regulated attributes, and sensitive business data across every source. Start with email, phone, postal address, payment card data, national identifiers, protected health information, payroll data, authentication secrets, confidential deal terms, and support attachments. Then map those detections to business glossary terms and policy groups, the same rigor data quality for AI already demands upstream of every model.

Where should masking happen?

Permalink to “Where should masking happen?”

Masking should happen at context delivery, before the model receives retrieved content. A customer agent can see order_status and fraud_flag when authorized, while card_number, ssn, and full_billing_address stay masked. This preserves utility: the agent receives task-relevant signals without receiving raw identifiers, the same authorization question raised by giving AI agents access to enterprise data at all.

How should lineage prove compliance?

Permalink to “How should lineage prove compliance?”

Lineage must trace sensitive data from the source system to the AI-facing output. That path includes ingestion, transformation, chunking, embedding, retrieval, prompt assembly, tool calls, and generated response storage. GDPR Article 5 requires personal data to be processed lawfully, fairly, transparently, and with data minimization. The EDPB’s 2024 opinion on AI models and GDPR reinforces that this obligation follows the data into training and inference, not just storage, echoing what GDPR compliance for AI agents already requires teams to document. An AI audit needs proof of those controls, not a diagram made after the fact.


How do you design a safe PII pipeline?

Permalink to “How do you design a safe PII pipeline?”

A safe PII pipeline uses layered enforcement to keep raw sensitive data out of model context unless an authorized use requires it. The pattern works across warehouses, document stores, vector databases, and agent frameworks, whether one agent queries the pipeline or several agents share the same governed context.

Step Control Practical test
1 Classify PII and sensitive data across tables, files, logs, tickets, and embeddings Newly ingested assets receive sensitivity tags before downstream AI jobs can consume them
2 Map technical fields to semantic glossary terms and policy categories customer_ssn_raw and tax_id_v2 resolve to the same governed concept
3 Filter, redact, or mask data before embedding and prompt delivery The model never receives raw values that policy does not authorize
4 Enforce purpose, role, agent, and channel policies at retrieval time A support agent and finance analyst receive different views of the same record
5 Capture lineage and decision traces for every sensitive context delivery event Audit logs show source, transformation, policy decision, agent, user, and output path

How should your team govern embeddings?

Permalink to “How should your team govern embeddings?”

Embeddings need governance before indexing, not cleanup after retrieval. Redact or tokenize sensitive values with no task value before embedding. Attach owner, source, freshness, and sensitivity metadata to every chunk, and set deletion workflows for records under retention limits. A context layer should expose whether a chunk is approved for this user, agent, and purpose, the same gate a governed RAG pipeline needs regardless of privacy risk.

How should your team govern fine-tuning?

Permalink to “How should your team govern fine-tuning?”

Fine-tuning datasets need stricter controls than retrieval prompts, since training changes model behavior. Filter PII before dataset assembly, and record the source lineage, transformation code, and approval status for each training dataset version. De-identification is not a synonym for safe reuse; validate residual re-identification risk. NIST AI 600-1 frames generative AI risk management around govern, map, measure, and manage: what data the system uses, where it came from, which controls apply, and how residual risk is measured.


Is your data estate ready for AI agents?

Run the AI Agent Context Readiness assessment to see where sensitive data can still reach a model unmasked.

Assess Your Readiness

How Atlan approaches PII governance in AI pipelines

Permalink to “How Atlan approaches PII governance in AI pipelines”

The challenge

Permalink to “The challenge”

AI pipelines pull from warehouses, lakehouses, documents, tickets, logs, and vector stores. Privacy controls fail when each system classifies PII differently or when policy enforcement stops before context reaches the agent.

The approach

Permalink to “The approach”

Atlan acts as the governed context layer across those systems, linking technical metadata to business glossary terms, policies, owners, and lineage, and resolving policy against the requesting agent’s identity, not just the human behind it. Sensitive data policies apply by meaning, not column name. Atlan connects this to AI agent memory governance and MCP context delivery so agents receive only approved context.

The outcome

Permalink to “The outcome”

Your team can prove which sensitive data was discovered, which policy applied, which agent received context, and which fields were masked or blocked. Context Engineering Studio bootstraps an initial context and policy map from existing signals for a steward to validate, rather than starting from a blank page. Context agents keep that map current as schemas evolve, flagging drift for a human to review rather than certifying it automatically. Privacy becomes a runtime control, not a spreadsheet.


Real stories from real customers: governing sensitive data at scale

Permalink to “Real stories from real customers: governing sensitive data at scale”

"When you're working with AI, you need contextual data to interpret transactional data at the speed of transaction (within milliseconds). So we have moved from privacy by design to data by design to now context by design. We needed a tool that could scale with us. We chose Atlan, a platform that's configurable, intuitive, and able to scale with our 100M+ data assets."

Andrew Reiskind, Chief Data Officer, Mastercard

"With Atlan, we cataloged over 18 million assets and 1,300+ glossary terms in our first year, so teams can trust and reuse context across the exchange."

Kiran Panja, Managing Director, Cloud and Data Engineering, CME Group

Mastercard’s shift from privacy by design to context by design is the same delivery-security shift this page argues for, at transaction speed. CME Group shows the scale version: trust and compliance depend on lineage running through the sensitive data flows, not around them.

What's ungoverned PII costing you?

Run the Context Layer ROI Calculator to size the cost of agents still guessing past a masking rule that no longer matches the schema.

Calculate the ROI

Why privacy now depends on context delivery

Permalink to “Why privacy now depends on context delivery”

PII governance for AI pipelines is not a masking checklist. It is the discipline of deciding what context a model is allowed to see before the model sees it. The old control point was the database. The new control point is delivery.

The practical test is simple: if a sensitive field changes name, appears in a document, moves into an embedding, or is requested by a new agent, the policy still has to fire. That takes semantic classification, lineage, and context-aware delivery, not dynamic access control alone. A stronger reasoning model fed ungoverned sensitive context produces more sophisticated wrong outputs, not fewer. Governing what reaches the model is what turns model capability into trustworthy production output.


FAQs about PII and sensitive data in AI pipelines

Permalink to “FAQs about PII and sensitive data in AI pipelines”

1. Can language models memorize PII?

Permalink to “1. Can language models memorize PII?”

Language models can memorize training examples, especially when sensitive data enters training or fine-tuning data. Retrieval systems can also expose PII without memorization by placing unsafe context into a prompt. The safer design keeps raw sensitive data out of both unless the use is explicitly authorized.

2. Is static masking enough for AI pipelines?

Permalink to “2. Is static masking enough for AI pipelines?”

Static masking is useful but not enough alone. AI pipelines pull from many copies of the same concept: raw tables, tickets, document stores, logs, embeddings, and cached context. Dynamic masking checks the user, agent, purpose, and sensitivity at delivery time, when the actual request is known.

3. How should teams handle PII in documents and PDFs?

Permalink to “3. How should teams handle PII in documents and PDFs?”

Treat documents and PDFs as governed data assets, not loose text. Classify sensitive content before chunking, redact values that don’t need retrieval, attach owner and freshness metadata, and enforce access policies before chunks reach a model.

4. What is the safest way to use PII in RAG?

Permalink to “4. What is the safest way to use PII in RAG?”

The safest RAG pattern filters sensitive data before indexing and again before retrieval. Approved chunks carry metadata for owner, source, sensitivity, and freshness. The retriever returns only the minimum context the task needs, with masking applied before prompt assembly.

5. How do access policies apply to AI agents?

Permalink to “5. How do access policies apply to AI agents?”

Access policies should treat AI agents as controlled consumers with scoped permissions. Agent identity, user identity, task, channel, and data class all matter. A finance agent, support agent, and compliance agent may query the same record, but each should receive a different governed view.

6. What evidence do auditors need for AI data privacy?

Permalink to “6. What evidence do auditors need for AI data privacy?”

Auditors need evidence that sensitive data was discovered, classified, masked, and traced. Useful proof includes source lineage, transformation history, embedding status, policy decisions, agent and user identity, and output logs. A screenshot of a policy isn’t enough once context moves through multiple systems.


Sources

Permalink to “Sources”
  1. IBM. (2025). Cost of a Data Breach Report. https://www.ibm.com/reports/data-breach

  2. Cybersecurity Dive. (2025). Shadow AI increases cost of data breaches, report finds. https://www.cybersecuritydive.com/news/artificial-intelligence-security-shadow-ai-ibm-report/754009/

  3. OWASP. (2025). OWASP Top 10 for LLM Applications. https://owasp.org/www-project-top-10-for-large-language-model-applications/assets/PDF/OWASP-Top-10-for-LLMs-v2025.pdf

  4. NIST. (2024). Artificial Intelligence Risk Management Framework and Generative AI Profile. https://www.nist.gov/itl/ai-risk-management-framework

  5. NIST. (2024). Artificial Intelligence Risk Management Framework: Generative AI Profile, NIST AI 600-1. https://doi.org/10.6028/NIST.AI.600-1

  6. EDPB. (2024). Opinion on AI models and GDPR principles. https://www.edpb.europa.eu/news/news/2024/edpb-opinion-ai-models-gdpr-principles-support-responsible-ai_en

  7. Carlini, N. et al. (2021). Extracting Training Data from Large Language Models. USENIX Security. https://www.usenix.org/system/files/sec21-carlini-extracting.pdf

  8. European Union. (2016). General Data Protection Regulation. https://eur-lex.europa.eu/eli/reg/2016/679/oj

Share this article

signoff-panel-logo

Atlan is the Context Layer for AI, a Leader in the Gartner Magic Quadrant for D&A Governance (2026) and the Forrester Wave for Data Governance (Q3 2025). Atlan unifies your data, business knowledge, and the meaning behind your terms into one Enterprise Data Graph that gives every team and every AI agent the trusted context they need. Trusted by Mastercard, Workday, General Motors, CME Group, HubSpot, FOX, Virgin Media O2, Elastic, and 400+ enterprises representing $10T+ in market cap.

Bridge the context gap.
Ship AI that works.

[Website env: production]