Prompt Injection interview question

AI Safety & SecurityPrompt InjectionProbabilityhard

A bank's research agent answers each analyst question from k = 20 retrieved web chunks and produces 500,000 answers a month. Assume 1% of retrieved chunks contain an injection, a detector removes injected chunks with recall 0.90, and chunks are independent. What share of answers is built on at least one undetected injected chunk, and how many answers a month is that?

  1. AAbout 2.0%, from 1 − (1 − 0.01 × 0.10)^20, or roughly 9,900 answers a month, since an answer is unaffected only if each of its 20 chunks is either clean or caught by the detector.
  2. BAbout 0.1%, the per-chunk miss rate 0.01 × 0.10, or roughly 500 answers a month, since an answer counts only once however many of its 20 retrieved chunks carry an injection.
  3. CAbout 18%, from k × p × r = 20 × 0.01 × 0.90, or roughly 90,000 answers a month, since each of the 20 chunks adds its own chance of injection and the detector's recall scales that chance.
  4. DAbout 87.8%, from 1 − 0.90^20, or roughly 439,000 answers a month, since the detector has to classify all 20 chunks correctly and each one of its checks has a 10% chance of failing.
Show the answer and explanation

Correct answer: A, About 2.0%, from 1 − (1 − 0.01 × 0.10)^20, or roughly 9,900 answers a month, since an answer is unaffected only if each of its 20 chunks is either clean or caught by the detector.

Explanation Prompt Injection

Per chunk, an injection gets through when the chunk is injected and the detector misses it: q = p × (1 − r) = 0.01 × 0.10 = 0.001.

An answer is unaffected only if none of its k chunks lets an injection through, so:

P(at least one undetected injection) = 1 − (1 − q)^k = 1 − 0.999^20 ≈ 0.0198, about 2.0%, or ≈ 9,900 of 500,000 answers a month.

For small q this is close to k × q = 0.02. The lesson is in how it scales:

Recall rq = p(1 − r)Answers affected (k = 20)Per month
0.900.001≈ 2.0%≈ 9,900
0.990.0001≈ 0.2%≈ 1,000
0.9990.00001≈ 0.02%≈ 100

Even a 99%-recall detector lets an injected chunk into about 1,000 answers a month at this volume, and an adaptive attacker tunes payloads against the detector, so the real miss rate is likely higher than the benchmark suggests. Detection lowers the frequency; the control has to be limiting what an injected answer can do: no unapproved tools, egress limits, confirmation for actions.

Why the distractors fail: 0.1% ignores that each answer draws on 20 chunks. 20 × 0.01 × 0.90 uses recall (the share caught) where the miss rate belongs. 1 − 0.90^20 drops the 1% prevalence and treats every chunk as an attack.

Interview tip: write down 1 − (1 − p(1 − r))^k and turn it into a monthly count; it makes the case for capability limits better than any adjective.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More AI Safety & Security questions

  1. An open-weight general-purpose AI (GPAI) model was trained with 6 × 10²⁴ FLOP, as its developer documents. A telecom LoRA-fine-tunes it with 2 × 10²⁰ FLOP and…
  2. A retail assistant's release gate is a 2,000-prompt single-turn jailbreak suite plus a classifier that scores each user message on its own. A red-teamer asks…
  3. What is prompt injection in an LLM application?
  4. A retailer's shopping app calls the LLM provider directly from the client with the code below; the key is injected from an environment variable at build time.…
  5. A consultancy's responsible-AI board reviews the five incidents below. Which mapping to harm types (allocation, quality of service, stereotyping, denigration,…