Modern AI Engineering

RAG Interview Questions: 25 Questions with Answers (2026)

By Modern AI Engineering · · 14 min read

Retrieval-augmented generation (RAG) comes up in almost every AI engineer interview, because nearly every company building with LLMs has a RAG system somewhere. This list covers what interviewers actually ask, from basics to system design, with the key idea behind each answer.

In short: interviewers test four things. Do you understand the pipeline (index, retrieve, generate)? Can you make retrieval good (chunking, hybrid search, reranking)? Can you measure it (retrieval and answer metrics)? Can you debug and design it at scale? Answer with trade-offs and numbers, not buzzwords.

Part 1: RAG fundamentals

  • 1. What is RAG, and why use it? RAG retrieves relevant documents at question time and puts them into the prompt so the model answers from them. It adds knowledge the model was never trained on, keeps answers current without retraining, reduces made-up answers and makes citations possible.
  • 2. Walk me through a RAG pipeline. Offline: load documents, clean, split into chunks, embed each chunk, store vectors and metadata in an index. Online: embed the question, retrieve the top k chunks, optionally rerank, build a prompt with instructions, chunks and the question, generate, and return the answer with citations.
  • 3. RAG vs fine-tuning: when do you choose each? RAG adds knowledge that changes or must be cited. Fine-tuning changes behaviour: format, tone, a narrow skill. Facts that update weekly belong in RAG; a consistent output style might justify fine-tuning. Many systems use both.
  • 4. With million-token context windows, why not skip RAG and send everything? Cost and latency grow with input tokens on every request, models attend less reliably to facts buried in very long contexts, and most corpora are far larger than any window. Long context and RAG combine well: retrieve a focused set, then use the window to include more of it.
  • 5. What is an embedding? A vector of numbers that represents meaning, so similar texts land close together. Similarity is usually measured with cosine similarity or dot product.

Part 2: Chunking and indexing

  • 6. How do you choose a chunk size? Small chunks are precise but lose context; large chunks keep context but dilute relevance and cost more tokens. Start around a few hundred tokens with some overlap, then tune by measuring retrieval recall on real questions.
  • 7. What chunking strategies do you know? Fixed size with overlap; recursive splitting on structure (headings, paragraphs, sentences); document-aware splitting (Markdown sections, code by function, tables kept whole); semantic chunking where meaning shifts; and parent-child chunking, which retrieves small chunks but sends their larger parent section to the model.
  • 8. Why store metadata with each chunk? For filtering (product, date, language, permission), for citations (source, page, URL) and for freshness. Metadata filters often fix "wrong version of the document" bugs better than any embedding change.
  • 9. How do you handle documents that change? Give each document a stable ID and a content hash. On change, re-chunk and re-embed only that document, delete its old chunks, and record the index version and last sync time.
  • 10. How do you enforce access control? Filter at retrieval time using the user's permissions stored as chunk metadata, before anything reaches the prompt. Never rely on the LLM to hide content it has already been given.

Part 3: Retrieval quality

  • 11. What is hybrid search, and why use it? It combines dense vector search, good at meaning and paraphrase, with keyword search such as BM25, good at exact terms, IDs, error codes and product names. Results are merged, often with reciprocal rank fusion. It is one of the cheapest big wins in RAG.
  • 12. What does a reranker do? A cross-encoder reads the question and each candidate chunk together and scores relevance more accurately than vector similarity. A typical pattern: retrieve 50 candidates cheaply, rerank, keep the top 5.
  • 13. How does approximate nearest neighbour search work, and what is HNSW? Exact search compares the query with every vector, which is too slow at scale. ANN trades a little recall for large speed gains. HNSW builds a layered graph of vectors and walks it greedily from coarse to fine layers; its settings trade recall against speed and memory.
  • 14. What is query rewriting? Using an LLM to turn the user's question into better search queries: expanding abbreviations, resolving "it" from chat history, splitting multi-part questions, or generating several queries and merging the results. HyDE is a variant that embeds a hypothetical answer instead of the question.
  • 15. A question needs facts from three documents. How do you handle it? Decompose it into sub-questions, retrieve for each, then combine. For truly multi-step questions, an agentic loop that retrieves, reads and decides whether to retrieve again works better than one retrieval pass.

Part 4: Generation and evaluation

  • 16. How do you reduce hallucinations in RAG? Instruct the model to answer only from the provided context and to say when the answer is not there, require citations to chunk IDs, improve retrieval so the right chunk is actually present, and test faithfulness with an evaluation set. Most hallucinations in RAG are retrieval failures.
  • 17. How do you evaluate a RAG system? Evaluate the two halves separately. Retrieval: recall@k, precision and MRR. Generation: faithfulness (is every claim supported by the context?), answer relevance and correctness against a reference. Run a fixed test set of real questions with known source passages on every change.
  • 18. Can you use an LLM as a judge? Yes, for scale, but calibrate it: compare its scores with human labels on a sample, give it clear rubrics, and watch for bias toward longer or more confident answers. Keep a human-reviewed subset.
  • 19. The answer is wrong. How do you debug it? Trace one request stage by stage: was the right document indexed, was it chunked sensibly, did retrieval return it in the top k, did the reranker keep it, was it in the final prompt, and did the model ignore or misread it? Locate the stage first, because each has a different fix.
  • 20. What are the most common RAG failure modes? Missing content in the index, chunk boundaries that split the answer, exact terms missed by pure vector search, stale or duplicate documents, too many irrelevant chunks drowning the right one, and the model answering from its own memory instead of the context.

Part 5: Production and system design

  • 21. How do you reduce RAG latency and cost? Cache embeddings and frequent answers, use a smaller embedding model, send fewer but better chunks via reranking, stream the response, put fixed instructions first so prompt prefix caching works, and route easy questions to a smaller model.
  • 22. How do you choose an embedding model? Test candidates on your own question set and measure recall@k; leaderboards are only a starting point. Consider languages, domain, vector size, context length and whether you can self-host. Changing models later means re-embedding everything, so version your index.
  • 23. Do you always need a vector database? No. For tens of thousands of chunks, a vector extension on your existing Postgres or an in-memory index is often enough. Dedicated vector databases earn their place with large scale, heavy filtering or high query volume.
  • 24. What is agentic RAG? An agent decides when and what to retrieve, can query several sources or tools, checks whether the results answer the question, and retrieves again if not. It handles complex questions better but costs more latency and needs stricter evaluation.

25. Design a RAG assistant for 10 million documents with per-team permissions

State your assumptions first: queries per second, latency target, how fresh answers must be. Interviewers care about trade-offs more than a perfect diagram. A strong answer covers five parts:

  1. Ingestion: connectors per source, incremental sync with content hashes, document-aware chunking, permission metadata on every chunk.
  2. Index: hybrid vector plus BM25 search, sharded, with metadata filters applied inside the search.
  3. Query path: query rewriting with chat history, permission-filtered hybrid retrieval of about 50 chunks, reranking to about 5, a prompt with citations, a streamed answer.
  4. Evaluation: an offline test set per team, online feedback, and tracing of every stage.
  5. Operations: a latency budget per stage, caching, freshness monitoring, and a re-embedding plan for model upgrades.

How to prepare in one week

Numbers from your own project, such as "reranking lifted recall@5 from 0.62 to 0.81", are the most convincing thing you can say in an interview.

  • Days 1–2: build a small RAG app over documents you know, and write 30 test questions with known answers.
  • Days 3–4: add hybrid search and a reranker; measure recall@5 before and after.
  • Day 5: break it on purpose (bad chunking, stale documents) and practise the debugging trace from question 19.
  • Days 6–7: practise question 25 out loud, with a timer, twice.

Frequently asked questions

What RAG topics are asked most in AI engineer interviews?

Chunking strategy, hybrid search, reranking, evaluation metrics, reducing hallucinations, and a RAG system design question.

Do I need to know LangChain or LlamaIndex for a RAG interview?

It helps to have used one, but interviewers care more about the ideas underneath. You should be able to build the pipeline without a framework and explain each step.

How should I answer RAG system design questions?

Clarify scale and requirements, then walk through ingestion, indexing, the query path and evaluation, explaining the trade-off behind each choice.

Learn it properly: the AI Engineering Bootcamp

More articles