Tokenizer3 XP · 1-day streak
Topics / RAG & Retrieval

RAG & Retrieval

RAG is the most common LLM system that companies actually ship, so it shows up in almost every AI Engineer interview loop - as conceptual questions, as a system-design round ("build search over our docs"), and as debugging scenarios ("retrieval quality dropped, go"). Expect it whether you're interviewing at a frontier lab, a big-tech applied AI team, or a startup whose whole product is RAG; interviewers use it to separate people who have shipped retrieval systems from people who have only read about them.

0%mastery
0/100questions tried
0due today
0/17cards read

Card 1 of 17

When RAG vs long-context vs fine-tuning

This is the classic opener. The decision axes:

Axis RAG Long context Fine-tuning
Freshness Update index in minutes Re-send docs every call Retrain to update
Corpus size Effectively unbounded Bounded by window (frontier models commonly offer ~200k-1M tokens, and 1M ≈ a few thousand pages) Baked into weights, lossy
Cost per query Retrieve top-k, pay for ~2-10k context tokens Pay for the whole corpus per call (caching helps but doesn't eliminate it) Cheap at inference, expensive to train/maintain
Attribution Natural - cite retrieved chunks Possible but weaker None - can't cite weights
Access control Filter at retrieval time Must pre-filter what you stuff in Impossible per-user
Best for Large/changing/permissioned knowledge Small stable corpus, whole-document reasoning Style, format, domain behaviour (not facts)

Rule of thumb: fine-tuning teaches skills and style; RAG supplies knowledge; long context is RAG's competitor only when the corpus fits and rarely changes. They compose: many production systems fine-tune a small model and use RAG and exploit long context for the retrieved set.

All 100 RAG & Retrieval questions

Basic

  1. What is RAG, and what problem does it actually solve?
  2. When would you choose RAG vs long-context stuffing vs fine-tuning?
  3. Walk me through every stage of a production RAG pipeline, from raw documents to a cited answer.
  4. What chunking strategies do you know, and how do you pick one?
  5. How do chunk size and overlap affect retrieval quality, and what numbers would you start with?
  6. How does a bi-encoder embedding model work at retrieval time, and what's the key limitation of that architecture?
  7. How would you choose an embedding model? What role does MTEB play, and what are its limits?
  8. When do you need approximate nearest neighbour search instead of exact search?
  9. What is hybrid search, and why does pure vector search fail on some queries?
  10. What is a reranker, and why add one after vector search?
  11. Which distance metric should you use for embedding search - cosine, dot product, or Euclidean - and does the choice actually matter?
  12. What does BM25 actually compute? Walk me through the formula's moving parts.
  13. How would you detect that a parser silently corrupted documents, at scale, without reading every page?
  14. What metadata would you attach to each chunk, and what does it buy you?
  15. Many embedding models tell you to prefix queries and documents differently, or to pass a task instruction. Why, and what goes wrong if you ignore it?

Intermediate

  1. Everyone focuses on retrieval algorithms - what's actually the hardest part of building RAG over enterprise documents?
  2. Explain contextual retrieval. What problem does it solve, and how does late chunking relate?
  3. What are the tradeoffs of embedding dimensionality, and what are Matryoshka embeddings?
  4. When would you fine-tune your embedding model, and how would you actually do it?
  5. Explain how HNSW works, and what the M and ef parameters control.
  6. Compare HNSW, IVF, and product quantization - what are the recall/latency/memory tradeoffs?
  7. How do you choose a vector database? pgvector vs dedicated vector stores vs search engines.
  8. How does metadata filtering interact with ANN indexes? Explain pre- vs post-filtering.
  9. How does reciprocal rank fusion work, and why fuse by rank instead of by score?
  10. Explain the retrieval-architecture spectrum: bi-encoders, cross-encoders, and late interaction (ColBERT).
  11. What query understanding techniques would you apply before retrieval, and when is each worth it?
  12. How do you handle retrieval in a multi-turn conversation?
  13. How do you make a RAG system produce trustworthy citations?
  14. How do you keep a RAG index fresh as documents change?
  15. How do you make tables and charts in documents actually retrievable and answerable?
  16. How would you implement sub-question decomposition, and when does it make things worse?
  17. What is learned sparse retrieval, SPLADE-style, and when would you pick it over BM25 or a dense retriever?
  18. Your corpus is full of near-duplicates: doc versions, boilerplate, quoted email threads. How do you handle deduplication?
  19. How do you handle time in retrieval - 'latest' queries, superseded documents, and questions about the past?
  20. How does retrieval over a codebase differ from retrieval over prose?
  21. Your corpus is multilingual and users query in several languages. What breaks, and how do you fix it?
  22. Explain self-RAG and corrective RAG. Do they earn their complexity in production?
  23. Some questions are answered by your data warehouse, some by documents, and some need both. How do you design retrieval across structured and unstructured data?

Advanced

  1. What is GraphRAG, and when is the knowledge-graph structure worth the complexity?
  2. Compare single-shot RAG with agentic RAG. When does retrieval-as-a-tool win?
  3. Your product has several distinct corpora - docs, tickets, code, CRM. How do you route queries?
  4. Design retrieval for a multi-tenant SaaS product where users have different document permissions.
  5. What retrieval metrics would you track - recall@k, MRR, nDCG - and what does each actually tell you?
  6. How do you evaluate the generation side of RAG - faithfulness, relevance, and citation quality?
  7. How do you build a golden evaluation set for RAG without months of labelling?
  8. A user reports the RAG assistant gave a wrong answer. Walk me through your triage.
  9. What are the top failure modes of production RAG systems?
  10. Break down the latency and cost budget of a RAG query. What do you optimise first?
  11. What caching strategies apply to RAG systems, and what are the invalidation traps?
  12. "Long-context models made RAG obsolete." Argue both sides, then give your actual position.
  13. A better embedding model ships. You have 400M chunks indexed. Walk me through the migration.
  14. When would you skip parsing entirely and retrieve over page images with a visual retriever like ColPali?
  15. Design a retrieval evaluation harness the team will actually use. What runs, when, and what blocks a merge?
  16. You have thumbs-up/down and click logs from a live RAG product. How do you turn that into retrieval improvements?
  17. Your index will not fit on one machine. How do you shard it, and what breaks?
  18. Anyone can add documents to your corpus. How do you stop an attacker planting a document that hijacks the assistant?
  19. You are exposing retrieval as a tool to an agent, over MCP. How does designing a tool interface differ from designing a retrieval API?
  20. Teams increasingly rerank with an LLM rather than a cross-encoder. How do pointwise, pairwise and listwise LLM reranking work, and when is the cost justified?
  21. A teammate wants to delete the vector index and give the agent grep, file reads and keyword search instead, the way coding agents work. Where are they right, and where does it break outside code?
  22. Your assistant must say "I don't know" when the corpus lacks the answer. How do you decide when to abstain, and how do you set the threshold?
  23. Your embedding provider ships a large and a small model that share one embedding space, so you can index with the large one and query with the small one. When is that worth doing, how do you verify the compatibility claim on your own corpus, and what does it change about the reindex-or-nothing rule for model migrations?
  24. Your agents work over a large enterprise document estate. When does chunked agentic RAG win, when does a browsable knowledge tree win, and when does a typed domain ontology win? Why can the ontology be both more accurate and cheaper per task, and what does it cost to build?

Quick-fire

  1. When would you use RAG instead of fine-tuning to give a model new knowledge?
  2. Walk me through a basic RAG pipeline end to end.
  3. How do you choose a chunking strategy?
  4. What is the difference between dense, sparse, and hybrid retrieval?
  5. What does a reranker do, and when is it worth it?
  6. Why might a model answer worse with retrieved context than with none?
  7. How do you evaluate a RAG system?
  8. What is the RAG triad?
  9. What is agentic RAG, and when do you need it?
  10. What is GraphRAG and what problem does it solve?
  11. How does RAG change at enterprise scale?
  12. How do you handle document freshness and updates in a RAG index?
  13. A user asks something your corpus does not cover. What should the system do, and how do you make it do that?
  14. What is contextual retrieval, and what problem does it fix?
  15. What is late chunking, and how does it differ from contextual retrieval?
  16. What is query rewriting or HyDE, and when does it help retrieval?
  17. How does metadata filtering improve retrieval, and how do you use it?
  18. How do you choose a vector index (for example HNSW vs IVF vs flat) and does it matter?
  19. With million-token context windows, is RAG obsolete? When do you still need it?
  20. How do you do RAG over tables, PDFs, and images rather than clean text?
  21. What is query routing across multiple indices or data sources?
  22. How do you build a golden evaluation set for a RAG system from real usage?
  23. How do you tune the retrieval score threshold that decides answerable vs unanswerable?
  24. How do you attach and verify citations so users can trust a RAG answer?
  25. What is the fundamental concept of embeddings in machine learning, and how do they represent information in a more compact form compared to raw input data?
  26. Compare and contrast word embeddings and sentence embeddings. How do their applications differ, and what considerations come into play when choosing between them?
  27. Explain the concept of contextual embeddings. How do models like BERT generate contextual embeddings, and in what scenarios are they advantageous compared to traditional word embeddings?
  28. Discuss the challenges and strategies involved in generating cross-modal embeddings, where information from multiple modalities, such as text and image, is represented in a shared embedding space.
  29. When training word embeddings, how can models be designed to effectively capture representations for rare words with limited occurrences in the training data?
  30. Discuss common regularization techniques used during the training of embeddings to prevent overfitting and enhance the generalization ability of models.
  31. How can pre-trained embeddings be leveraged for transfer learning in downstream tasks, and what advantages does transfer learning offer in terms of embedding generation?
  32. What is quantization in the context of embeddings, and how does it contribute to reducing the memory footprint of models while preserving representation quality?
  33. When dealing with high-cardinality categorical features in tabular data, how would you efficiently implement and train embeddings using a neural network to capture meaningful representations?
  34. When dealing with large-scale embeddings, propose and implement an efficient method for nearest neighbor search to quickly retrieve similar embeddings from a massive database.
  35. In scenarios where an LLM encounters out-of-vocabulary words during embedding generation, propose strategies for handling such cases.
  36. Propose metrics for quantitatively evaluating the quality of embeddings generated by an LLM. How can the effectiveness of embeddings be assessed in tasks like semantic similarity or information retrieval?
  37. Explain the concept of triplet loss in the context of embedding learning.
  38. In loss functions like triplet loss or contrastive loss, what is the significance of the margin parameter?
+3 XP · card read