Hybrid Search and Re-ranking
Run keyword and vector search together, fuse them with reciprocal rank fusion, re-rank a shortlist, keep results diverse, and measure whether each stage pays.
Phase 1 gave you keyword search and Phases 2 and 3 gave you vector search. Each one wins questions the other loses: keywords find exact codes, numbers and rare names, vectors find paraphrases. This phase puts them together. You will see both kinds of question side by side, learn why their scores cannot be added directly, and build reciprocal rank fusion (RRF) by hand until you can reproduce the Fused column of the search lab with your own code.
Then comes a second stage. A cross-encoder reads the question and one passage together and gives a much sharper relevance score than a single vector can, but it is too slow to run on everything, so it only re-orders a shortlist. You will build that retrieve-then-re-rank pipeline, choose the size of each stage, keep results diverse with maximal marginal relevance, and learn to ask the question every added stage must answer: does it pay off on *your* questions?
The phase ends by upgrading AskDocs to hybrid retrieval with a re-rank stage behind the same retrieve interface, compared with the earlier versions by a small test harness, and a playbook of recipes to copy. A cross-encoder cannot run inside these examples, so a clearly labelled toy scorer stands in for it. The search labs use the real embedding model, so the scores they show are real.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.