Vector search with a bi-encoder is fast, but it sometimes returns chunks that share similar wording without actually answering the question. A re-ranking step improves precision by scoring the query and each candidate together. A cross-encoder re-ranker, for example Cohere Rerank or the open-source cross-encoder/ms-marco-MiniLM-L-6-v2, takes the first vector results and scores each one against the query.
What you need
- A vector search that returns a broad candidate set
- A cross-encoder re-ranker, hosted or local
- A note of how many candidates to retrieve and how many to keep
Step 1: Retrieve a broader set than you need
Retrieve the top 20 chunks with vector search. Those depths are starting points, not rules.
Step 2: Score each candidate against the query
Pass each candidate together with the query to the cross-encoder and record its score. The cross-encoder reads the query and the chunk together, which is why it is more precise than the vector score alone.
Step 3: Keep the shortlist and check it
Keep the top 4 scored chunks for the prompt and read them. If a kept chunk does not answer the question, the re-ranker or the candidate set needs adjusting.
Worked example: synthetic re-ranking of 20 candidates
The table below is a synthetic example. It shows the expected result of re-ranking; no model was run.
| Stage | Chunks | Result |
|---|---|---|
| Vector retrieval | 20 | Broad set |
| Cross-encoder scoring | 20 scored | Ranked by relevance |
| Shortlist kept | 4 | All answer the question |
| Dropped | 16 | Similar wording only |
Expected result (UNTESTED). re-ranking keeps 4 chunks that answer the question and drops 16 that only share wording with it. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Re-ranking costs a second pass, so it is slower than vector search alone; keep the candidate set modest.
- The depths of 20 retrieved and 4 kept are starting points; adapt them when your domain is more specialised.
- A cross-encoder scores the query and chunk together, so it cannot reuse the precomputed vector index.
- If the right chunk never reaches the candidate set, no re-ranker can rescue it; fix retrieval first.
