What to take into an interview
- Evaluate retrieval separately from answer generation.
- Preserve document identity and citation metadata through every stage.
- Design fallbacks for weak, empty, stale, or contradictory evidence.
Frame RAG as a pipeline
A RAG system has distinct stages: ingestion, chunking, indexing, query transformation, candidate retrieval, reranking, context construction, generation, and evaluation. State which stage owns each decision so failures can be isolated.
For example, an unsupported answer may come from poor retrieval, a context formatter that dropped the relevant passage, or a generator that ignored supplied evidence. One end-to-end score cannot tell you which component needs work.
Choose chunking and retrieval deliberately
Chunk size should follow document structure and the questions users ask. Small chunks can improve precision but lose surrounding context; large chunks preserve context but consume the prompt budget and may dilute relevance.
- Use overlap only when it protects meaning across chunk boundaries.
- Store source, section, timestamp, and access-control metadata.
- Combine keyword and semantic retrieval when exact terms matter.
- Filter by permissions before evidence reaches the model.
Rerank and construct grounded context
Initial retrieval optimizes recall; reranking improves precision among the candidates. Apply a more selective relevance signal, remove near-duplicates, and fit the strongest evidence into a defined context budget.
Format each passage with stable source identifiers. Tell the model to distinguish supported statements from uncertainty, but also verify citations after generation rather than relying only on an instruction.
Measure retrieval and answer quality
Create labeled queries with expected relevant documents and measure recall at K, ranking quality, citation correctness, groundedness, and answer usefulness. Include adversarial and no-answer cases.
In an interview, explain how you would inspect failures by stage and how production feedback becomes a reviewed evaluation set. Avoid claiming that one embedding model or vector database solves quality by itself.
Hands-on practice
Related coding problems
Split Documents into Retrieval-Safe Chunks
Implement the ingestion boundary with explicit overlap behavior.
Open problemMerge Hybrid Search Results
Combine lexical and semantic rankings without duplicate documents.
Open problemBuild Retrieval Context with Citations
Preserve source attribution in the model-ready context.
Open problemBuild the foundation
Related curriculum tracks
Common questions
Frequently asked questions
What RAG metrics should I discuss in an interview?
Discuss retrieval recall and ranking quality separately from answer groundedness, citation correctness, usefulness, latency, and cost.
Is a vector database required for RAG?
No. The right retrieval method depends on the corpus and query. Keyword search, structured filters, SQL, graph queries, and hybrid approaches may be appropriate.
How should RAG handle missing evidence?
Return a clear no-answer or uncertainty state, optionally ask a clarifying question, and log the retrieval gap. Do not encourage the model to fill missing evidence from guesswork.
Practice next
Practice each RAG stage in isolation
Implement chunking, ranking, and citation formatting as separate exercises so you can diagnose where retrieval quality changes and explain why.