RAG & Retrieval·Question 64 of 100Quick-fire

Walk me through a basic RAG pipeline end to end.

Quick-fire answer from the Awesome Generative AI Guide (MIT)

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

Offline: ingest documents, clean and chunk them, embed each chunk, and store the vectors (plus metadata and the source text) in an index. Online: embed the user query, retrieve the top k nearest chunks (often with a hybrid of dense and keyword search), optionally rerank them, assemble a prompt that includes the query plus the retrieved context with instructions to answer only from it and cite sources, then generate. Around this you add guardrails (refuse when nothing relevant is retrieved) and evaluation on both retrieval and generation. Each stage is a tunable knob: chunking, embedding model, k, reranking, and prompt.

Full worked answer

Offline: ingest documents, clean and chunk them, embed each chunk, and store the vectors (plus metadata and the source text) in an index. Online: embed the user query, retrieve the top k nearest chunks (often with a hybrid of dense and keyword search), optionally rerank them, assemble a prompt that includes the query plus the retrieved context with instructions to answer only from it and cite sources, then generate. Around this you add guardrails (refuse when nothing relevant is retrieved) and evaluation on both retrieval and generation. Each stage is a tunable knob: chunking, embedding model, k, reranking, and prompt.

Learn more: RAG roadmap

What a good answer covers

  • Offline: ingest documents, clean and chunk them, embed each chunk, and store the vectors (plus metadata…
  • Online: embed the user query, retrieve the top k nearest chunks (often with a hybrid of dense and…
  • Around this you add guardrails (refuse when nothing relevant is retrieved) and evaluation on both…
  • Each stage is a tunable knob: chunking, embedding model, k, reranking, and prompt

Key terms: Learn more

Quick-fire answer from the Awesome Generative AI Guide (MIT) · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep