LLM-Based Reranking
In this article
- Write a pointwise, a batched-selection and a listwise reranking prompt, and say what each one asks the model to judge.
- Repair a malformed ranked list from a model into a full, deterministic ordering.
- Count the input tokens of a reranking prompt and say how many candidates fit a token budget.
- Decide whether an LLM reranker earns its place next to a cross-encoder, using an order-reversal check and a frozen comparison.
- Terms defined here: LLM-based reranking.
Overview
The store's help search returns 50 candidate passages for a customer's question, and a cross-encoder, a small model that reads the question and one passage together, puts them in order. Then someone asks the obvious question: a large language model can read a warranty clause and follow a rule about it, so why not let it do the ordering?
You can. But a model that ranks by writing text brings new problems: its answer may not be a clean list, its verdict can depend on the order of the passages, and every candidate costs tokens and seconds. You will write the three common prompt shapes, repair a broken answer in code, count its tokens, and decide with numbers whether it beats the cross-encoder.
This article is part of Pro
Pro includes the staff-level and expert articles in every path. It opens after the four core paths are complete.
Still to read in this article
- What the model is asked
- Three ways to ask
- One listwise prompt
- Repairing the answer
- What it costs
- Does the order of the passages matter?
- Cross-encoder or LLM
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions