Several phrasings fused with RRF
The variants are written by hand here. In production a model writes them, with the guards of Topic 7.2.
One question can be several questions, or one question in several phrasings. Search with each, then fuse the ranked lists with reciprocal rank fusion so passages that several searches agree on rise to the top.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write split_parts(question) that splits at " and " only when each part has at least two words (by split()). Print the parts for "What does the pass cost and do I need a helmet?" and for "Tea and coffee?", joined with " | ".
Write rrf(rankings) returning "id score" pairs (4 decimals) for lists [["a", "b"], ["b", "c"]], best first, with 1 / (60 + rank).
Explain it without notes
Why can a single search miss half of a compound question?
How does reciprocal rank fusion combine lists, and why does it not need comparable scores?
What are the risks of splitting a question by rule, and how do you reduce them?
When is multi-query not worth it?
Expected output
What if my bike breaks? -> D5, D7, D9
damaged report -> D5
flat tyre repair -> D10
first phrasing alone: D5, D7, D9
fused: D5 0.0328, D10 0.0164, D7 0.0161, D9 0.0159