Writing the regexes takes ten minutes. The half of the question that separates candidates is the evaluation: a detector that blocks 'ignore the noise in the data' has shipped a bug to every analyst using your product. Here is the layered detector and the harness that proves it works.
← Coding & DSA / 137
Write a prompt-injection detector and evaluate it on an adversarial set.
Writing the regexes takes ten minutes. The half of the question that separates candidates is the evaluation: a detector that blocks 'ignore the noise in the data' has shipped a bug to every analyst using your product. Here is the layered detector and the harness that proves it works.
Updated Sep 2026 · Grounded in real GenAI, LLM, and AI/ML engineering interview loops and written to a senior-engineer editorial bar.
Unlock the other 847 answers · ₹2,000 / $25Your progress and mastery stay saved · 6 months · one payment · no auto-renew
UP NEXT ON YOUR JOURNEY
Next in this trackImplement output guardrails that block off-topic answers and PII leakage, within a latency budget.Next in this trackImplement a cross-encoder reranker and prove it improves nDCG@10.Next in this trackConsume a streaming LLM response: SSE parsing, incremental output, cancellation, and partial JSON.
DISCUSSION · 0
No comments yet — be the first to share your approach.
