The interviewer asks why you would add a reranker after vector search, and your job is to explain what the extra model call buys you. For more practice, get the free AI Engineer Interview Cheat Sheet (4 pages, 12 must-know questions with short model answers) and enter $0.
What the interviewer is checking
Can you explain how the system searches a large corpus quickly and still puts the most relevant results near the top? A clear answer follows a query through both stages.
- Retrieve. A bi-encoder embeds the query and each document separately. You can compute document embeddings ahead of time and put them in a vector index. At request time, you embed the query and search for nearby document vectors. Vector similarity is a proxy for relevance, and an approximate nearest neighbor index can also miss some of the closest vectors.
- Rerank. A cross-encoder reads the query and a candidate document together and scores the pair. It can account for how phrases relate across the query and document, including qualifiers that determine whether the document answers the question. Because the score depends on the pair, you need fresh model computation for each candidate. Doing that across the whole corpus is usually too slow for a live request.
A strong answer
I'd use the bi-encoder to find plausible candidates quickly and the cross-encoder to decide which ones should appear first. With the bi-encoder, I can embed and index documents before any query arrives. At request time I embed the query and look up nearby vectors. That gives me a shortlist, but a document can be close in embedding space because it's about the same topic while missing a condition the user asked for.
I'd score each shortlisted document with a cross-encoder. It reads the query and document together, so it can give more weight to whether the document actually satisfies that condition. I'd only run it on the shortlist because scoring every query and document pair would exceed the latency budget.
To choose the shortlist size, I'd sweep candidate counts on a labeled set of representative queries. I'd measure recall at k before reranking to see whether retrieval is finding the relevant documents. Then I'd compare mean reciprocal rank, or MRR, with and without reranking at the same final cutoff. MRR tells me how early the first relevant result appears. I'd pick a candidate count that gives a meaningful ranking improvement within the end-to-end tail latency budget. If retrieval misses a relevant document, the reranker has no chance to surface it.
Follow-ups to expect
- How would you set the candidate count? Look for where adding candidates yields little extra recall or final ranking improvement. Measure latency under representative load and with realistic document lengths. A wider shortlist gives the reranker more opportunities, but it also gives it more pairs to score.
- What if recall is high and MRR barely moves? Inspect queries where the relevant result starts low in the shortlist. Check whether the reranker promotes it, leaves it buried, or favors a plausible distractor. If the first relevant result already appears near the top for most queries, MRR has little room to improve.
- What if users need several relevant passages? Keep recall at the final cutoff alongside MRR. A system can place the first relevant passage near the top and still drop other passages the user needs.
The weak answer
A weak answer says vector search is fast and reranking makes it more accurate, then stops. That leaves the interviewer guessing what the cross-encoder reads, why it runs only after retrieval, and how you'd know if the extra work paid off. If you claim it fixes missed results, walk through a query where the relevant document never enters the shortlist.
A drill
Use a query about refund rules for an unopened item. Write a candidate list with a general refund policy, a passage about opened items, and a passage that directly addresses unopened items. Mark relevance before you rank them.
- Explain why the same-topic passages might appear high in vector search.
- Explain what the cross-encoder could use to put the directly relevant passage first.
- Remove that passage from the shortlist and say what happens to candidate recall and the reciprocal rank for that query.
Keep practicing
Practice giving the answer aloud, then defend your candidate count when the interviewer tightens the latency budget. For more prompts, see The 0 to 1 AI Engineer Interview Playbook (twenty chapters on RAG, agents, evals, fine-tuning and LLM system design), 30 percent off with code BF30 through Mon Nov 30.
Valenx Press. Practice material, no company affiliation, no interview promise.
Top comments (0)