RAG Interview Questions and Answers

These questions go past "what is RAG?" into the design and debugging calls interviewers use to separate people who have shipped a retrieval system from people who have read about one. All 16 are listed below, with model answers to five of them; the full set of answers comes as a free PDF. If you need the basics first (the pipeline, RAG vs fine-tuning, what reranking is), start with the free 50 LLM interview questions.

16 questions · 5 sample answers · Updated

Get all 16 answers as a free PDF
On this page · 4 sections
  1. RAG design decisions
  2. Retrieval and chunking
  3. Evaluation and debugging
  4. Production and security

RAG design decisions

  1. 1. When would you not use RAG?

    Sample answer

    When the knowledge isn't unstructured text that people search by meaning. If the corpus is small and stable, I paste it into the prompt: no retrieval step means no retrieval misses. If the question is structured, like "orders over $500 last month," that's a SQL query behind a tool, because embeddings are fuzzy and the question is exact. If the data changes per request, like an account balance or the user's current plan, I call the live API instead of indexing a snapshot that goes stale. And if it's general, stable knowledge the model already handles well, retrieval only adds latency.

    My two sorting questions are: is it structured, and does it change per request? A yes to either usually means a tool, not an index. RAG's lane is semi-stable documents people search by meaning, like a handbook or a help center.

    What they’re checking:
    Whether you treat RAG as one option among several and route knowledge by its shape, instead of reaching for a vector database by default.
    Likely follow-up:
    A user asks "what plan am I on?" How would you answer it, and why not from the index?
    Avoid:
    Embedding customer records or a product catalog when a WHERE clause or a permissioned API call answers the question exactly.
  2. 2. Your knowledge base is 30 pages. Would you build RAG or put it all in the prompt?

    What they’re checking:
    Whether you can reason about long context vs retrieval as a cost, scale, freshness and permissions tradeoff.
    Likely follow-up:
    Some of those pages are now customer-specific and only certain users may see them. What changes?
    Model answer and the mistake to avoid: in the free PDF
  3. 3. What would you attach to each retrieved passage besides the text?

    What they’re checking:
    Whether you see context assembly as its own stage with its own bugs, between retrieval and generation.
    Likely follow-up:
    How do you decide how many passages to include?
    Model answer and the mistake to avoid: in the free PDF
  4. 4. How do you write the generation prompt so the answer stays grounded?

    What they’re checking:
    Whether you know abstention is the key instruction and that citations still need checking after generation.
    Likely follow-up:
    How would you measure whether citations support the claims they're attached to?
    Model answer and the mistake to avoid: in the free PDF

Retrieval and chunking

  1. 5. How would you chunk a corpus that mixes prose, tables, code and support tickets?

    What they’re checking:
    Whether you choose chunk boundaries from content structure and query shape rather than a magic number.
    Likely follow-up:
    How would you check whether a chunking change helped?
    Model answer and the mistake to avoid: in the free PDF
  2. 6. Small chunks retrieve precisely but lack context. How do you get both?

    What they’re checking:
    Whether you know the standard way out of the chunk-size tradeoff and what it costs.
    Likely follow-up:
    What metadata do you need at indexing time to make neighbor expansion possible?
    Model answer and the mistake to avoid: in the free PDF
  3. 7. Users paste error codes and order IDs, and vector search misses them. What do you do?

    Sample answer

    Add keyword search and run hybrid retrieval. An embedding squeezes meaning into one fixed-length vector, and exact surface forms like ERR_CONN_5023 or a SKU are exactly what that compression throws away. BM25 matches those tokens directly.

    So I run BM25 and vector search in parallel and merge the lists with reciprocal rank fusion, which combines ranks instead of scores, since BM25 scores and cosine similarities aren't on the same scale. Then a reranker orders the fused top candidates. Before building it, I'd audit the query log for the share of identifier-shaped queries, and I'd slice the eval set by query type. An overall recall number can look fine while identifier queries sit far lower, and that slice is what tells you hybrid is the fix.

    What they’re checking:
    Whether you understand why embeddings fail on exact tokens and know the standard hybrid setup.
    Likely follow-up:
    How does reciprocal rank fusion work, and why not just average the two scores?
    Avoid:
    Swapping the embedding model or editing the prompt to fix a problem that's lexical by nature.
  4. 8. Why does a cross-encoder reranker beat embedding similarity, and why not use it for everything?

    What they’re checking:
    Whether you understand the bi-encoder vs cross-encoder difference and the two-stage funnel's economics.
    Likely follow-up:
    The reranker adds 400 ms. How do you decide whether it's worth it?
    Model answer and the mistake to avoid: in the free PDF
  5. 9. You need to switch embedding models. How do you migrate the index?

    What they’re checking:
    Whether you treat the embedding model as a schema dependency with a planned migration path.
    Likely follow-up:
    How would you estimate the cost and time of re-embedding the corpus?
    Model answer and the mistake to avoid: in the free PDF

Evaluation and debugging

  1. 10. Recall@k looks good, but the answers are still wrong. What's going on?

    Sample answer

    Usually the retrieved set is relevant but not sufficient. Recall asks whether a relevant chunk made the top k. It doesn't ask whether the chunks together contain the answer. Three common causes: a multi-hop question where each passage is relevant but the combination is incomplete; the rule was retrieved but its exception wasn't; or the top k is five near-copies of the same half-answer.

    Chunks that are too small cause this too. The model gets fragments and invents the connective tissue between them. So I add an answerability metric: on a sample, a human or a calibrated LLM judge marks whether the answer is fully derivable from the selected passages. When retrieval metrics and answer quality disagree like this, chunking is the first thing I look at.

    What they’re checking:
    Whether you know recall only measures whether evidence arrived, and can name a metric for whether it's enough.
    Likely follow-up:
    How would you calibrate an LLM judge for answerability before trusting it at scale?
    Avoid:
    Tuning chunk size on retrieval metrics alone.
  2. 11. How would you build a retrieval eval set before you have production traffic?

    What they’re checking:
    Whether you can design a test set that reflects real users, including its known biases.
    Likely follow-up:
    Why might a synthetic set show 0.95 recall while real users get much less?
    Model answer and the mistake to avoid: in the free PDF
  3. 12. The right document is in the index but never comes back for a query. How do you find out why?

    What they’re checking:
    Whether you debug retrieval by bisecting stages instead of guessing at the model or the prompt.
    Likely follow-up:
    Two-thirds of your failures trace to one stage. What do you do next?
    Model answer and the mistake to avoid: in the free PDF
  4. 13. A new embedding model improves Recall@5 by six points overall. Do you ship it?

    What they’re checking:
    Whether you gate retrieval changes on per-slice offline results plus latency and cost.
    Likely follow-up:
    Which guardrail metrics would you watch during the online test?
    Model answer and the mistake to avoid: in the free PDF

Production and security

  1. 14. How do you enforce document permissions in a RAG system?

    Sample answer

    As a pre-filter at retrieval time, bound to the authenticated user from the session. Every chunk carries tenant and permission metadata stamped at indexing, and the search only runs over what this user may see. Filtering after retrieval is weaker: content the user can't see has already affected the ranking and can leak via scores or snippet text. Post-filtering also empties the top k. If nine of ten neighbors belong to other tenants, the user sees one result, which shows up as "search barely works for small customers."

    Testing splits in two. Access correctness is pass/fail: assert zero leakage across tenants and roles. Quality is measured per slice with realistic permission contexts, never as a superuser. Caches need the same authorization scope in their keys, or a cached answer becomes the leak.

    What they’re checking:
    Whether you put authorization before retrieval and know why post-filtering is not equivalent.
    Likely follow-up:
    A user's access is revoked while a cached answer built from that document is still warm. What happens?
    Avoid:
    Retrieve-then-redact, or evaluating retrieval while logged in as an admin.
  2. 15. Someone plants instructions inside a document in your corpus. What stops the model from following them?

    Sample answer

    No prompt reliably stops it, so I limit what a successful injection can do. This is indirect prompt injection: whoever can write to the corpus can, in effect, prompt the model. I fence retrieved text, label its source, and tell the model to treat it as data. That reduces accidents but won't stop a deliberate attack.

    The real controls sit downstream. If generation has tools, they're least-privilege, and anything that sends, pays or deletes needs a human confirmation showing the exact action. I validate output before rendering: no auto-fetched images or links to hosts outside an allowlist, because a markdown image URL can carry data out with no tool call at all. For high-risk sources, a reader model with no tools can turn raw documents into structured summaries for an actor that never sees the raw text.

    What they’re checking:
    Whether you know prompt-level defenses only reduce frequency and that containment comes from architecture.
    Likely follow-up:
    Walk me through how a markdown image could leak data from a RAG chat.
    Avoid:
    "We sanitize inputs" or "the system prompt says to ignore instructions in documents" as the whole defense.
  3. 16. Where would you add caching in a RAG pipeline, and what could go wrong?

    What they’re checking:
    Whether you think about cache keys and invalidation as correctness and security problems.
    Likely follow-up:
    How do you invalidate cached answers when the corpus is re-indexed?
    Model answer and the mistake to avoid: in the free PDF

How to prepare

  • Build the smallest RAG loop yourself (a few documents, brute-force search, one prompt with citations and an abstention rule) and test it with three probes: a question the corpus answers, one it doesn’t, and one that needs two passages.
  • Label 30 to 50 real-looking queries with their correct chunks and compute Recall@5 and MRR by hand once. Being able to say what each number means, and what it misses, carries a lot of these questions.
  • Practice the failure walk out loud: corpus, chunk, index, query phrasing, filters, rank, context budget. Most “your bot gave a wrong answer” questions are testing whether you start by reading the retrieved passages.
  • Prepare one story about a tradeoff you’d make differently at scale (long context vs RAG, chunk size, reranker latency) with the numbers you’d look at.
  • Pair this page with the LLM evaluation questions and the AI system design guide, where RAG usually shows up as one component of a larger design.

More interview questions