Reranking
A reranker scores a smaller candidate set against the query to improve ordering after retrieval. Better ordering can improve evidence quality, at additional compute cost.
Before you start: Review Hybrid search first. Python-like examples use variables, lists and functions.
Follow the mechanism
Retrieve
Build a broad candidate set.
Start with an everyday explanation
A librarian first brings twenty possible books, then reads their summaries with your question to choose the best three.
See a concrete example
If retrieval takes 30 ms and reranking adds 60 ms in a hypothetical workload, pre-generation latency rises from 30 to 90 ms. Quality improvement must justify that budget.
A claim to question
A cross-encoder is not always faster or better for every domain and candidate set.
Try before revealing the answer
Choose between reranking 20 and 100 candidates under a 150 ms retrieval budget. State what you must measure.
Show the worked answer
Measure recall of each candidate set, reranker batch latency, final answer quality and p95/p99 under load. Do not select solely from average single-request timings.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
Bi-encoders encode query and documents independently and support reusable document vectors. Cross-encoders jointly score query-document pairs.
Measure candidate recall first: a reranker cannot recover a document never retrieved. Benchmark candidate count, truncation, batching and end-to-end tail latency.
Reason through the example
If retrieval takes 30 ms and reranking adds 60 ms in a hypothetical workload, pre-generation latency rises from 30 to 90 ms. Quality improvement must justify that budget.
Implement and test
Choose between reranking 20 and 100 candidates under a 150 ms retrieval budget. State what you must measure.
Inspect the reasoning and expected result
Measure recall of each candidate set, reranker batch latency, final answer quality and p95/p99 under load. Do not select solely from average single-request timings.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
Bi-encoder vs cross-encoder: what is the latency trade-off?
A defensible answer
Independent embeddings make broad retrieval efficient. Joint scoring usually costs more per pair but can improve relevance among candidates. Use two stages and justify candidate count through measured quality and tail latency.
Prepare the follow-up
How do you detect that document truncation removes the answer-bearing span?
Show follow-up reasoning
Record the text actually scored by the reranker and inspect whether answer spans were removed by length limits. Compare head-only, structure-aware or passage-level representations on the same labeled candidates, including long documents with relevant evidence near the end.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define reranking with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…