Start studying
Module 9 · RAG Module contents
Module 9  ·  Card 8 / 19beginner

Retrieval

Retrieval embeds the user's query and finds the closest chunks.

Top-k is typically somewhere between 5 and 20 chunks.

Metadata filters narrow the search before or during the similarity step.

Retrieval quality sets a hard ceiling on answer quality.

If the right chunk is never retrieved, no amount of prompting can save the answer.

Learn in depth ↓
Module 09 · RAG · 19 concepts
In depth  /  15 lines

Retrieval, in more detail

Retrieval is the step that decides what the model gets to see.

The query is embedded with the same model used for the chunks.

The index returns the nearest chunks by similarity, usually five to twenty.

Metadata filters can narrow the search before or during that comparison.

Everything downstream is capped by this step.

If the right chunk is not retrieved, no prompt can recover the answer.

The model will instead answer from what it was given, plausibly and wrongly.

So measuring retrieval separately from generation is essential.

Recall at k asks whether the correct chunk appears in the top k at all.

A retrieval recall of 70 per cent caps the whole system at roughly that.

Raising k improves recall and adds noise and cost to the context.

Retrieving twenty and reranking to five is usually better than retrieving five directly.

Queries phrased as questions and documents written as statements do not always match well.

Query rewriting and hybrid search both help with that mismatch.

Build a small set of questions with known correct chunks and measure against it.

Want the full technical article? Wikipedia ↗
Test yourself

3 questions on this card. Every option explains itself once you pick, right or wrong.

Question 1 of 3
What sets the hard ceiling on RAG answer quality?
Question 2 of 3
Chunks of 5000 tokens are hurting your retrieval. Why?
Question 3 of 3
Why retrieve 50 chunks and rerank to 5 rather than just retrieving 5?
RAG

19 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close