Sub topic 15
Cross-Encoders Versus LLM-Based Rerankers
This chapter assumes you have built a retrieve-then-rerank pipeline with a cross-encoder, know how candidate depth affects latency, and can read recall@k, MRR, and nDCG. It compares the cross-encoder you already know with rerankers built on large language models (LLMs), and gives criteria for choosing between them.
What an LLM reranker is
An LLM reranker asks a general-purpose language model to judge relevance. The model is usually much larger than a cross-encoder and is prompted instead of fine-tuned for scoring. There are three common styles:
- Pointwise: The prompt contains the query and one passage. The model answers "yes" or "no", or gives a grade. You use the probability of "yes" as the score.
- Pairwise: The prompt contains the query and two passages. The model picks the better one. You repeat this comparison to build an order.
- Listwise: The prompt contains the query and many passages. The model outputs a new ordering, often as a list of passage identifiers.
A cross-encoder is a pointwise scorer with a small regression head. An LLM pointwise reranker has the same shape but a much larger model and a text prompt.
Comparing the two
| Property | Cross-encoder | LLM reranker |
|---|---|---|
| Model size | Tens to hundreds of millions of parameters | Billions of parameters |
| Latency per candidate | Milliseconds on a GPU or CPU | Much higher, often hundreds of milliseconds or more |
| Training | Needs relevance labels for your task | Works zero-shot from a prompt |
| Output | A numeric score per pair | A score, a choice, or generated text |
| Failure style | Truncation, domain mismatch | Parse errors, position bias, run-to-run variation |
| Cost control | Predictable, you host it | Per-token pricing or large GPU memory |
Where LLM rerankers help
- Unfamiliar domains. A cross-encoder trained on web search data may do poorly on legal or medical text. An LLM often copes without retraining.
- Reasoning-heavy queries. If relevance depends on multi-step reasoning or following an instruction ("find passages that contradict this claim"), an LLM can use that instruction. A standard cross-encoder cannot.
- Long passages. Many LLMs accept far more than the 512 tokens that typical cross-encoders allow.
Where they hurt
- Position bias. In listwise prompts, models tend to favor passages that appear early. Shuffling the input order and averaging runs reduces this, at extra cost.
- Context limits. A listwise prompt with 100 passages may not fit. Practitioners use a sliding window over the list, which adds calls.
- Unstable output. A generated ordering can omit or repeat passages. You must validate it and fall back to the first-stage order.
- Cost and latency. Reranking 50 candidates means 50 pointwise calls or several long listwise calls on every query.
A decision rule
Start with a cross-encoder. It is cheap, fast, and measurable. Evaluate it against your first-stage baseline with the metrics from earlier chapters. Move to an LLM reranker only when both of these hold:
- The cross-encoder's nDCG or MRR on your own labeled queries is clearly below what you need.
- Your latency and cost budget allows a model orders of magnitude larger.
A common compromise is a cascade. The cross-encoder trims 100 candidates to 10, and the LLM reorders only those 10. This keeps LLM cost bounded while giving it the hardest decisions.
Whichever you choose, compare on the same query set with the same metrics. Do not judge by a few hand-picked examples.
Exercise
Your cross-encoder reranks 50 candidates in 80 ms, and you are considering an LLM that scores each candidate in 300 ms with no batching. Name one design that keeps the LLM in the pipeline while keeping latency reasonable, and one risk of using it.
Show answer
Use a cascade: let the cross-encoder cut the 50 candidates to about 5 to 10, then have the LLM rerank only those. This limits LLM calls to a small number. A risk is that the cross-encoder may drop a relevant passage before the LLM sees it, so the final quality is capped by the cross-encoder's recall at that cutoff. Other valid risks are position bias or unparseable output.