Reranking
ELI5 - The Vibe Check
Reranking is the second opinion after your search engine hands you 50 maybe-relevant results. A smaller, smarter model looks at the actual question next to each candidate and re-sorts them by how well they truly answer it, instead of just how similar their embeddings looked. It's the difference between 'these words seem related' and 'this passage actually answers your question.'
Real Talk
Reranking is a second-stage retrieval step that takes the top-k candidates from an initial fast retriever (vector or keyword search) and reorders them using a more expensive but more accurate cross-encoder model that jointly scores the query and each document. It trades additional latency for significantly better relevance and is a standard component of production RAG pipelines.
Show Me The Code
candidates = vector_db.search(query_embedding, top_k=50)
reranked = reranker.rank(
query=user_query,
documents=[c.text for c in candidates]
)
top_chunks = reranked[:5] # feed only these into the prompt
When You'll Hear This
"Adding a reranker on top of vector search fixed most of our bad RAG answers." / "Retrieval brings back 50 chunks, reranking narrows it to the 5 that matter."
Related Terms
Embedding
An embedding is turning words, sentences, or entire documents into lists of numbers (vectors) that capture their meaning.
Hybrid Search
Vector search is great at understanding meaning but can miss an exact product code or acronym because it's thinking in vibes, not letters.
RAG (Retrieval Augmented Generation)
RAG is how you give an AI access to your private documents without retraining it.
Semantic Search
Semantic search finds results based on meaning, not just keyword matching.
Vector Database
A vector database is a special database built to store and search embeddings.