Özer Cem KELAHMETKELAHMET
AI Simulations · Agents

LLM cascade simulation: answer with a small model, escalate hard queries, and save cost

Most queries do not need the largest model. A cascade asks a cheap model first, lets a small scorer judge the answer, and pays for the large model only when the score is too low. Move the threshold and the prices and find where the cascade matches the large model for far less.

Download Markdown

Interactive simulation. It needs JavaScript; the text below explains what it shows.

What you are looking at

Each row is one query from a labelled evaluation set. The score column is what a small scorer model says about the cheap model's answer: how likely it is to be right. The last two columns say whether the small model and the large model actually answered correctly (1) or not (0). The orange columns apply your threshold: keep the small answer or escalate, whether the cascade ends up right, what the query costs, and the two kinds of mistakes.

The chart puts every query at its score, high if the small model was right and low if it was wrong. The step line is the decision: to the right of the threshold the small answer is kept, to the left the query goes to the large model. A good scorer puts the right answers on the right and the wrong ones on the left. The bars show the cost of each query: escalated ones pay for both models.

The algorithm

FrugalGPT (Chen, Zaharia and Zou) describes the LLM cascade: send the query to a list of models in order of cost, and after each one let a scoring function g(q, a) rate the answer. If the score is at least that model's threshold, stop and return the answer; otherwise ask the next model. In the paper the scorer is a small fine-tuned model (DistilBERT) trained on whether past answers were correct, so it is much cheaper than any of the LLMs it judges. This simulation uses two models:

a_i = 1 if g(q_i, small answer) ≥ τ, else 0

The cascade is right on query i if it kept a right small answer or escalated to a right large answer, c_i = a_i · s_i + (1 − a_i) · l_i, and the query costs c_S + c_g + (1 − a_i) · c_L. Every query pays for the small model and the scorer; only escalated queries pay for the large model. Accuracy is the mean of c_i, and cost per query is c_S + c_g + e · c_L, where e is the share escalated.

Two mistakes pull in opposite directions. Keeping a wrong small answer lowers accuracy; escalating a query the small model had right wastes money. Raising the threshold trades the first for the second, exactly like a classifier threshold in precision and recall.

Worked example. On this set the small model is right on 16 of 30 queries (53.3%) and the large model on 26 (86.7%). At τ = 0.7 the 14 queries scoring 0.71 or more keep the small answer: 12 are right and 2 (queries 7 and 12) are wrong. The other 16 are escalated and the large model gets 14 of them right. The cascade is right on 26 of 30, 86.7%, the same as the large model alone. It costs 0.6 + 0.05 + (16/30) × 15 = $8.65 per 1,000 queries instead of $15, a saving of 42.3%. The price of that saving is 4 needless escalations, small answers that were right but scored too low.

Things to try

  • Lower the threshold to 0.5. Only 30% of queries are escalated and the cost falls to $5.15 (65.7% saved), but 6 wrong answers are kept and accuracy drops to 73.3%.
  • Raise the threshold to 0.9. Accuracy rises to 90.0%, above the large model alone, because queries 4 and 14, which the large model gets wrong, keep the small model's right answer; the saving shrinks to 9.0%. FrugalGPT reports the same effect: a cascade can beat the best single model.
  • Set the threshold to 1. Everything is escalated and the cascade costs $15.65, more than the large model alone: the small model and the scorer are pure overhead.
  • Set the large model's cost to 5. At τ = 0.7 the saving falls to 33.7%: cascades pay off most when the price gap between the models is large.
  • Make the scorer better: give query 7 (a wrong small answer) a score of 0.3 and query 16 (a right one) a score of 0.9. At τ = 0.7 the cost stays at $8.65 but accuracy rises to 90.0%: the quality of the scorer decides how much a cascade can save.

How it works in real systems

The paper reports that a FrugalGPT cascade can match the best single model of the time (GPT-4) at up to 98% lower cost, or beat its accuracy by 4% at the same cost, on its evaluation datasets. Results like these depend on the data: the threshold has to be learned on labelled queries that look like your traffic, and checked again when the traffic or the models change.

Routing is the cheaper relative of the cascade: decide before calling any model. RouteLLM's routers predict the win rate of the strong model for a prompt and send it to the strong model only when that rate is above a threshold. Its README reports cost reductions of up to 85% while keeping 95% of GPT-4's performance on MT Bench, and recommends calibrating the threshold on a sample of your own queries for a target share of strong-model calls. A router pays for one model per query but cannot look at the answer; a cascade can, at the price of calling the small model on every query and of extra latency on escalated ones. See the LLM routing page for the design space.

Inside an agent the same idea applies per step: a cheap model for routine tool selection and summaries, the large model for planning or when a check fails. The scorer can be a trained classifier, a verifier such as unit tests, or an LLM judge, whose agreement with people you should measure first, see LLM judge agreement. A semantic cache in front of the cascade removes repeated queries before any model is called. Track the escalation rate in production: if it drifts, the threshold no longer means what it did.

Sources

Last updated Nov 24, 2026
Type to search.
    ↑↓ navigate↵ open