AI Engineering · LLM applications that ship
How do you handle PII and sensitive data with LLM APIs?
Short answer
Minimise what leaves your boundary, redact or tokenise before sending, use providers with suitable retention terms, encrypt and restrict access, and delete according to policy.
Prompts and completions can contain personal data, and they may be logged by the provider, your gateway and your tracing system. The safe default is to send only what the task needs, strip identifiers where they are not required, and know exactly which third parties see the data.
- Redact or replace names, emails, phone numbers and account IDs before the model call when possible.
- Review provider data-retention and training-use terms, including subprocessors.
- Encrypt in transit and at rest, and restrict trace access by role.
- Set retention windows and support deletion requests across prompts, logs and caches.
- Never put secrets, credentials or full payment data in a prompt.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How would you redact while preserving enough context for the model?
- 2What would you check in a provider's data-processing agreement?
- 3How do traces complicate deletion requests?
Say it in the interview
I minimise first: only the fields the task needs leave our boundary. Where identifiers are not required I redact or tokenise them, and I check the provider's retention and training terms before sending anything. Traces, caches and logs are part of the data surface, so they need the same access control and retention policy. If a user asks for deletion, it has to cover prompts and completions too, not just the primary database.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AI Engineering mock interview and get scored feedback on depth, clarity and confidence.