4.4.14 · D5Alignment, Prompting & RAG
Question bank — Reranking and hybrid search
True or false — justify
True or false: A cross-encoder can rescue a relevant document that hybrid retrieval failed to place in the top-100 candidates.
False. A reranker only reorders the candidate set it is given; if the document never entered the top-100, no rescoring can conjure it — recall must be fixed upstream. See Evaluation - Recall@k and MRR.
True or false: Hybrid search improves precision at the very top of the list.
False (mostly). Hybrid's job is recall — widening the net so the right chunk is somewhere in the candidates. Precision-at-top is the reranker's job. H before R: recall then precision.
True or false: Since BM25 and cosine are both "relevance scores", adding them gives a fair merged ranking.
False. BM25 is unbounded (can be 8, 40, ...) while cosine lives in , so BM25 arbitrarily dominates any sum. Use rank-based fusion (RRF) or normalise first.
True or false: A bi-encoder and a cross-encoder are just two names for the same thing.
False. A bi-encoder embeds query and doc separately (cheap, precomputable), a cross-encoder feeds them through the transformer together so every query token attends to every doc token (accurate, not precomputable).
True or false: In RRF, a document ranked #1 in one list always beats a document ranked #2 in both lists.
False. With : #1-only gives , while #2-in-both gives . Cross-verified evidence wins — that is the whole point of fusion.
True or false: Increasing the LLM's top- context is a valid substitute for reranking.
False. LLMs suffer lost-in-the-middle: a relevant chunk buried among 50 dilutes attention, raises cost/latency, and increases hallucination. Reranking to a tight top-5 is the fix.
True or false: Cosine similarity ignores the magnitude (length) of the embedding vectors.
True. divides out both norms, so it measures direction/angle only — useful because embedding magnitude often reflects token count, not meaning.
True or false: RRF requires the two retrievers' scores to be on the same scale.
False — that's its main virtue. RRF uses only ranks (positions), never raw scores, so BM25's unbounded scale and cosine's scale never have to be reconciled.
Spot the error
"We embed the query with a cross-encoder and do nearest-neighbour search in the vector DB." — what's wrong?
A cross-encoder produces no standalone query vector — it only scores a
(query, doc) pair jointly. Nearest-neighbour search needs a bi-encoder embedding. Cross-encoders are rerankers, not retrievers."BM25 will match the query 'car' to a document that only says 'automobile'." — what's wrong?
BM25 is lexical: it matches surface tokens, and "car" ≠ "automobile" as strings. Catching synonyms is the dense/semantic retriever's job — the exact reason we need hybrid.
"To save cost, run the cross-encoder over the whole million-doc corpus once and cache the scores." — what's wrong?
Cross-encoder scores depend on the query, so they can't be precomputed per document — a new query means a fresh forward pass. That's why it runs only on the ~100 pre-retrieved candidates, not the corpus.
"We set in BM25 to make length normalisation stronger." — what's wrong?
Backwards. controls normalisation strength: ignores document length entirely, applies full normalisation. The usual is a middle ground.
"RRF with is best because it removes the smoothing that muddies the ranking."
With , rank 1 contributes and rank 2 contributes — a huge, winner-take-all gap. The RRF constant deliberately softens the gap so consensus across lists can compete with a single #1.
"Since embeddings capture meaning, dense search alone will reliably find the error code 'ERR_4092'."
Codes and rare tokens have weak, unstable embeddings; semantic search may return "nearby" but literally wrong chunks. Exact-token matching (BM25) is what reliably surfaces
ERR_4092."Our recall is fine — the reranker's job is to increase how many relevant docs we find."
A reranker cannot find anything new; it can only reorder existing candidates. It improves precision-at-top, never recall. Recall comes from retrieval (hybrid).
Why questions
Why does BM25 use a saturating term-frequency function instead of counting occurrences linearly?
Because relevance has diminishing returns: the 50th "cat" adds almost nothing over the 5th. As term frequency the score saturates toward , capping any single term's influence.
Why does IDF give rare terms a larger weight than common ones?
Rare terms (e.g. "photosynthesis") are discriminating — they separate relevant from irrelevant docs — while common terms ("the") appear everywhere and carry no signal. With = total docs and = docs containing the term, IDF grows as shrinks.
Why is a bi-encoder faster than a cross-encoder at query time?
Bi-encoder doc embeddings are computed offline once and stored; at query time you only embed the query and do fast approximate nearest-neighbour lookup. A cross-encoder must run a fresh joint forward pass per candidate per query.
Why does RRF reward documents that appear in both retrievers' lists?
Each list contributes an additive term. A doc present in both lists collects two contributions, so consistent-but-middling evidence can outscore a single top hit — fusion prefers cross-verified relevance.
Why do we retrieve broadly first and rerank narrowly, rather than rerank everything?
The cross-encoder costs one forward pass per document, which is infeasible over a corpus. Cheap retrieval (BM25 + bi-encoder) narrows to ~100; the expensive scorer then pays its cost only on those 100.
Why does hybrid search hurt neither retriever even when one is "wrong" for a given query?
Merging is by union of candidates plus rank fusion; a retriever that misses simply contributes nothing useful, while the other still surfaces the right chunk. You gain the strengths of both without either vetoing the other.
Edge cases
If a query term appears in every document in the corpus, what does its IDF contribute?
Near zero. With (term in all docs), , so the term is treated as non-discriminating — exactly right, since it can't distinguish any document.
A document is retrieved by only one of the two retrievers (rank 3), and nothing else. What is its RRF score with ?
Just — a single contribution. It can still rank respectably, but a doc appearing in both lists at similar ranks will typically edge it out.
Two documents tie exactly on the cross-encoder score. How is the final top- order decided?
The cross-encoder gives no further signal, so ordering falls back to an implementation tie-break (e.g. original candidate order or hybrid RRF score). Genuinely tied relevance means the choice is arbitrary — flag it, don't over-interpret.
What happens to cosine similarity when a document embedding is the zero vector (empty/degenerate chunk)?
The norm makes the cosine formula divide by zero — undefined. Such degenerate chunks must be filtered before indexing; a zero vector has no direction, hence no meaningful angle.
If the corpus has exactly one document, is reranking useful?
No. With a single candidate there is nothing to reorder and no precision to gain — reranking's value only appears when many candidates compete for the top- slots.
For a query with no lexical overlap with any document (all novel synonyms), which retriever carries the load?
The dense retriever, since BM25 finds zero matching tokens and scores everything at ~0. This is precisely the "car vs automobile" case that motivates adding semantic search.