Course contentsShow
← AI Engineering
Lesson 1526 of 1,88637. Privacy and Data GovernanceFree lesson

Identifying PII in LLM Training and Inference Data

Learn to detect personally identifiable information in prompts, responses, and training datasets for AI systems.

Identifying PII in LLM Training and Inference Data

You'll learn how to systematically detect personally identifiable information that flows through your AI system's training datasets and live inference requests.

What Is PII Detection in AI Contexts?

Personally Identifiable Information (PII) includes any data that could identify a specific individual—names, email addresses, phone numbers, social security numbers, addresses, or even unique combinations of attributes. In AI systems, PII can appear in two critical places: training data (what you feed the model during development) and inference data (user prompts and model responses in production).

Think of PII detection like airport security scanning luggage: you need automated systems that flag prohibited items (sensitive data) before they board the plane (enter your model or get stored in logs).

Why This Matters

Training an LLM on unredacted customer support transcripts might teach it to regurgitate real names and account numbers. Processing user prompts without PII scanning could log sensitive information in plain text, violating privacy regulations like GDPR or HIPAA.

Detection Strategies

You've already learned regex-based detection (pattern matching for emails, SSNs) and NER models (Named Entity Recognition for names, locations). Apply these before training data ingestion and during inference request processing.

Scan systematically:

  • Training phase: Audit datasets before model fine-tuning
  • Inference phase: Inspect prompts on arrival and responses before delivery
  • Logging: Check what you're storing in audit trails

The goal isn't just compliance—it's building user trust by ensuring their private information never becomes training fodder or leaks through careless logging.

Key Takeaway: PII detection must happen at both training time (preventing model memorization) and inference time (protecting live user data), using the sanitization techniques you've already mastered.