RAG (retrieval-augmented generation) interview questions and answers

RAG interview questions test whether you can build a system that finds the right passages and makes a language model answer from them, then prove it works. Expect chunking choices, embeddings and vector indexes, hybrid search and reranking, metadata filters and access control, retrieval metrics such as recall at k, faithfulness checks, stale documents and prompt injection, plus a design question such as a support bot over thousands of help articles.

By Published 6 min read

Why RAG gets its own interview questions

Retrieval-augmented generation is the most common pattern for putting a language model on top of a company's own data, so AI engineer and applied ML loops often spend a whole round on it. The questions are part search engineering, part LLM behavior and part data plumbing. Interviewers want to hear you split problems into retrieval failures and generation failures, and measure both. For the model side itself, see large language model interview questions.

  1. Ingest (offline)
    • Load and clean
    • Chunk
    • Embed
    • Index with metadata
  2. Retrieve
    • Rewrite query
    • Keyword search
    • Vector search
    • Fuse and rerank
    • Permission filter
  3. Generate
    • Build prompt
    • Answer with citations
    • Log for evaluation
A typical RAG pipeline. Offline, documents are loaded, cleaned, split into chunks, embedded and stored in an index with metadata. At query time, the question may be rewritten, then keyword and vector search run, results are fused and reranked, filtered by permissions, and the top passages go into the prompt so the model answers with citations.

RAG fundamentals questions

Fundamentals for freshers and first screens
QuestionWhat it testsWhat a strong answer shows
What problem does RAG solve?PurposeA model only knows its training data, which is dated and excludes private documents. RAG fetches relevant text at question time and puts it in the prompt, so answers can be current, specific and traceable to a source.
RAG or fine-tuning for company knowledge?Trade-offRAG for facts that change or must be cited, with access control per document. Fine-tuning for behavior, tone or format. Many systems use both: a tuned model that is good at answering from retrieved context.
What is an embedding?RepresentationsA dense vector produced by a model so that texts with similar meaning land close together. Retrieval compares the query's vector with chunk vectors, usually by cosine similarity or dot product.
Why split documents into chunks?ChunkingWhole documents are too long to embed well or to fit many into a prompt. Chunks let you retrieve only the relevant part, but a chunk must still carry enough context to make sense alone.
How do you pick chunk size and overlap?TuningStart from the document structure (sections, paragraphs, FAQ entries) rather than a fixed count. Smaller chunks match precisely but lose context; larger ones carry context but dilute the match. Choose by measuring retrieval on your own questions.
What is a vector database or index for?StorageIt stores vectors with metadata and answers nearest-neighbor queries quickly. Exact search compares against everything; approximate indexes trade a little recall for much faster lookups at scale.
What is approximate nearest neighbor search?ANNMethods such as HNSW graphs or IVF clustering that find most of the true nearest neighbors without scanning every vector. Their parameters trade recall against latency and memory.
Why does keyword search still matter?Hybrid searchEmbeddings blur exact terms such as error codes, product SKUs and names. BM25 keyword search catches them, so hybrid retrieval often beats either alone.
What does a reranker do?RerankingA cross-encoder reads the query and each candidate together and scores relevance more accurately than vector similarity. It is slower, so it reorders a short list, say the top 50, rather than the whole corpus.
Why ask the model to cite sources?GroundingCitations let users verify answers and let you measure whether claims are supported. They also make the model less likely to drift from the provided passages.
Fundamentals for freshers and first screens. Scroll sideways on a small screen.
def chunk(words, size=200, overlap=40):
    """Split a list of words into overlapping windows."""
    step = size - overlap
    return [words[i:i + size] for i in range(0, max(len(words) - overlap, 1), step)]

doc = [f"w{i}" for i in range(500)]
chunks = chunk(doc)
print(len(chunks), [len(c) for c in chunks])   # 3 [200, 200, 180]
print(chunks[0][-1], chunks[1][0])             # w199 w160: 40 words of overlap
Fixed-size chunking with overlap over a list of words. Real pipelines usually split on structure first.

Retrieval quality questions

  • The right document exists but is never retrieved. Where do you look? Check that it was ingested and parsed (tables and PDFs often break), how it was chunked, whether filters excluded it, and whether the query wording differs from the document's vocabulary. Then try hybrid search or query rewriting.
  • What is query rewriting? Using a model to turn a conversational question into a standalone search query, expand acronyms, or split a compound question into sub-queries. It fixes follow-ups like "what about the second one?".
  • What is HyDE? Hypothetical document embeddings: the model drafts a plausible answer, and you embed that draft to search, because it resembles the target documents more than a short question does.
  • How do you combine keyword and vector results? Reciprocal rank fusion is a simple, robust choice because it uses ranks rather than scores on different scales. Weighted score blending works too but needs normalization and tuning.
  • How do you use metadata? Store source, date, product, language and permissions with each chunk, filter on them before or during search, and boost recent or authoritative sources.
  • Parent-child or small-to-big retrieval? Match on small chunks for precision, then pass their larger parent section to the model for context.
  • How many passages do you put in the prompt? Enough to cover the answer, few enough to avoid distracting the model and inflating cost. Tune k with the evaluation set, and rerank so the best passages come first.
  • How do you handle tables, images and scanned PDFs? Use a parser that keeps table structure, convert tables to text rows or markdown, run OCR on scans, and keep a link to the original page so citations still work.

Evaluation questions

Most RAG interviews eventually ask how you know the system is good. The answer interviewers want: evaluate retrieval and generation separately, on questions from real users, and rerun the set on every change.

def recall_at_k(ranked, relevant, k):
    return len(set(ranked[:k]) & relevant) / len(relevant)

def mrr(ranked, relevant):
    for i, doc_id in enumerate(ranked, start=1):
        if doc_id in relevant:
            return 1 / i
    return 0.0

def rrf(rankings, k=60):
    """Reciprocal rank fusion: merge several ranked lists of doc ids."""
    scores = {}
    for ranking in rankings:
        for rank, doc_id in enumerate(ranking, start=1):
            scores[doc_id] = scores.get(doc_id, 0) + 1 / (k + rank)
    return sorted(scores, key=scores.get, reverse=True)

keyword = ["d3", "d1", "d7", "d2"]   # e.g. BM25 results
vector = ["d1", "d5", "d3", "d9"]    # e.g. embedding results
fused = rrf([keyword, vector])
print(fused[:3])                                                           # ['d1', 'd3', 'd5']
relevant = {"d1", "d5"}
print(recall_at_k(keyword, relevant, 3), recall_at_k(fused, relevant, 3))  # 0.5 1.0
print(mrr(keyword, relevant), mrr(fused, relevant))                        # 0.5 1.0
Recall at k, mean reciprocal rank and reciprocal rank fusion of a keyword and a vector result list.
Intermediate questions on measuring a RAG system
QuestionWhat it testsWhat a strong answer shows
How do you build an evaluation set?DataSample real questions from logs or support tickets, label the passages that answer each one and a reference answer, and include unanswerable questions. A few hundred well-chosen items beat thousands of synthetic ones.
Which retrieval metrics do you track?Retrieval metricsRecall at k (did the answer passage make the cut), MRR or NDCG (how high it ranked), and the share of questions with no relevant passage at all.
What is faithfulness or groundedness?Generation metricsWhether every claim in the answer is supported by the retrieved passages. Check it with a grader model prompted per claim, validated against human labels.
How do you trust an LLM-as-judge score?Grader validityHave humans label a sample, measure agreement with the grader, fix the rubric where they disagree, and keep the grader model and prompt fixed while comparing versions.
The answer is wrong but the right passage was retrieved. What now?Failure analysisA generation problem: the passage may be buried among distractors, too long, contradicted by another passage, or the instructions may not tell the model to rely on context. Reorder, trim and tighten the prompt.
What should the system do when nothing relevant is found?AbstentionSay it does not know and point to a human or a search page. Measure the abstention rate on the unanswerable questions in your set.
Intermediate questions on measuring a RAG system. Scroll sideways on a small screen.

Senior and system design questions

Scenario questions for experienced candidates
QuestionWhat it testsWhat a strong answer shows
Design a support assistant over 20,000 help articles and past tickets.System designIngest with incremental updates, structure-aware chunking, hybrid search plus reranking, product and version filters, citations, an abstain path, feedback capture and an evaluation set refreshed from new tickets.
Employees must only see answers from documents they can access.SecurityStore access lists with each chunk and filter at query time using the user's identity, before passages reach the model. Never rely on the prompt to hide content, and keep permissions in sync when they change.
A retrieved web page says "ignore previous instructions". What is the risk?Prompt injectionRetrieved text is untrusted input and can steer the model, especially one with tools. Separate instructions from content, limit what tools can do, and filter or flag suspicious passages.
Documents change daily. How do you keep the index fresh?FreshnessTrack source changes with timestamps or hashes, re-embed only changed chunks, delete removed ones, and show the document date in answers so users can judge staleness.
Long-context models can read whole manuals. Do you still need RAG?JudgementOften yes: corpora are larger than any window, long prompts cost more and slow responses, and models can miss details in very long input. Long context helps after retrieval, by allowing bigger, more complete passages.
Cost per question is too high. What do you change?CostCache answers to frequent questions, retrieve fewer and shorter passages, rerank before generation, route simple questions to a smaller model, and cache embeddings so unchanged documents are never re-embedded.
Scenario questions for experienced candidates. Scroll sideways on a small screen.

Fictional example

"Users say the policy bot gives outdated answers"
Interviewer
Our HR policy assistant keeps quoting last year's leave policy. How do you fix it?
Candidate
First I would confirm the cause with a few failing questions: is the new policy in the index, and does the old one rank above it? If both versions are indexed, I would add an effective date and a current or archived flag to each chunk, filter archived versions out by default, and boost recent sources. I would also re-ingest on every change to the policy folder rather than nightly. Then I would add these questions to the evaluation set with the current policy as the expected source, and track how often an archived document appears in the top results, so the bug cannot quietly return.

A two-week RAG practice plan

  • Days 1 to 3: build a minimal pipeline over a folder of documents: chunk, embed, store, retrieve and answer with citations. Keep it small enough to explain line by line.
  • Days 4 and 5: write 50 real-looking questions with labeled answer passages, and measure recall at 5 and MRR.
  • Days 6 to 8: change one thing at a time (chunk size, hybrid search, a reranker, query rewriting) and record what each does to the metrics.
  • Days 9 and 10: add a faithfulness grader, check it against your own labels on 30 answers, and add unanswerable questions.
  • Days 11 to 14: two design questions out loud: a permission-aware enterprise search assistant and a support bot with daily document changes.

RAG design rounds reward candidates who name the failure mode before the fix. Natively, an AI interview assistant for Mac and Windows, transcribes your mock design sessions on your computer, so you can review whether you separated retrieval from generation each time. While you practise, it can propose answer outlines, read a pipeline diagram or a coding task from a screenshot, and help with retrieval code. On Pro or the free trial it also uses the résumé and job description you add, and the transcript stays available for review.

Questions people ask

What RAG questions are asked in interviews?

Why RAG instead of fine-tuning, how to chunk and embed documents, vector indexes and approximate search, hybrid keyword and vector retrieval, reranking, query rewriting, evaluation with recall at k and faithfulness, access control and a design question.

How do you evaluate a RAG system?

Separately for retrieval and generation, on a labeled set of real questions: recall at k and MRR for retrieval, and faithfulness and answer correctness for generation, including questions that should get no answer.

How do you choose chunk size for RAG?

Split on document structure first, then test a few sizes and overlaps against your own labeled questions. Small chunks match precisely but lose context; large ones keep context but dilute the match.

Is RAG still needed with long-context models?

Usually. Corpora are bigger than any context window, long prompts cost more and respond slower, and retrieval keeps answers focused and permission-aware. Long context helps by allowing larger retrieved passages.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP