AI agents

When a Reranker Pays for Itself Against a Bigger Cap

Antonio Evans8 min read

A whiteboard split in two: a narrow funnel labeled Cap 20 with a dollar sign for rerank cost, a wide funnel labeled Cap 50 with token counts, and a balance scale between them tipping toward break-even.
Key points

Key points

  1. 1Reranking costs roughly (N/1000) times the price per 1,000 scored documents, where N is the candidate count you send it.
  2. 2Raising the cap costs (larger cap minus smaller cap) times average tokens per row times the input token price.
  3. 3Reranking wins when each retrieved row is expensive to carry (long documents, code, transcripts) and loses on short factoid lookups with cheap context.
  4. 4The fair comparison reranks N candidates and keeps k, versus skipping the reranker and sending the larger cap, because both must reach the same answer quality.

Why the cap is a bill, not a setting

Top-k feels like a relevance knob. It is a spending knob. Every row you keep is tokens, and tokens are charged twice: once when the model reads the prompt and, if caching is not in play, again on every related call in the same conversation. A team that "just bumps k to 20" has quietly multiplied the most expensive part of the request.

The cost is not only money. Longer prompts raise latency, and models do not attend evenly across a long context. Research on multi-document question answering found performance is often highest when relevant information sits at the beginning or end of the input, and degrades when the model must reach material buried in the middle, even for models built for long context Lost in the Middle. That matters here: a bigger cap does not just add tokens, it pushes good rows toward the middle where they are used less reliably.

There is direct evidence that adding a wrong row hurts. A distracting-passage study found one hard distractor cut accuracy by 6 to 11 points depending on the model, with Llama-3.2-3B dropping from 82.6 with only the relevant passage to 71.5 with one distractor Splunk's reranker guide. A reranker that removes a distractor is not only saving tokens, it is protecting accuracy.

So the decision is not "rerank or don't." It is "pay the reranker, or pay the context." Both have a price, and the prices are comparable once you write them down.

The arithmetic: rerank cost versus cap cost

Two formulas cover most of it.

Rerank cost per query = (N / 1,000) x P, where N is the number of candidate documents you score and P is the reranker price per 1,000 documents.

Context cost saved per query = (K_large - K_small) x T x C, where K_large is the cap you would need without a reranker, K_small is the cap you keep with one, T is average tokens per retained row, and C is the generator's input token price.

The decision rule: if rerank cost per query is less than context cost saved per query, the reranker pays for itself. If it is more, raise the cap instead.

A third term is worth tracking: latency. Real reranker comparisons report median latency alongside score and cost, for example 0.18 seconds for one reranker and 0.28 for another on the same 50-candidate setup Kapa's reranker benchmark. Reranker latency is a line item, not a rounding error, especially in voice or interactive search.

Worked example 1: short factoid support queries

Suppose you retrieve N = 50 candidates, keep k = 5, and the reranker is priced at $2.00 per 1,000 documents scored. That is 50/1,000 x $2.00 = $0.10 per query.

Now suppose the no-reranker alternative needs a cap of 20 rows to hit the same answer quality. Each row of a short FAQ chunk is about 150 tokens, and the generator charges $0.50 per million input tokens. Saved tokens per query are (20 - 5) x 150 = 2,250. Saved cost is 2,250 / 1,000,000 x $0.50 = $0.001125.

Reranking costs $0.10 to save $0.001. That is roughly 89 times more expensive than the tokens it removes. Raise the cap. For short chunks, the reranker cannot pay for itself on token savings alone.

Worked example 2: long document or code queries

Same N = 50, same $2.00 per 1,000 documents, so rerank cost is still $0.10. But each row here is a 2,000-token code or contract section, and the generator charges $3.00 per million input tokens, which is realistic for larger frontier models.

Saved tokens: (20 - 5) x 2,000 = 30,000. Saved cost: 30,000 / 1,000,000 x $3.00 = $0.09 per query.

Still not quite break-even. Now change one assumption honestly: to reach the same quality without a reranker, you need a cap of 30, not 20, because so many candidates are near-duplicates. Saved tokens become (30 - 5) x 2,000 = 50,000, and saved cost is $0.15 per query. The reranker now nets $0.05 per query before latency.

That is the shape of the answer. Reranking pays when rows are long, when the larger cap must grow disproportionately to compensate, or both.

VariableFactoid support queryLong code or contract query
Candidates scored (N)5050
Cap with reranker (k)55
Cap needed without reranker2030
Average tokens per row1502,000
Generator input price per 1M tokens$0.50$3.00
Rerank cost per query$0.10$0.10
Tokens saved per query2,25050,000
Context cost saved per query$0.0011$0.15
VerdictRaise the capRerank

The two examples are the decision rule in miniature, and the table is the artifact to hand to whoever owns the budget.

Measuring the real cap you would need

The formulas only work with honest inputs, and the hardest input is K_large: the cap you would need without a reranker to match quality. Nobody knows that number from intuition. You get it from an evaluation set.

Use a fixed question set with an answer key, run the pipeline at several caps without a reranker, and record quality at each. Then run the reranked pipeline at k and compare on the same questions with an explicit quality criterion. That is exactly how retrieval latency experiments are framed: treat a smaller candidate set and a reranker as hypotheses, and watch for the specific failure mode of evidence falling outside the set Supermemory's latency budget guide.

Two practical cautions on measurement:

  • Do not compare a reranked run at k = 5 against a non-reranked run at k = 5 and conclude the reranker "improves quality." The fair comparison is against a bigger cap that reaches the same quality.
  • Keep retrieval and generation time separate in your traces. A reranker's 200 to 500 ms can be invisible in total response time and still blow a voice budget Supermemory.

If you are assembling this across several providers, one API key for the generator and another for the reranker is a second budget to reconcile; Quanta Inference puts text, embedding and other model calls behind a single OpenAI-compatible key priced in US dollars, which keeps the per-query math in one place.

Why reranking and cap changes are not substitutes

It is tempting to treat these as two ways to "get more recall." They act on different rows.

Raising the cap admits more rows and lets the generator sort it out. Reranking reorders the rows you already retrieved and discards the rest. The difference shows up exactly where bi-encoder retrieval is weakest: negation, contrast, rare identifiers. One reproduction of the NevIR benchmark reports most bi-encoders scoring 5 to 12 percent pairwise accuracy on negation pairs, while the cross-encoder jina-reranker-v2-base-multilingual reaches 65.2 percent and a listwise LLM reranker reaches 77.3 percent Splunk. No cap increase fixes "I love apples" versus "I used to love apples," because both rows are similar to the query in embedding space.

This is where practitioners should stop looking at token math alone. If your failures are ordering failures, a bigger cap adds more of the same confusion. If your failures are coverage failures, the relevant rows were never retrieved and a reranker has nothing to promote; the fix is a wider first-stage retrieval, which is the "raise the cap" path.

A useful diagnostic: sample 50 failed queries and check whether the correct passage was in the candidate pool at N. If it was in the pool but outside the top k, reranking addresses it. If it was never in the pool, rerank and cap both miss, and you need better retrieval or a larger N.

Cost per 1,000 queries: the number to compare

Teams argue about prices per document and per token because they never convert both to the same unit. Convert everything to cost per 1,000 queries. It is the only figure a finance owner will read.

rerank_cost_per_1k   = (N / 1000) * price_per_1k_docs * 1000
context_saved_per_1k = (K_large - K_small) * tokens_per_row * price_per_1M / 1e6 * 1000
break_even_pool      = context_saved_per_1k / (price_per_1k_docs * 1000 / 1000)

Working the factoid example at 1,000 queries: rerank cost is $100.00, context saved is $1.13. The break-even candidate pool, the N at which cost equals savings, is about 1.1 documents. That is not a pool. It tells you no realistic N makes the reranker pay on token savings for that query type.

Working the code example: rerank cost is $100.00, context saved is $150.00. Here the reranker nets $50 per 1,000 queries. If median reranker latency is 0.18s and your query volume is 2 million a month, the added wall-clock time is 360,000 seconds spread across your capacity, which is a throughput question, not a per-query one Kapa.

One more lever that changes the arithmetic: prompt caching. If the retrieved context were placed inside a cached prefix, the input price falls to a fraction on cache hits, which shrinks the context cost saved and makes reranking look worse. Placing the document in the user message rather than the system message keeps the cacheable prefix stable ML4Devs' context budget guide. Count your cache hit rate before you trust the token savings estimate.

A per-query-type decision procedure

Run this once per query type and write the verdict down. Revisit quarterly, not per incident.

  1. Sample 50 to 100 real queries of the type and label whether the needed evidence exists in your candidate pool. This separates ordering failures from coverage failures.
  2. Set N to the pool size your first stage already produces (a common choice is 50 when a reranker scores one document per call) Kapa.
  3. Compute rerank cost per query: (N/1,000) x reranker price.
  4. Find K_large empirically: the smallest cap without a reranker that matches the reranked k on your labeled set.
  5. Measure average tokens per retained row, not a guess. Long tool outputs spike unpredictably and inflate it Mem0's context engineering guide.
  6. Compute context cost saved per query.
  7. Decide with the margin, not the tie. If saved cost is less than twice rerank cost, you are near the noise floor of your evaluation and should default to the simpler pipeline.
SituationCheaper optionWhy
Rows under about 200 tokens, cheap generatorRaise the capToken savings are tiny
Rows over about 1,000 tokens or expensive generatorRerankEach removed row is worth more
Needed evidence never in the poolFix first-stage retrievalNeither lever helps
High query volume, tight latency budgetRaise the cap, then revisitReranker latency is additive
Heavy near-duplicate rowsRerankCap must grow disproportionately otherwise

The last row is the insight worth carrying: reranking's value scales with how inefficient the cap has to be to compensate. When top results are redundant or distractors are common, the larger cap grows faster than the good rows do, and the reranker wins by removing rows rather than adding them.

If the workload splits cleanly by query type, route on it. A short routing step by query class (factoid, code, long document) lets you raise the cap where it is cheap and rerank where rows are expensive. That routing logic, and the per-type break-even table above, is a good fit for a short consulting engagement where someone reviews your traces with you.

FAQ

FAQ

Does reranking always improve quality?

No. Reranking improves ordering: it moves relevant rows up and pushes distractors out, which is where the documented accuracy gains come from Splunk. If the correct passage was never retrieved, a reranker has nothing to promote, and you should widen first-stage retrieval instead. Test quality at fixed k against a larger cap before attributing gains to the reranker.

How do I choose N, the number of candidates to rerank?

Start from the pool your first stage already returns, since many production setups score around 50 candidates per query Kapa. Then check whether the needed evidence is inside that pool using labeled failures. Increasing N costs money linearly, so only raise it when misses are coverage failures, not ordering failures.

Is a large language model a cheaper reranker than a specialized model?

Almost never for pointwise scoring. One benchmark reports pointwise LLM reranking at roughly 10 times the cost of a specialized reranker with lower accuracy, while listwise LLM reranking shows modest gains at about 9 times the cost and 35 times the latency ZeroEntropy's guide. The pragmatic pattern is a specialized reranker on a wide pool, then an LLM on the final short list only.

Where does the context budget actually go?

Into the system prompt, tool definitions, conversation history, tool results and retrieved context, and tool results are the component that spikes unpredictably Mem0. Measure average tokens per retained row from real traces, including those spikes, or your tokens-saved estimate will be wrong in the optimistic direction.

What should I do first if I cannot measure quality?

Instrument before deciding. Record retrieval start and end, rerank time, model time and first token, and keep failures in the sample, because failed requests that return early can fake a speed win Supermemory. Once retrieval and generation time are separated, you can compute both sides of the break-even with numbers you own rather than vendor defaults.

Sources

Sources

  1. Lost in the Middle: How Language Models Use Long ...
  2. How to Select the Right Reranking Model
  3. Jev is NOT a state-of-the-art reranker (but it's close)
  4. Latency Budgets for Memory Retrieval
  5. How to Budget an LLM Context Window
  6. Context Engineering in Multi-Turn AI Agents
  7. Should You Use an LLM as a Reranker? Pros, Cons, and ...
About the author

About the author

Antonio Evans
Antonio Evans

Antonio Evans is the founder of Quanta Intelligence and a fractional CTO who builds HIPAA-ready AI systems for health and life-science companies. Before that he was technical co-founder of FriendsEAT for twenty years, CEO of Socialdraft, and a data engineer at IBM. Antonio lives with his dog Santino in Lisbon, Portugal.

All articles