Tillbaka till ordlistan Teknik

Reranking

Teknik för att förbättra RAG-system genom att omordna hämtade dokument baserat på semantisk relevans.

What Is Reranking?

Reranking is a technique that improves search and retrieval quality by applying a second, more sophisticated relevance model to an initial set of retrieved results. In a typical pipeline, a fast but approximate first-stage retriever (like vector similarity search) pulls a broad set of candidates, and then a reranker carefully evaluates each candidate against the original query to produce a more accurate relevance ordering. This two-stage approach combines the speed of approximate retrieval with the precision of detailed relevance scoring.

Why Reranking Improves Results

The reranker sees both the query and each candidate document together, enabling it to assess fine-grained relevance that embedding similarity alone might miss.

Implementation in RAG Pipelines

First-stage retrievers based on embedding similarity are fast but imperfect. They sometimes surface results that are topically related but do not actually answer the query, or miss subtle relevance signals in longer documents. Rerankers, typically cross-encoder models, process the query and document together through a transformer, capturing nuanced interactions between query terms and document content that independent embeddings cannot represent.