Why scan user input for PII before it reaches the model rather than only the output?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
PII in the prompt is already at risk because trace exporters, prompt caches, provider logs, and eval pipelines persist the raw input long before any output rail fires.
Imagine writing your social security number on a postcard and dropping it in a mailbox. By the time the recipient reads it and decides whether to keep or shred it, the postcard has already passed through the postal sorter, the truck driver, the local office, and possibly a scanner that takes a photo of every piece of mail. Checking what comes back from the recipient does nothing for all the eyes that already saw the front of the card. A prompt sent to an LLM passes through similar hands, your tracing vendor, the provider's logs, a prompt cache, an evaluation pipeline, before any check on the model's reply has a chance to run. If you want the sensitive information to stay private, you have to redact it on the way out, not on the way back.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
2 min: prompts fan out to tracing, caching, provider logs, and eval pipelines before any output rail runs; input scrub keeps the compliance perimeter narrow; output scrub catches what input misses (model echoing or generating PII); compose both with provider data-retention configuration and tracing-side redaction.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming the output guardrail is the only place PII can leak. By the time output runs, the input has already been copied to several systems outside your direct control.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.