Module 86: RAG

Lesson 3 of 5 · 15–25 minutes

Retrieval and reranking

🏠The everyday picture

A recruiter first shortlists 20 CVs quickly by keywords, then reads those 20 carefully to choose the best five for interview. Fast first, careful second.

📘What it really is

🖱️Try it

Change your retrieval to fetch the top 20 by hybrid search (with a permission filter by the user's role), rerank them (with a reranker API or, as a simple stand-in, the model scoring relevance from 0 to 3), and keep the top 5. Measure hit rate at 5 before and after reranking. Test that a staff user never retrieves a chunk marked managers-only.

✅Quick check

Why rerank after the first search?

Show the answer

A reranker judges relevance more carefully, so the best passages end up at the top.

Where should permission filtering happen?

Show the answer

In the retrieval query itself, so restricted chunks are never fetched for users who may not see them.

← PreviousChunking
ProLearners Assist