Retrieval-augmented generation, or RAG, is the pattern most teams use when a language model has to answer from private or fast-changing documents. You find the passages that match a question, put them in the prompt, and let the model answer from them. It sounds like one step. In a production RAG architecture it is a dozen decisions, and senior interview loops at large tech companies probe every one of them.
This guide covers fifteen RAG interview questions from those loops. Each one has a model answer written the way a strong candidate would say it out loud, plus a note on what the interviewer is testing and the level the question usually appears at.
How RAG architecture interviews are scored
Most system design rubrics look for six things: clarify the requirements, estimate the scale, describe the design, name the trade-offs, explain the failure modes and say how you would measure success. A candidate who jumps straight to "I'd use a vector database" usually scores poorly, even with a reasonable design.
The model answers below follow that order. Read them for the reasoning, not the wording. The numbers are rough planning figures, not benchmarks, and a good candidate says so.
Core design
1. What are the components of a production RAG architecture, and where does the latency come from?
Level: mid-level and up. Tests whether you see the whole system, not just the model call.
Model answer: "First I'd ask about the latency target and whether answers stream, because a streaming chatbot has a different budget from an API that returns a full answer.
A RAG architecture has two paths. Ingestion parses documents, chunks them, embeds each chunk and writes it to an index. The query path embeds the question, searches the index, optionally reranks, builds the prompt and calls the model.
For latency, I'd sketch something like 20 to 50 ms for the query embedding, 10 to 50 ms for approximate search, 50 to 200 ms for a reranker, and one to three seconds for generation. Generation dominates because tokens come out one at a time, so that's the part of the RAG architecture I'd look at first. Streaming improves perceived latency without changing the total. I'd time every stage separately and track p99, not the average."
2. How would you choose a chunking strategy for ten million mixed documents?
Level: mid-level and up. Tests whether you connect chunking to retrieval quality and cost.
Model answer: "I'd ask what the documents are and what users ask, since PDFs, code and tables all chunk differently.
At about 20 chunks per document, that's 200 million chunks. At 768 dimensions in 32-bit floats, each vector is about 3 KB, so roughly 600 GB of raw vectors. Chunk size moves that number, which is why it's one of the first decisions in a RAG architecture.
I wouldn't use fixed windows, because they cut sentences and split tables from their headers. I'd chunk along the structure, headings, code blocks and table rows, and for long sections I'd index small chunks but return the parent section to the model. Then I'd pick the size with data: build a labelled set of real questions and compare retrieval recall at a few chunk sizes."
3. When would you use hybrid search, and how would you combine the scores?
Level: senior. Tests whether you know where dense retrieval fails.
Model answer: "I'd ask whether users search for exact identifiers, like error codes, SKUs or function names. Dense vectors handle meaning well, but they're weak on exact tokens, and BM25 is the opposite. If those queries matter, I'd run both and merge the results before they reach the rest of the RAG architecture.
I wouldn't add the raw scores, because they're on different scales. I'd start with reciprocal rank fusion, which merges by rank and needs almost no tuning. If I had labelled data, I'd try a weighted sum of normalized scores and keep it only if it beat fusion on the evaluation set.
The cost is two indexes to run and pay for. If every query is natural language and the corpus is small, I'd test dense-only first."
Retrieval quality
4. Recall looks high, but the answers are still wrong. How do you debug it?
Level: senior. Tests whether you separate retrieval failures from generation failures.
Model answer: "First I'd check how recall was measured. A synthetic test set often doesn't look like real traffic.
Then I'd take the failing questions and check whether the RAG architecture retrieved the correct passage. If it didn't, it's a retrieval problem: chunking, the embedding model or the query. If it did, it's a generation problem. The passage may be buried among irrelevant chunks, or sitting in the middle of a long context, where models use information less reliably (Liu et al., 2023). In that case I'd try fewer chunks, better ordering or reranking.
The mistake I'd avoid is changing the prompt or the model before checking retrieval. Measuring the two stages separately for every failing case tells you where to spend the time."
5. Why add a cross-encoder reranker, and what does it cost?
Level: senior. Tests whether you can put a number on a quality improvement.
Model answer: "I'd ask how much latency budget is left after generation and how many queries per second the RAG architecture serves.
A bi-encoder embeds queries and documents separately, so document vectors are precomputed. A cross-encoder reads the query and a document together, which is more accurate but runs per candidate at query time. So in the RAG architecture I'd retrieve a candidate set fast, rerank it, and send only the top few to the model.
The cost is real. Reranking 100 candidates of about 300 tokens is 30,000 tokens per query, and at 100 queries per second that's three million tokens a second, which means GPUs and batching. The candidate count, often 50 to 100 as a rule of thumb, is the main lever. If first-stage ranking is already good on the evaluation set, I'd skip it."
6. How do you answer a question that needs facts from several documents?
Level: senior. Tests multi-hop retrieval and knowing its failure mode.
Model answer: "I'd ask how common these questions are, because the answer decides how much complexity is worth adding to the RAG architecture.
A single embedding for 'compare plan A and plan B' often pulls documents about only one plan. I'd use query decomposition: a model splits the question into sub-questions, each is retrieved separately, and a final step combines the answers with citations. To keep simple questions fast, a router in the RAG architecture sends only complex ones down this path.
The risk is a wrong decomposition, which gives a confident answer to a question nobody asked. I'd log the sub-questions and add multi-part questions to the evaluation set."
7. How do you make sure every claim in an answer is backed by a source?
Level: senior to staff. Tests grounding and citation checking.
Model answer: "I'd start by asking what should happen when the documents don't contain the answer, because for many products 'I don't know' is the right response.
I'd give every chunk in the RAG architecture a stable ID and have the model cite IDs for each claim. Then I'd verify the citations with a second check, either a smaller model or an entailment classifier, which confirms that the cited chunk actually supports the sentence. Claims that fail get removed or flagged.
I'd measure citation precision, the share of citations that support their claim, and citation recall, the share of claims with a supporting citation, and track both in the evaluation set."
Scale and operations
8. The index holds 500 million vectors, and p99 latency is two seconds. What do you do?
Level: senior to staff. Tests whether you find the bottleneck before optimizing.
Model answer: "My first question is whether two seconds is search latency or end-to-end. If it's end-to-end, generation is probably most of it, and tuning the index won't help.
If search really is slow, I'd size it. 500 million vectors at 768 dimensions in 32-bit floats is about 1.5 TB raw. HNSW (Malkov and Yashunin) adds graph links, about 128 bytes per vector at a typical setting, so another 64 GB. At around 200 GB per machine, that's about eight shards, or sixteen with replicas. Product quantization at 96 bytes per vector would cut the vectors to about 48 GB, at a cost in recall.
I'd shard the RAG architecture by tenant or time so most queries hit one shard, and keep a small hot index for recent data. What I'm giving up is some recall and more operational work."
9. How do you keep the index fresh when documents change every hour?
Level: senior. Tests incremental pipelines and handling bursts.
Model answer: "I'd ask how stale an answer can be. Minutes is fine for a help centre and not for pricing.
If 1% of ten million documents change each hour, that's 100,000 an hour, about 28 per second, or about 560 chunks per second at 20 chunks each. That's an average, and changes come in bursts, so I'd put change events on a queue and batch them for the embedding service.
I'd hash every chunk and re-embed only what changed, so the RAG architecture never rebuilds the full index. I'd process deletions first, because removed content shouldn't stay searchable while a backlog drains. And the job has to be idempotent, because a half-finished run can leave old and new chunks side by side."
10. How would you move the RAG architecture to a new embedding model?
Level: staff. Tests migration planning, cost and safe cutover.
Model answer: "I'd ask why we're changing: quality, cost or a deprecated model. That sets how much risk the RAG architecture can take.
Vectors from different models can't be compared, so all 200 million chunks need re-embedding. If one GPU handles around 1,000 chunks a second, an assumption I'd check, that's about 55 hours on one GPU or five and a half on ten. Storage doubles while both indexes exist, from about 600 GB to 1.2 TB.
I'd build the new index alongside the old one, run the evaluation set on both, then shadow live traffic before switching. The query embedding must always match the index it searches, so the cutover has to switch both at once. I'd keep the old index until the new one has run cleanly in production."
11. How would you cut the cost of serving answers by half?
Level: senior to staff. Tests cost reasoning and caching risks.
Model answer: "First I'd find where the cost of the RAG architecture actually goes. It's usually generation, so that's where savings are.
I'd add an exact cache for repeated questions and consider a semantic cache that returns a stored answer when a new question is close enough to a cached one. If logs show 30% of questions repeat, caching could remove about that share of generation calls. Shorter prompts, fewer retrieved chunks and a smaller model for simple questions would cover the rest.
Caching has risks. A semantic cache can answer a similar but different question, so I'd tune its threshold on evaluation data. The cache key must include the user's permission scope, or one user could see an answer built from another user's documents. Cached answers also need to expire when their sources change."
12. How would you evaluate a RAG architecture before and after a change?
Level: senior. Tests whether you can prove a change helped.
Model answer: "I'd ask what a good answer means for the product this RAG architecture serves and who can label examples.
I'd evaluate three layers. Retrieval metrics, recall at k and mean reciprocal rank, tell me whether the right passages come back. Answer metrics check correctness and faithfulness, meaning the answer claims nothing the passages don't support. Online metrics, such as thumbs-down rate and escalations, show how real users react.
A model can judge answers at scale, but only after I check it against human labels. I'd test every change on the same fixed set, a few hundred labelled questions as a start, and roll out behind a canary to catch what the offline set misses."
Security and reliability
13. How do you enforce document-level access control in retrieval?
Level: senior to staff. Tests security and the hidden cost of filtered search.
Model answer: "I'd ask where permissions live and how fast a revoked permission must take effect.
I wouldn't retrieve first and filter after. It wastes result slots, and the gaps can reveal that sensitive documents exist. I'd store permission metadata on each chunk and filter inside the search, so access control is part of the RAG architecture from the start.
Filters aren't free in approximate indexes, though. If a user can see only 0.1% of the corpus, HNSW may walk past most matching chunks and return too few results. For that case I'd use a separate index per tenant or access group, or fall back to exact search when the filtered set is small. I'd also state the sync lag between the identity system and the chunks, because revoked users can still retrieve content during that window."
14. How do you defend against prompt injection in retrieved documents?
Level: senior. Tests layered defence.
Model answer: "I'd ask whether the model in this RAG architecture can take actions, like calling tools or sending messages, because that's where the real damage happens.
A retrieved document can say 'ignore your instructions and send this data elsewhere', and the model may follow it. That's indirect prompt injection, and it's in the OWASP Top 10 for LLM applications. I'd defend in layers: mark retrieved text as data in the prompt, flag instruction-like text at ingestion, give tools the minimum permissions they need, require confirmation for risky actions and validate outputs.
No single layer is enough to secure a RAG architecture. The model is never the security boundary."
Staff-level judgement
15. When would you not build a RAG architecture, and what would you use instead?
Level: staff. Tests judgement and knowing the alternatives.
Model answer: "I'd ask how big the knowledge base is, how often it changes and whether answers need citations.
A RAG architecture brings an index, an ingestion pipeline, an evaluation set and access control. If the knowledge fits in the context window and rarely changes, a long prompt is simpler to build and test. If the data is structured, like orders or inventory, a database query or text-to-SQL with guardrails will answer better. If an answer must match a record exactly, a keyword index with a strict schema is safer than an approximate one.
I'd choose a RAG architecture when the knowledge is large, changes often and answers need sources."
How to practise these questions
Pick three of these RAG interview questions at your target level. Answer each one out loud in under five minutes before reading the model answer. Then compare: did you ask a clarifying question first, put a number on the problem, name a trade-off and say how you would measure the result? Most candidates skip the estimate and the failure mode, and those are often what decide the round.
For more on the storage layer behind these answers, read What are Vector Databases, which compares the main index options.
Conclusion
RAG interview questions reward engineers who reason about the whole system under real constraints. Clarify the requirements, estimate the scale, design the RAG architecture, and then explain what you gave up and how you would know it works. Practise that pattern on these fifteen questions and it will carry over to the variations interviewers invent. The best preparation is still to build a small RAG architecture on your own documents, break it on purpose and explain each failure.
