ExtraBrain Interview Questions
RAG Engineer Interview Questions for 2026, With Answer Outlines
Short answer
RAG interviews in 2026 test the retrieval pipeline more than prompting: how you chunk documents, combine keyword and vector search, rerank, enforce permissions, keep the index fresh, and prove quality with retrieval metrics and faithfulness checks. The strongest answers start from a concrete failure, such as the right chunk never being retrieved, name the metric that exposes it, and explain the fix and what it costs in latency.
RAG engineer interview questions on chunking, hybrid search, reranking, evals and production failures, with answer outlines and tested Python.
Most RAG interviews no longer open with “what is retrieval-augmented generation?” They open with a broken system: the support bot quoted last year’s refund policy, or it answered confidently from a document the user was not allowed to see. Your job is to find which stage failed and say how you would prove the fix worked.
The idea is older than most production stacks. The original RAG paper paired a generator’s parametric memory with a searchable index as non-parametric memory. What interviewers probe now is everything around that pairing: ingestion, retrieval quality, permissions and evaluation. The questions below are grouped the way a loop usually runs, from retrieval to production.
Start every answer by locating the failure
When an interviewer describes a bad answer, sort it into a stage before proposing tools. This table is a useful mental checklist.
| Symptom | Likely stage | What to measure |
|---|---|---|
| Quotes an outdated policy | Ingestion and freshness | Index lag, document version metadata |
| Right document exists, never shows up | Chunking or embeddings | Recall@k on a golden set |
| Misses exact codes like “ERR-4012” | Retrieval mode | Keyword recall vs vector recall |
| Right chunk retrieved, answer still wrong | Generation and context | Faithfulness of claims to context |
| Shows a document the user can’t open | Access control | Permission-filter tests per role |
Retrieval questions
How would you choose a chunking strategy?
Split on document structure first (headings, sections, list items), then cap size. Anthropic’s write-up on contextual retrieval describes typical chunks as no more than a few hundred tokens and notes that size, boundaries and overlap all change retrieval quality. Store the title and section path as metadata so a chunk that says “the limit is 30 days” still knows which product it belongs to.
Then mention contextual retrieval: a model writes a short, chunk-specific context that is prepended before embedding and before building the BM25 index. Anthropic reported the top-20 retrieval failure rate falling from 5.7% to 3.7% with contextual embeddings, to 2.9% when contextual BM25 was added, and to 1.9% with reranking on top. Say you would rerun that comparison on your own golden set before trusting the numbers.
Why use hybrid search, and how do you merge the two result lists?
Vector search handles paraphrases. Keyword search (BM25) handles exact strings such as error codes, SKUs and people’s names, which embeddings often blur. The two systems produce scores on different scales, so averaging raw scores is a trap.
The standard answer is Reciprocal Rank Fusion, which uses only ranks. Cormack, Clarke and Büttcher defined the score as the sum of 1 / (k + rank) across rankings, with k = 60, and Elasticsearch still defaults rank_constant to 60. Interviewers often ask you to write it:
from collections import defaultdict
def rrf(rankings, k=60): """Fuse ranked lists of document IDs with Reciprocal Rank Fusion.""" scores = defaultdict(float) for ranking in rankings: for rank, doc_id in enumerate(ranking, start=1): scores[doc_id] += 1.0 / (k + rank) return sorted(scores, key=scores.get, reverse=True)
bm25 = ["d3", "d1", "d7", "d2"]dense = ["d1", "d4", "d3", "d9"]print(rrf([bm25, dense])) # ['d1', 'd3', 'd4', 'd7', 'd2', 'd9']Point out that d1 wins because it ranks well in both lists, even though BM25 put d3 first. That is the behavior you want from fusion.
When is a reranker worth the latency?
A cross-encoder reranker reads the query and each candidate together, so it is more accurate than embedding similarity and much slower. Run it on a shortlist only. In Anthropic’s setup, the system retrieved 150 candidates, reranked them and passed the top 20 to the model. Your answer should name the latency budget (for example, p95 under two seconds end to end) and show where the reranker fits inside it.
HNSW or IVFFlat in pgvector?
The pgvector README gives the tradeoff directly. HNSW has the better speed-recall tradeoff but builds slower and uses more memory, and it can be created on an empty table. IVFFlat builds faster with less memory, but you should create it after the table has data. Know the defaults (hnsw.ef_search is 40, ivfflat.probes is 1) and the filtering trap: approximate indexes filter after the scan, so a WHERE tenant_id = ... matching 10% of rows returns about 4 rows on average with default HNSW settings. Iterative index scans, added in 0.8.0, are the fix to mention.
Generation and context questions
The right chunk was retrieved, but the answer is still wrong. Why?
Three common causes. The context is too long and the key passage sits in the middle: the Lost in the Middle study found models use information at the start or end of long inputs better than information in the middle. Two retrieved chunks conflict, often an old and new version of the same policy. Or the prompt never told the model to answer only from the context and cite it.
Fixes to offer: retrieve fewer, better chunks, deduplicate versions at ingestion, put the strongest evidence first, require citations by chunk ID, and allow “I don’t know” when nothing relevant was retrieved.
When would you not use RAG at all?
If the whole knowledge base fits in the context window, skip retrieval. Anthropic suggests that for knowledge bases under about 200,000 tokens you can include everything in the prompt and use prompt caching to cut cost and latency. Fine-tuning changes behavior and format, but it is a poor way to store facts that change weekly.
How do you keep users from seeing documents they shouldn’t?
Filter by access-control metadata at query time, before ranking and generation, and never rely on the prompt to hide text the model has already been given. The OWASP Top 10 for LLM applications lists vector and embedding weaknesses (LLM08) and sensitive information disclosure (LLM02) for this reason. Test it with a user who lacks access and assert the document never appears in the retrieved set.
Evaluation questions
How do you evaluate a RAG system?
Measure retrieval and generation separately, or you can’t tell which one regressed. For retrieval, build a golden set of questions mapped to the chunk IDs that answer them, then track recall@k and mean reciprocal rank (MRR):
def recall_at_k(retrieved, relevant, k): return len(set(retrieved[:k]) & relevant) / len(relevant)
def mean_reciprocal_rank(results): """results: list of (retrieved_ids, relevant_id_set) pairs.""" total = 0.0 for retrieved, relevant in results: for rank, doc_id in enumerate(retrieved, start=1): if doc_id in relevant: total += 1 / rank break return total / len(results)
golden = [ (["c7", "c2", "c9"], {"c2"}), # relevant chunk at rank 2 (["c1", "c4", "c5"], {"c1", "c5"}), # first hit at rank 1 (["c8", "c6", "c3"], {"c4"}), # missed entirely]print(round(mean_reciprocal_rank(golden), 3)) # 0.5print(recall_at_k(["c1", "c4", "c5"], {"c1", "c5"}, 2)) # 0.5For generation, measure faithfulness. The Ragas definition is the number of claims in the answer supported by the retrieved context divided by the total number of claims. Add answer relevance, and keep a slice of unanswerable questions so you catch confident answers to things the corpus never covered.
Where does the golden set come from?
Real user queries from logs, labeled by people who know the domain, plus deliberately hard cases: exact-code lookups, multi-hop questions and questions with no answer. Version it like code, and rerun it on every change to chunking, embedding model or prompt.
Production questions
What happens when you switch embedding models?
Vectors from different models are not comparable, so you re-embed the whole corpus and run old and new indexes side by side until the golden set confirms the new one. Mention the cost estimate and the cutover plan, because interviewers want to see you treat the index as a migration, not a config flag.
How do you keep the index fresh?
Incremental ingestion keyed by document ID and version, deletes handled as tombstones, and a freshness metric (time from source edit to searchable). Stale answers are usually an ingestion bug.
Practice the answers out loud
These answers only land if you can explain them while someone interrupts with “what if the corpus is multilingual?” Rehearse with a friend or a mock session, and use ExtraBrain to transcribe the practice run so you can see where an explanation went vague. If you import your own project notes into ExtraBrain as reference documents, practice answers can stay anchored to systems you actually built. For broader model questions, pair this page with our LLM engineer interview questions, and for agent design rounds read the AI agent engineer interview prep guide. In the live interview itself, follow the company’s rules on AI assistance.
Sources (checked November 23, 2026)
- Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
- Anthropic, Introducing Contextual Retrieval
- Cormack, Clarke and Büttcher, Reciprocal Rank Fusion (SIGIR 2009)
- Elasticsearch reciprocal rank fusion reference
- pgvector README
- Liu et al., Lost in the Middle
- Ragas faithfulness metric
- OWASP Top 10 for LLM Applications 2025
FAQ
Do I need to know a specific vector database?
Rarely. Interviewers care that you understand index types, filtering and recall tradeoffs. Knowing pgvector or one managed service well is enough to give concrete answers.
How much math comes up in RAG interviews?
Usually cosine similarity, why scores from different retrievers aren’t comparable, and simple metrics such as recall@k and MRR. Be ready to compute them by hand.
Is RAG still relevant with million-token context windows?
Yes, for cost, latency, freshness and permissions. Long context removes the need for retrieval only when the corpus is small and everyone may see all of it.
What mistake do candidates often make?
Proposing a fix (bigger model, more chunks) before identifying which stage failed and how they would measure it.