Part 17 / Topic 6 of 6
Improving RAG
Once measured, three upgrades pay off most, in order of usual value:
- Reranking — retrieve 20 candidates cheaply, let a stronger scorer (cross-encoder or LLM) pick the best 3. Fixes "right doc at rank 7".
- Query rewriting — let the model expand "it broke" (with chat context) into "blender arrived damaged replacement policy" before retrieval. Fixes vague and conversational queries.
- 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.