Track 02 · RetrievalLesson 04 of 11

Hybrid search and reranking

Keywords catch the codes and IDs that vectors miss; a reranker puts the best first.

What you'll be able to do

What you'll be able to do

01
  • Explain why dense retrieval misses identifiers, codes, rare jargon and exact phrases, and what lexical retrieval contributes.
  • Implement BM25, a code-aware tokeniser and reciprocal rank fusion, and explain every term in the BM25 formula.
  • Choose between rank fusion and score fusion, and set fusion windows and weights with evidence.
  • Design a reranking stage that fits a latency budget, with a fallback when the reranker is slow or down.
  • Diagnose a failed query by locating the stage (coverage, parsing, candidate generation, fusion, reranking, filtering or generation) where the right chunk was lost.
Before you start

Before you start

The short version

The short version

Dense embeddings match meaning; they are weak at exact strings. Enterprise queries are full of exact strings: container numbers, HS tariff codes, carrier codes, clause numbers, part numbers and product names. Hybrid search runs a lexical retriever (usually BM25) and a dense retriever side by side and fuses the results, so each covers the other's blind spots. A reranker, usually a cross-encoder, then reads the query and each top candidate together and reorders them, which buys precision at a latency cost. Retrieval quality is measured stage by stage, so that when an answer is wrong you know which stage lost the evidence.

  • Normalise codes the same way at ingest and at query time, or lexical search misses them too.
  • Reciprocal rank fusion is robust because it ignores incomparable scores; weighted score fusion can do better but needs normalisation and tuning per corpus.
  • For validated identifiers, an exact-match filter or boost on extracted metadata beats any fusion trick.
  • Rerank a bounded window (tens of candidates, not thousands) and degrade gracefully when the reranker times out.
  • Log candidates at every stage; stage-wise recall turns "the bot is wrong" into a fixable defect.

Pro lesson

The rest of this lesson is in Pro.

The mental model, worked example, field note, failure table, exercise and self-check, with the voice tutor.

Pro opens this stage

Stage 3 · Answers from their data
  • 4 lessons, with the voice tutor

Also in Pro

  • Every stage and specialisation, in full
  • Every lab and every role project
  • Halden weeks 2–10, on your record
  • Every drill, live in the playground
  • All solutions, plus the server judge
  • Lab Assistant and every Teach with AI