Loading...
const hits = await search(query, { limit: 5 });
const top = await rerank(query, hits);const candidates = await search(query, { limit: 50 });
const scored = await rerank(query, candidates);
const top = scored.slice(0, 5);Fetching more candidates first gives the reranker a real chance to find the best five.
A model that reads the query and a document together and outputs one relevance score. It is more accurate than comparing separate embeddings, but slower.
Often a few dozen. More can raise recall but adds latency, so measure on your own queries.
Yes. A language model can score or order candidates, but it is usually slower and costlier than a dedicated reranking model.