RAG & Retrieval·Question 1 of 100BasicAI-75

What is RAG, and what problem does it actually solve?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

RAG (retrieval-augmented generation) fetches relevant documents from an external corpus at query time and places them in the LLM's context so the model answers from that evidence instead of from its parametric memory alone. It solves four problems at once: knowledge cutoff (the corpus can be updated in minutes, weights can't), private data (the model never saw your wiki or tickets), attribution (you can cite the exact chunk a claim came from), and hallucination reduction (grounding claims in retrieved text, though it doesn't eliminate hallucination - the model can still misread or ignore the context).

Full worked answer with diagram

RAG (retrieval-augmented generation) fetches relevant documents from an external corpus at query time and places them in the LLM's context so the model answers from that evidence instead of from its parametric memory alone. It solves four problems at once: knowledge cutoff (the corpus can be updated in minutes, weights can't), private data (the model never saw your wiki or tickets), attribution (you can cite the exact chunk a claim came from), and hallucination reduction (grounding claims in retrieved text, though it doesn't eliminate hallucination - the model can still misread or ignore the context).

Mechanically the minimal loop is: embed the query, nearest-neighbour search over pre-embedded document chunks, stuff top-k chunks into the prompt, generate. Production systems add parsing, chunking strategy, hybrid lexical+dense search, reranking, query rewriting, and grounding checks around that core.

A framing that lands well in interviews: the LLM's weights are a lossy, stale compression of its training data; RAG gives it a lossless, fresh, permission-aware working set at inference time. It also decouples knowledge from the model - you can swap models without retraining anything, and you can delete a document and have it actually gone (relevant for GDPR-style deletion, which is nearly impossible with fine-tuned weights).

What RAG does not solve: it won't teach the model new skills or output formats (that's fine-tuning), it won't help if the answer requires synthesising the entire corpus at once (that's long-context or GraphRAG territory), and it's only as good as its worst pipeline stage - a parsing bug or a bad chunking strategy silently caps the whole system's quality.

Worth sketching. It splits what happens once at index time from what happens on every query, which is why RAG scales at all.

flowchart LR
    D["Corpus chunks"] --> E["Embed once<br/>at index time"]
    E --> I["Vector index"]
    Q["User query"] --> QE["Embed query"]
    QE --> S["Nearest-neighbour search"]
    I --> S
    S --> K["Top-k chunks"]
    K --> P["Prompt: question<br/>plus evidence"]
    P --> A["Answer with<br/>chunk citations"]

What a good answer covers

  • RAG (retrieval-augmented generation) fetches relevant documents from an external corpus at query time…
  • It solves four problems at once
  • Mechanically the minimal loop is
  • Production systems add parsing, chunking strategy, hybrid lexical+dense search, reranking, query…
  • It also decouples knowledge from the model - you can swap models without retraining anything, and you…

Key terms: knowledge cutoff · private data · attribution · hallucination reduction

Interviewer follow-ups to expect

  1. Where does a typical RAG system lose the most quality - retrieval or generation?

  2. If the model still hallucinates with perfect context, what do you do?

  3. How would you explain to a PM why RAG doesn't make hallucination impossible?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep