Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Retrieval and Knowledge Systems

Free · sign in to start and track progress

1 · Building the index

  • 1Embeddings in practice
  • 2Chunking structured documents
  • 3Vector indexes and databases
  • 4Measuring retrieval

2 · Retrieval that reasons

  • 5Hybrid search and reranking

    Exercise answers

    • Answer: Build and measure a hybrid pipeline
  • 6Agentic retrieval
  • 7Knowledge graphs and GraphRAG
  • 8Long context versus RAG
CapstoneA measured retrieval service for cases and reference documentsReference implementation

Module 2 · Retrieval that reasons · Lesson 5

Hybrid search and reranking

Why keyword search still matters for precise, specialist text, how BM25 scores documents, how reciprocal rank fusion combines keyword and dense results, and when a cross-encoder or LLM reranker is worth its latency.

75 min 1 video 2 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvGet an OpenRouter keyLocal models with Ollama

By the end of this lesson you can

  • Compute BM25 term weights and explain the roles of IDF, term-frequency saturation (k1) and length normalisation (b)
  • Fuse BM25 and dense rankings with reciprocal rank fusion, by hand and in code, and explain why rank fusion beats score averaging
  • Explain the difference between bi-encoders, cross-encoders, late interaction and LLM rerankers, and estimate reranking cost and latency
  • Design a two-stage pipeline for case and reference-library search and decide from your eval whether each stage earns its place

On this page

  • BM25: the keyword half
  • Tokenisation is where BM25 is won or lost
  • Fusing two rankings
  • Worked example
  • Rerankers
  • Current options
  • What it costs
  • Do rerankers always help?
  • Putting it together
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01BM25: the keyword half
  2. 02Fusing two rankings
  3. 03Rerankers
  4. 04Connections
  5. 05Summary

Sources & further reading

  • The Probabilistic Relevance Framework: BM25 and BeyondPaper · Robertson, Zaragoza · 2009The authoritative account of BM25 by its co-creator. Section 3.4 derives term-frequency saturation and soft length normalisation; read it for why the formula looks the way it does.
  • Reciprocal Rank Fusion outperforms Condorcet and individual Rank Learning MethodsPaper · Cormack, Clarke, Büttcher · 2009Two pages that introduced RRF. Table 1 shows k = 60 is near-optimal but not critical; table 2 shows fusion beating the best individual system on most TREC collections.
  • Passage Re-ranking with BERTPaper · Nogueira, Cho · 2019The paper that made cross-encoder reranking standard. Short; the method section is a page.
  • ColBERT: Efficient and Effective Passage Search via Contextualized Late Interaction over BERTPaper · Khattab, Zaharia · Stanford · 2020Late interaction, the middle ground between bi-encoders and cross-encoders. Figure 2 compares the four architectures in one picture.
  • Is ChatGPT Good at Search? Investigating Large Language Models as Re-Ranking AgentsPaper · Sun et al. · 2023RankGPT. Listwise reranking with an LLM using a sliding window, and distillation of that ability into small rerankers. Read sections 3 and 4.
  • Voyage AI reranker documentationDocs · Voyage AIConcrete limits and token accounting for a commercial reranker, including instruction-following variants.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 5 more sections
  • 2 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks