RAG is the most common GenAI pattern in Indian companies right now, from banks answering policy questions to edtech startups building doubt-solving bots. That is why RAG interview questions show up in almost every AI engineer loop.
This page has 28 RAG interview questions with model answers, grouped from basic pipeline questions to experienced-level design and scenario rounds. If you need a refresher on what RAG is, start with how RAG works and the basic set in our generative AI interview questions. Here we go deeper.
I will be honest about one thing: most RAG interviews are really debugging interviews. The interviewer wants to know whether you can tell a retrieval failure from a generation failure, and fix the right one. Use the Save as PDF button above to keep a copy for revision.
What do RAG interviews test?
RAG interviews test whether you can get the right information in front of the model and prove that the final answer is faithful to it.
| Area | Typical questions | Level |
|---|---|---|
| Pipeline basics | Steps of RAG, chunking, embeddings, similarity search | Freshers |
| Retrieval quality | Hybrid search, reranking, query rewriting, metadata filters | Intermediate |
| Evaluation | Recall at k, faithfulness, answer relevance, test sets | Experienced |
| Production | Index freshness, access control, cost, latency | Experienced |
| Scenarios | "The bot cannot find answers that exist", "design RAG for X" | Final rounds |
Coding rounds often ask you to build a tiny RAG pipeline in Python in 45 to 60 minutes, so practise doing it once without looking things up.
How to prepare for a RAG interview
The fastest way to prepare is to build one RAG system, break it on purpose and measure the fixes.
- Revise the concepts. Read embeddings, vector databases and RAG vs fine-tuning until you can explain each in two lines.
- Build a baseline. Pick real documents, such as your university's academic regulations or a bank's public FAQ pages, and build a simple pipeline with fixed-size chunks.
- Create a test set. Write 30 questions with the correct source passage for each. This one step puts you ahead of most candidates.
- Improve one thing at a time. Try different chunk sizes, add keyword search, add a reranker. Record recall and answer accuracy after each change.
- Practise out loud. Answer the questions below in about 60 seconds each and turn your experiments into two interview stories.
RAG interview questions for freshers
Expect these in a first technical round. Keep each answer structured and add one concrete example.
1. Explain the RAG pipeline step by step.
EasyA RAG pipeline has two phases. In indexing, you load documents, split them into chunks, convert each chunk into an embedding and store it in a vector index with metadata. At query time, you embed the user's question, retrieve the most similar chunks, insert them into the prompt with instructions, and let the LLM generate an answer grounded in that context, ideally with citations. Most real systems add steps such as query rewriting and reranking between retrieval and generation.
Interviewer tip: Draw the two phases on the whiteboard. Interviewers remember diagrams.
2. Why not put all your documents into the context window instead of using RAG?
EasyBecause most document sets are far larger than any context window, and even when they fit, sending everything on every request is slow and expensive. Models also use very long contexts unevenly and can miss details buried in the middle. RAG sends only the few passages that matter, which keeps cost and latency low and makes answers easier to cite. For a small, fixed document set, stuffing the full text into the context window can be a sensible shortcut.
3. What is chunking, and how do you choose a chunk size?
EasyChunking splits documents into smaller passages that can be embedded and retrieved individually. Chunk size is a trade-off: small chunks are precise but may lose context, while large chunks keep context but dilute the embedding and waste prompt space. Many teams start around a few hundred tokens with some overlap, then tune using a test set. The right size depends on the content: FAQ answers suit small chunks, legal clauses and technical manuals often need larger ones.
4. What chunking strategies do you know?
MediumCommon strategies are fixed-size chunks with overlap, recursive splitting that respects paragraphs and sentences, structure-based splitting by headings or sections, and semantic chunking that splits where the topic changes. A useful advanced pattern is parent-child (small-to-big) retrieval: search over small chunks for precision, then send the larger parent section to the model for context. For PDFs with tables, keep each table intact as its own chunk rather than cutting it in half.
5. How do you choose an embedding model for RAG?
MediumChoose by measured retrieval quality on your own data, not by popularity. Check language support (important if users write in Hindi or Hinglish), the maximum input length, vector dimension (which affects storage and speed), cost or hosting needs, and whether the model handles your domain vocabulary. Public leaderboards give a shortlist, but run a quick recall test on 30 to 50 of your own questions. Always use the same model for documents and queries. See embeddings.
6. What similarity metrics are used in vector search?
EasyThe common ones are cosine similarity, dot product and Euclidean distance. Cosine similarity compares the direction of two vectors and ignores length, which suits most text embeddings. When vectors are normalised to unit length, cosine, dot product and Euclidean distance all produce the same ranking, so the choice mostly matters for unnormalised vectors. Use the metric the embedding model was trained with, which its documentation usually states.
7. What does top-k mean in retrieval, and how do you pick k?
EasyTop-k is the number of chunks the retriever returns for each query. A small k keeps the prompt short and focused but risks missing the answer; a large k improves recall but adds noise, cost and latency. A common pattern is to retrieve a larger set, say 20 to 50, then rerank and send only the best 3 to 8 to the model. Pick the final k by measuring answer accuracy on a test set at a few values.
RAG interview questions and answers: retrieval, hybrid search and reranking
1. How does approximate nearest neighbour search work, and what is HNSW?
MediumApproximate nearest neighbour (ANN) search finds vectors that are very likely the closest to a query without comparing against every vector, trading a little accuracy for large speed gains. HNSW (Hierarchical Navigable Small World) builds a layered graph where upper layers have few long-range links and lower layers have dense local links; search starts at the top and greedily moves closer layer by layer. Other approaches include IVF, which clusters vectors and searches only the nearest clusters. More in vector databases.
2. What is hybrid search, and why combine keyword and vector search?
MediumHybrid search runs keyword search (usually BM25) and vector search together and merges the results. Vector search understands meaning and paraphrases, while keyword search is better at exact terms like product codes, error IDs, names and rare jargon. A common way to merge is reciprocal rank fusion, which scores each document by its rank in each list, so you do not need to normalise very different score scales. Hybrid search is often the cheapest big improvement to a weak RAG system.
Interviewer tip: If your data has IDs like policy numbers or PNRs, mention hybrid search before they ask.
3. What is reranking, and why use a cross-encoder?
MediumReranking takes the top results from the first retrieval stage and reorders them with a more accurate model. Embedding retrievers are bi-encoders: they encode query and document separately, which is fast but loses fine detail. A cross-encoder reads the query and document together and scores their relevance directly, which is more accurate but too slow to run over the whole corpus. So you retrieve broadly and cheaply, then rerank a short list. The cost is added latency per query.
4. What is query rewriting in RAG?
MediumQuery rewriting uses an LLM to turn the user's raw question into better search queries before retrieval. Examples include fixing vague or misspelt queries, generating several variants (multi-query), splitting a complex question into sub-questions, and HyDE, where the model writes a hypothetical answer and you embed that instead. In chatbots, it also turns follow-ups like "what about the second one?" into standalone queries. The trade-off is an extra model call, which adds cost and latency.
5. How does metadata filtering improve retrieval?
MediumMetadata filtering restricts search to chunks that match structured attributes such as document type, date, product, region, language or user permission. It removes whole categories of wrong answers, for example retrieving a 2022 leave policy when only the current one is valid. Filters can apply before the vector search or after it; pre-filtering is usually more accurate but can be slower in some vector stores. Plan your metadata during ingestion, because adding it later means re-indexing.
6. How do you handle PDFs, tables and scanned documents in RAG?
MediumParsing quality decides retrieval quality, so treat it as a first-class step. Use a layout-aware parser for PDFs so headings, columns and tables are preserved, and run OCR on scanned pages. Convert tables to a clean text or markdown form and keep each table in one chunk with its caption. Spot-check parsed output manually, because broken text from multi-column layouts is a very common hidden cause of bad answers in Indian government and banking PDFs.
7. How do you add reliable citations to RAG answers?
MediumGive each retrieved chunk an ID and source metadata (document name, page, section), include those IDs in the prompt, and instruct the model to cite the IDs it used for each claim. Then verify in code that every cited ID was actually retrieved and drop or flag answers with missing or invalid citations. Citations build user trust and make debugging much faster. The limitation is that a citation shows where text came from, not that the model used it faithfully.
8. What is the lost in the middle problem, and how does it affect RAG?
MediumLost in the middle refers to research showing that LLMs use information at the start and end of a long context more reliably than information in the middle. In RAG, this means stuffing 20 chunks into the prompt can hide the one that matters. Mitigations: send fewer, better chunks after reranking, place the most relevant chunks first or last, and remove near-duplicates. It is another reason more context is not automatically better.
RAG interview questions for experienced engineers
These test production experience: evaluation, freshness, cost and newer RAG patterns.
1. How do you evaluate a RAG system?
HardEvaluate retrieval and generation separately. For retrieval, build a test set of questions with known relevant passages and measure recall at k, precision at k and ranking metrics such as MRR or nDCG. For generation, measure faithfulness (is every claim supported by the retrieved context?), answer relevance (does it address the question?) and correctness against reference answers. Open-source frameworks such as Ragas automate some of these with LLM judges. Validate the automated scores against human review on a sample.
Interviewer tip: Saying "I evaluate retrieval and generation separately" is the strongest opening line here.
2. What is the difference between faithfulness and answer relevance?
HardFaithfulness checks whether the answer is supported by the retrieved context, with no invented claims. Answer relevance checks whether the answer actually addresses the user's question. They fail independently: an answer can be perfectly faithful to the context but answer a different question, or relevant and fluent but partly made up. Tracking both tells you whether to fix grounding or fix retrieval and prompting. Low faithfulness is a hallucination signal.
3. What is agentic RAG?
HardAgentic RAG lets an LLM agent decide how to retrieve instead of following one fixed search step. The agent can choose which source or tool to query, rewrite the query, retrieve again if results look weak, and combine answers from several searches for multi-step questions. It handles complex questions better than single-shot RAG, but adds latency, cost and new failure modes such as loops. Use it when questions genuinely need multiple hops. See our agentic AI interview questions.
4. What is graph-based RAG (GraphRAG), and when does it help?
HardGraph-based RAG builds a knowledge graph of entities and relationships from your documents, often with an LLM doing the extraction, and retrieves over that graph instead of, or alongside, text chunks. It helps with questions that connect facts across many documents, such as "which suppliers are linked to delayed projects?", and with broad questions about themes in a whole collection. The trade-off is a much more expensive and complex indexing step, so start with standard RAG and add a graph only when you see these question types failing.
5. How do you keep a RAG index fresh when documents change?
HardGive every document a stable ID and a content hash, and run incremental ingestion: re-chunk and re-embed only documents whose hash changed, and delete chunks of removed documents. Store timestamps and version metadata so you can filter out superseded content. Schedule regular syncs from the source systems, and monitor for stale answers. If you change the embedding model, you must re-embed the entire corpus, because vectors from different models are not comparable.
6. How do you reduce the cost and latency of a RAG system?
HardCut tokens first: send fewer, reranked chunks and trim boilerplate from them. Cache embeddings for repeated queries and cache final answers for frequent questions. Use a smaller, cheaper model for query rewriting and a larger one only for the final answer, or skip rewriting when the query is already clear. Tune the vector index for speed, stream the answer and run retrieval steps in parallel where possible. Measure cost per correct answer, not cost per query.
7. When is RAG the wrong choice?
MediumRAG is the wrong choice when the problem is behaviour rather than knowledge, such as a fixed output style or a classification task, where prompting or fine-tuning fits better. It is also a poor fit for questions that need aggregations over structured data, like "total sales by state last quarter", which should go to SQL instead. And for a small, stable document set, putting the whole text in the prompt may be simpler. Good candidates know when not to build the pipeline.
Scenario-based RAG interview questions
Use this structure: confirm the symptom, isolate retrieval or generation, fix, then measure.
1. Users say the bot cannot find answers that are definitely in the documents. How do you debug it?
HardTreat it as a retrieval failure until proven otherwise. Take the failing questions and check whether the correct passage was even indexed: parsing errors and skipped files are common. Then check whether it was retrieved in the top 50; if yes but not in the final top 5, add or tune a reranker. If not retrieved at all, look at chunking, try hybrid search and query rewriting, and test a different embedding model. Add every failing question to your test set.
Interviewer tip: Start with "Was it indexed? Was it retrieved? Was it used?" It shows a clear debugging order.
2. Searches for exact product codes and order IDs return the wrong results. What do you change?
MediumExact identifiers are a known weakness of pure vector search, because embeddings capture meaning, not exact strings. Add keyword search with BM25 and combine it with vector results through hybrid search. Also extract IDs into metadata fields during ingestion, so you can filter directly when the query contains a recognisable code pattern. Measure the fix with a set of ID-based test queries.
3. Design a RAG assistant over 10,000 HR policy PDFs in English and Hindi for an Indian company.
HardClarify users, languages and permissions first. Ingest with a layout-aware parser plus OCR, chunk by policy section, and tag metadata: policy type, effective date, location, language and access level. Use a multilingual embedding model, hybrid search and a reranker. Answer in the user's language with citations, and say "I could not find this" when retrieval is weak. Enforce document permissions at retrieval time, and evaluate with a bilingual test set reviewed by HR.
4. Answer quality dropped right after you switched to a new embedding model. What happened?
MediumThe most likely cause is that the index still contains vectors from the old model while queries use the new one, or the index was only partly re-embedded. Vectors from different models live in different spaces and cannot be compared. Re-embed the full corpus, then rerun your retrieval test set to confirm the new model is actually better on your data. Next time, build the new index in parallel and switch only after it passes evaluation.
5. The bot confidently answers questions that are not covered in the documents. How do you stop it?
MediumInstruct the model to answer only from the provided context and to reply with a clear fallback when the context does not contain the answer. Add a relevance threshold so that if the best retrieved chunks score too low, you skip generation and return the fallback. A faithfulness check after generation can catch unsupported claims. Test with a set of deliberately out-of-scope questions and track how often the bot correctly refuses.
6. A sales employee received salary details from an HR document through the bot. What went wrong?
HardAccess control was missing at retrieval time. The bot searched every document regardless of who was asking. Fix it by storing permission metadata, such as allowed groups, with every chunk and filtering on the user's permissions before or during retrieval, never after generation. Also treat retrieved documents as untrusted input, since hidden instructions inside them can cause prompt injection. Audit logs and a security review before launch are standard practice.
Common mistakes in RAG interviews
The biggest mistake is jumping to the prompt or the model when the problem is retrieval.
- No evaluation story. "It worked well" is weak. "Recall at 5 went from 58% to 84% after adding hybrid search on our 40-question test set" is strong.
- Ignoring parsing. Many candidates never look at their parsed chunks. Interviewers who have built RAG know that is where half the bugs hide.
- Treating the vector database as the hard part. Choosing a vector store matters far less than chunking, retrieval quality and evaluation.
- Forgetting permissions. Enterprise RAG without access control is a data leak waiting to happen.
My contrarian tip: do not start with a framework. Build your first pipeline in plain Python with a simple vector index. You will understand every step, and you will answer "how does it work under the hood?" without hesitating.
Your interview prep checklist
- Draw the RAG pipeline: indexing phase and query phase.
- Explain three chunking strategies and when each fits.
- Explain hybrid search, reranking and query rewriting in two lines each.
- Build a 30-question test set and measure recall at k for your project.
- Prepare a debugging answer that separates retrieval from generation.
- Know how to enforce document permissions in retrieval.