We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Re-ranking

We have another problem: our search might find 100 movies, but users only look at the top 5.

We need those 5 to be really good.

Vector Search Isn't Enough

Vector search is like using a book's summary to answer questions about it.

A summary is sometimes good enough to answer basic questions, and admittedly, it's fast and easy to use. If the summary doesn't have the answer, sometimes it's at least good enough to let you know if the full book might have it.

But summaries miss details, nuance, and context that only the full text can provide.

Solution: Two-Stage Search

  1. Stage 1: Fast BM25/cosine similarity search finds the top ~25 documents
  2. Stage 2: Slow re-ranking finds the best 5 from those ~25 candidates

Re-ranking works because it considers the query and full documents together to determine relevance. Unlike vector search (which pre-computes document embeddings) and BM25 (keyword matching), re-ranking waits until it has both the user's query and the full documents to do its work.

It's accurate, but it's much slower – we can't pre-cache anything.

So, we eliminate the majority of documents quickly with vector/keyword search, then do expensive re-ranking only on the most promising candidates.