Skip to content

Why retrieval?

Read · 1 of 2

An open-book exam

A model knows a lot, but not your company's refund policy, your course notes or yesterday's tickets. And you can't paste everything into every prompt.

Retrieval (often called RAG) works like an open-book exam: split your documents into chunks, find the few chunks most related to the question, and put only those in the prompt, with labels so the answer can cite them.

Read this lesson as text

Models don't know your documents. Find the relevant bits and put them in the prompt.

An open-book exam

A model knows a lot, but not your company's refund policy, your course notes or yesterday's tickets. And you can't paste everything into every prompt.

Retrieval (often called RAG) works like an open-book exam: split your documents into chunks, find the few chunks most related to the question, and put only those in the prompt, with labels so the answer can cite them.

Retrieval, step by step

  1. Chunk: Split documents into small overlapping pieces.
  2. Search: Score every chunk against the question.
  3. Top k: Keep the best few.
  4. Prompt: Question + labelled chunks.
  5. Cite: The answer points at chunk labels you can check.