Reranking for Precision
Precise scoring over a shortlist
A retriever shortlists widely; a reranker scores precisely. Reranking (cross-encoder style) reliably lifts top-k precision and is the cheapest big win in many RAG stacks.
What you will learn
- Explain what a reranker scores that embeddings don't
- Wire retrieve-wide-rerank-tight
- Measure precision lift on a labeled set
What is this?
Embedding similarity gives a coarse, pair-independent idea of relevance; a reranker sees the (query, chunk) pair together and scores actual relevance. Pipeline pattern: retrieve a generous top-N (10-30) with the cheap ANN, then rerank to the final small top-k with the precise scorer. It routinely adds 10-30% precision at modest latency cost on the shortlist.
Why do you need it?
- Cross-attention between query and doc catches interactions embeddings smooth over.
- More precise feed → fewer hallucinations and better citations.
- Reranking a shortlist is affordable: ~10-30 pairs, not 1M.
- It corrects for noisy embedding spaces on tied-ish candidates.
Mental model
Two-pass hiring
Retrieve then rerank
Graphs of resumes get screened quickly into 20 finalists (retrieval). A panel then interviews those 20 — pairs each against the actual job (rerank) — and picks the true top 5, rather than trusting the screen for the final ranking.
How it works
- ANN returns top-N candidates cheaply.
- Each (query, chunk) pair runs through the reranker (cross-encoder or strong pairwise scorer).
- Sort chunks by rerank score; drop below-threshold items.
- Final top-k reaches the prompt; scores back citations.
- Tune N-stage: bigger N costs latency; smaller N may drop the right chunk entirely.
Rerank stage.
In production
- Policy retrieval: rerank so the cited clause is the right one, not a sibling.
- HAL-legal support: cheaper to rerank 30 and give 5 than to stuff 5 bad chunks.
- Code assistants rerank function-level chunks for exact symbol matches.
Best practices
- Default to retrieve-wide + rerank-tight (e.g. N=20 → k=5).
- Benchmark rerank lift vs latency on your own labels.
- Pass rerank scores to citations and keep the threshold for 'no good answer'.
- Swap the embedding model and reranker independently — they're separate decisions.
Common mistakes
- Reranking N=5 — the decision is already made; the reranker sees only losers.
- Treating rerank scores as calibrated probabilities (they aren't).
- Skipping thresholds: reranking still must answer 'is ANY chunk good'.
Common issues
Right chunk but wrong order into the promptReranker not applied or N too tight
Apply reranker over a wider N; verify ordering in logs.
Rerank latency unacceptableN oversized or slow reranker
Trim N, batch pairs, or use a lighter reranker.
Debugging tips
- Rerank doesn't improve → N too small or reranker/corpus mismatch; expand N, re-audit.
- All rerank scores low → expected; use the score floor for not-found UX.
- Latency up a lot → N too large for interactive; compress to 10-15.
Interview checkpoint
Hands-on lab
- Retrieve top-5 then rerank down gradually
- Prove precision improves with rerank scores
- Pick N and k with labeled data
Retrieve-Wide, Rerank-Tight
35 min · intermediate
Quick quiz
Rerankers score…
Reranker scores are calibrated doubt probabilities.