Cascading is a pattern, often called an LLM cascade or model cascade, that tries a cheaper or faster model first and only escalates to a more expensive model if the initial response fails a quality check. It reduces average cost and latency by handling easy queries with lightweight models.
At a Glance
- Problem: Upfront routing must judge a query's difficulty before any answer exists, and that judgment is often wrong. Defaulting to the expensive model overpays on easy queries; defaulting to the cheap model gives bad answers on hard ones.
- Forces: Cost per query versus answer quality on hard queries; low latency on easy queries versus stacked latency when a query falls through every tier; a strict quality gate that wastes money versus a lenient one that lets bad answers through.
- Solution: Send each query to the cheapest model first and check the response with a quality gate built from logprobs, self-check, a judge model, or deterministic rules. Escalate to the next tier only when the gate fails.
- Consequences: Gains: roughly 70 to 80% savings when about 80% of queries resolve at the cheap tier, and difficulty is judged from real output. Costs: added complexity, extra latency on hard queries, paying twice on every escalation (an escalation rate above 50 to 60% signals that the cheap model or the gate needs work, and savings shrink fast), and a gate that needs ongoing tuning.
What problem does Cascading solve?
Picking the right model for a query is hard. A model router decides upfront, classifying the query before sending it to a model, and the classifier makes mistakes. Some queries that look simple turn out to be tricky, and some that look complex are straightforward once the model starts working on them. Sometimes you only learn how hard a query is after you have attempted an answer.
That leaves you choosing between two bad defaults. If you default to the expensive model, you overpay on the majority of queries that a cheaper model could handle. If you default to the cheap model, you produce bad answers on the queries that needed more capability. A model router improves this, but any upfront classifier will misroute some requests. What you want is a way to make the routing decision after seeing the output rather than before.
Small models also keep improving. A 7B parameter model today can handle tasks that required a 70B model a year ago, though it will not handle them every time. Small models are often right and sometimes confidently wrong, so you want to use them when they work and escalate when they do not.
How does an LLM model cascade work?
Cascading reverses the order of upfront routing. Instead of deciding which model to use before generating a response, you start with the cheapest model and evaluate the result. If the result passes a quality gate, you return it. If it does not, you escalate to the next model tier and try again.
Think of it as a series of attempts. The first tier is a small, fast, cheap model. Its response goes to a quality gate, which checks whether the model expressed uncertainty, whether the logprobs fall below a confidence threshold, and whether a quick consistency check passes. If the response clears the gate, it ships; otherwise the query moves to the next tier.
The second tier is a mid-range model that goes through the same generate-and-check step. If its response passes the gate, you return it, and if not, the query escalates to the premium tier. The premium tier is your safety net, the most capable model you have access to, and its response goes to the user whatever the gate says (though you might flag low-confidence responses for human review).
The quality gate determines how well the whole cascade works, and you can build it in several ways.
Logprob-based gates look at the model's own confidence in its output. If the average token probability is below a threshold, the model was uncertain and escalation is warranted. This is cheap to compute because logprobs come back with the generation itself. The downside is that models can be confidently wrong, so high logprobs do not guarantee correctness.
Self-check gates ask the model to evaluate its own response. "Are you confident in this answer? Rate your confidence from 1 to 5." This uses an additional cheap LLM call but can catch some cases where the model was wrong despite high token probabilities. The model's self-assessment is imperfect but useful as one signal among several.
LLM-as-Judge gates use a separate model (often the same cheap tier) to evaluate the response. "Does this response fully answer the question? Is it factually consistent?" This costs more than a logprob check and is more reliable than self-assessment.
Deterministic gates apply hard rules. If the response contains "I am not sure" or "I do not have enough information," escalate. If the response is suspiciously short for a question that should require a detailed answer, escalate. These rules are simple and catch the obvious failures.
In practice, gates work best when they combine several signals. High logprobs plus a passing self-check plus no hedging language might be your threshold for accepting a cheap model's response.
Which quality gate should you use?
Start with the gate that checks the answer most directly, and add model-based judgment only for what rules cannot test.
| Gate | What it checks | What it misses | Added cost and latency |
|---|---|---|---|
| Programmatic check (schema, unit test, query runs, cited source exists) | A property you can verify in code | Anything the check does not cover, such as a well-formed but wrong value | Very low |
| LLM-as-Judge | Whether the answer addresses the question and agrees with the context | Errors the judge model shares with the generator | One extra model call |
| Self-check or self-consistency | The model's own doubt, or disagreement between samples | Mistakes the model repeats confidently | One or more extra calls |
| Logprob threshold | How certain the model was while generating | Confidently wrong answers | Close to zero where the API returns logprobs |
| Hedging and length rules | Refusals, "I am not sure", suspiciously short replies | Fluent wrong answers | Close to zero |
How do you set the escalation threshold?
A gate that returns a score needs a cut-off. Choose it from data rather than by feel:
- Collect queries that look like production traffic and run the cheap model on them.
- Grade each answer as acceptable or not, using a person or a stronger model whose grades you have spot-checked.
- For each candidate threshold, record two numbers: the share of queries that would escalate, and the share of accepted answers that are wrong.
- Pick the threshold with the lowest escalation rate that still keeps wrong accepts within what your product can tolerate.
- Check that escalation rate against your cost and latency budget, as in the worked example below.
- Repeat when you change a model, the prompt, or the kind of traffic you serve.
When should you use Cascading?
Cascading works best when the cost difference between model tiers is significant and most of your traffic can be handled by cheap models.
Strong indicators:
- Your query distribution is heavy-tailed: lots of simple queries and a smaller number of hard ones
- The cost difference between your cheapest and most expensive model is 10x or more
- You can tolerate slightly higher latency on hard queries (they go through multiple tiers) in exchange for much lower latency on easy ones
- You have a reasonable way to assess response quality without human review
- Your application can handle the occasional retry transparently without confusing the user
Weaker indicators:
- Almost all your queries require the most capable model
- The latency of retrying through multiple tiers is unacceptable
- You cannot build a reliable quality gate for your domain
- The cost difference between model tiers is small
When not to use it: If a query's difficulty is obvious from its wording, Model Router decides in one pass and avoids paying for a cheap attempt that will fail anyway (see Model Router vs Cascading). If queries differ mainly by intent rather than difficulty, use Semantic Router to pick the right handler instead. And if much of your traffic repeats, start with Prompt Caching, since cached answers skip the cascade entirely and leave it only the novel, harder queries.
Implementation
# Using OpenAI SDK for illustration — swap client for any provider
from openai import OpenAI
client = OpenAI()
def quality_gate(question: str, answer: str) -> bool:
"""Ask a cheap model whether the answer is good enough."""
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{
"role": "user",
"content": f"Rate this answer's quality. Is it complete, accurate, and well-structured?\n\nQuestion: {question}\nAnswer: {answer}\n\nReply with only PASS or FAIL.",
}],
)
return response.choices[0].message.content.strip().upper() == "PASS"
def cascading_query(question: str) -> dict:
"""Try cheap model first. Escalate to expensive model if quality is low."""
# Tier 1: cheap model
cheap_response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
)
cheap_answer = cheap_response.choices[0].message.content
if quality_gate(question, cheap_answer):
return {"answer": cheap_answer, "model_used": "gpt-4o-mini", "escalated": False}
# Tier 2: expensive model (only if cheap model fails quality gate)
expensive_response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": question}],
)
return {"answer": expensive_response.choices[0].message.content, "model_used": "gpt-4o", "escalated": True}
# Usage
result = cascading_query("Explain the CAP theorem in distributed systems.")
print(f"Model used: {result['model_used']} (escalated: {result['escalated']})")
print(result["answer"])
Worked Example: Cost and Latency
A support assistant handles 10,000 questions a day, each with about 1,000 input tokens and a 300-token answer.
| Setup | Calls per request | Tokens per request (in / out) | Cost per 1,000 requests | Latency per request |
|---|---|---|---|---|
| Large model for everything | 1 | 1,000 / 300 | $7.50 | 5.5 s |
| Cascade, 20% escalation | 2 small (plus 1 large if escalated) | 2,400 / 305 small, plus 1,000 / 300 large if escalated | $2.04 | 3.0 s resolved, 8.5 s escalated, 4.1 s average |
| Cascade, 50% escalation | 2 small (plus 1 large if escalated) | Same as above | $4.29 | 5.8 s average |
The large model costs 1,000 × $3.00 per million + 300 × $15.00 per million = $0.0075 per request, or $7.50 per 1,000. Every request pays for the cheap tier: a small-model answer ($0.33 per 1,000) plus a small-model quality gate that reads 1,400 tokens and writes 5 ($0.21 per 1,000), so $0.54 per 1,000. With 80% resolved at the cheap tier, adding 20% of $7.50 gives $2.04, a 73% saving, in line with the 70 to 80% figure above. The cheap tier takes 2.5 s for the answer plus 0.5 s for the gate; an escalated request adds the large model's 5.5 s on top.
At an 80% resolution rate the cascade is both cheaper and faster on average, but by about 45% escalation its average latency already matches the large model alone, and at 50 to 60% escalation the saving shrinks to 33 to 43% while hard queries wait 8.5 s, which is why the escalation rate is the number to watch. Cost break-even is near 93% escalation; the 50 to 60% line on this page is a diagnostic threshold for a failing cheap tier or gate, not a cost break-even.
What are the common pitfalls?
Quality gates that are too lenient. If the gate lets bad responses through, users get low-quality answers and stop trusting the product. You save money and give up output quality to do it. Err on the side of escalating too often during initial deployment, then tighten the gate as you gather data on what the cheap model handles well.
Quality gates that are too strict. If the gate escalates almost everything, you are paying for the cheap model's generation plus the expensive model's generation on most queries. That costs more than sending every query to the expensive model directly. Monitor your escalation rate. If it exceeds 50 to 60%, your cheap model is not capable enough or your gate is too aggressive.
Latency stacking. Each tier adds latency. If a query falls through all tiers, the total response time is the sum of all generations plus all quality evaluations. For interactive applications, this cumulative latency can be unacceptable. Set a maximum number of tiers (three is typical) and consider parallel generation for the first two tiers if latency matters most.
Confidently wrong cheap models. Some small models produce plausible but incorrect answers with high confidence. Logprob-based gates will not catch these because the model's token probabilities are high. This is the hardest failure mode to detect. LLM-as-Judge gates help but add cost. Domain-specific checks (like verifying calculations or checking facts against a database) are more reliable when available.
Inconsistent user experience across escalation levels. Different models have different writing styles, different levels of detail, and different formatting preferences. Users might notice that some responses feel different from others. If consistency matters, consider post-processing all responses through a formatting step regardless of which tier generated them.
What are the trade-offs?
You gain much lower cost on easy queries, an automatic quality check on answers from the cheaper tiers, and one system that handles both easy and hard queries.
You pay with added system complexity, potential latency on hard queries, the engineering effort of building and tuning quality gates, and the risk of quality gate failures in both directions.
The savings curve is nonlinear. If 80% of queries resolve at the cheapest tier, you save roughly 70 to 80% compared to using the expensive model for everything (accounting for quality gate overhead). If only 40% resolve cheaply, savings fall to about a third because you are paying for both the cheap attempt and the expensive escalation.
Quality gates are the make-or-break component. With a good gate, cascading pays off. A bad one costs you money (too strict) or quality (too lenient). Expect to keep revising the gate logic long after launch rather than setting it once.
Cascading and caching are complementary. Cached responses for common queries bypass the cascade entirely, so the cascade only handles novel requests. This shifts the difficulty distribution of cascaded queries upward, meaning a higher fraction will escalate. Factor this into your escalation rate expectations.
Goes Well With
Model Router can serve as a fast pre-filter before the cascade. Queries that are obviously complex (based on keyword rules or a quick classifier) skip the cheap tier entirely and enter the cascade at the mid or premium tier. This avoids wasting time on the cheap model for queries that clearly need more capability.
Small Language Models are what make the first tier of the cascade viable. The better your small model is, the more queries it can handle, and the more money you save. Investing in fine-tuning a small model for your specific domain directly increases the value of cascading.
Self-Check patterns give you a ready-made quality gate. A model that can assess its own confidence and correctness gives the cascade a built-in signal for when to escalate. This is one of the cheapest quality gates to implement since it uses the same model that just generated the response.
Frequently asked questions
What is an LLM cascade?
An LLM cascade sends each query to a cheap model first, tests the answer with a quality gate, and calls a stronger model only if the gate fails. FrugalGPT, cited below, studies the LLM cascade as one way to reduce API cost.
What is the difference between a model cascade and a model router?
A router picks a model before any answer exists, from the query alone. A cascade generates first and decides from the answer. The Model Router vs Cascading comparison covers when each fits.
When does cascading save money?
Whenever the escalation rate is below break-even, which is near 93% in the worked example above. The saving is large only when most queries pass the cheap tier: 20% escalation costs $2.04 per 1,000 requests against $7.50 for the large model alone, a 73% saving, while 50% escalation costs $4.29, a 43% saving. Average latency matches the large model much earlier, at about 45% escalation.
What happens when the cheap model is confidently wrong?
The gate may pass the answer, and the user receives it. Prefer checks that test the answer itself, such as schema validation, tests or source lookups, and sample accepted answers for review.
References
- Chen, L., Zaharia, M., & Zou, J. (2023). FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance. arXiv preprint. arXiv