Course map
Stage 1: Foundations
Stage 2: Machine Learning
Stage 3: Deep Learning
Stage 4: LLMs & Generative AI
Stage 5: Production & Specialization

Part 17 / Topic 6 of 6

Improving RAG

Once measured, three upgrades pay off most, in order of usual value:

  1. Reranking — retrieve 20 candidates cheaply, let a stronger scorer (cross-encoder or LLM) pick the best 3. Fixes "right doc at rank 7".
  2. Query rewriting — let the model expand "it broke" (with chat context) into "blender arrived damaged replacement policy" before retrieval. Fixes vague and conversational queries.
  3. Metadata filters — scope retrieval by product, date or tenant before similarity. Fixes right-words-wrong-document, and is also the access-control point in multi-tenant systems.

Each one is measurable with the same recall@k harness — upgrade, re-run, keep what moves the number. That loop is the mini-project's stretch.

Done here? The practice set for Part 17 — 4 exercises with solutions — is on the part page.

Search the guide