A production Retrieval-Augmented Generation (RAG) system is inadvertently exposing complete credit card numbers from its underlying knowledge base in user-facing responses, despite earlier attempts to cleanse the source documents. Since a full re-sanitization of the entire document corpus isn't feasible right now, what specific guardrail method would prevent this PII leakage directly from the model's generated output?
Answer & explanation
Correct answer: B
WHY B is correct: Output scanning with regex and/or a PII detection model is the standard post-generation guardrail for preventing sensitive data leakage in LLM responses. It runs on every response before it reaches the user and acts as a safety net independent of whether the source documents or model behavior were properly sanitized. Regex patterns for credit card formats are highly reliable and have near-zero latency overhead.
WHY NOT A: Reducing top-k decreases the chance of retrieving a PII-containing chunk but does not eliminate it. If even one retrieved chunk contains a credit card number, the model may still surface it in the response. This is a probabilistic mitigation, not a guardrail.
WHY NOT D: max_tokens controls response length, not the model's tendency to copy or generate specific content. Increasing it makes no causal connection to PII suppression and would likely generate longer — not safer — responses.
WHY NOT C: Re-syncing the index updates the vector embeddings but does not sanitize the source document content. Credit card numbers in the original Delta table text remain present and can still be retrieved and surfaced.