Sorting's Real Face in AI: Rerank
Last lesson’s sort compared number size; in the AI world we rank “relevance”: RAG scoops a pile of passages from the knowledge base, and whoever ranks first squeezes into context—rank wrong, and the model will solemnly cite the wrong material. That “score + re-rank” step is Rerank. Today you’re on the job: play Rerank yourself.
Scenario: a user asks the support bot “What’s your return policy?”, and coarse ranking scoops 5 candidate passages from the knowledge base. Each has three scores: vector similarity (close in meaning), keyword hit (literal match), freshness (how new the doc is). You’ve got three weight sliders; total = weighted average of the three. Watch: at first only similarity is heavy, so #1 is actually the 2023 outdated policy—crank up “freshness” and see the right clause climb to the top.
What you just did is “fine ranking” in a real system—the last layer of the funnel. The full flow looks like this (auto-plays when you scroll here):
Why not fine-rank everything?
Expensive. Fine ranking feeds “question + passage” pairs into a model one by one. Do that for a million rows and you’ll wait an hour and burn a budget. So cheap coarse ranking cuts a million down to 50 first.
Why not coarse-rank everything?
Inaccurate. Coarse ranking only sees vector distance—it can’t tell “current policy” from “old policy,” as you just watched. So the last 50 need the costly model to gatekeep one by one.
Search result ranking
Search engines coarse-recall from trillions of pages, then fine-rank by relevance, authority, and freshness—the first page you see is Rerank’s output.
Recommendation feed
Short video first coarse-filters thousands of candidates, then a fine-rank model scores “will you finish watching?” one by one. Your home feed order gets re-ranked dozens of times a day.
RAG retrieval
Today’s home field: vector neighbors for a coarse scoop, Rerank for the fine pick—only the last few earn precious context. Remember last chapter’s O(n²) bill?
What this lesson wants to share
- Sorting’s real face in the AI era is score + re-rank: it’s not number size—it’s relevance score
- Weights are values: similarity alone floats old material; multi-dimensional scoring is what you can trust
- Two-stage funnel: coarse ranking is fast and rough for casting; fine ranking is costly and precise for the finals
- Layering the funnel is the art of saving money: search, recommenders, and RAG are all “retrieve first, rank second”