← Jev From First Principles

Cascades

Does uncertainty-driven escalation beat always using the strongest provider? A simulated cascade, why per-stage guarantees do not multiply, and how shift and human capacity break it.

This chapter is a simulation over assumed stage profiles. No cascade is measured. Every number is a consequence of assumed accuracy curves, costs, confidence noise, shift and human capacity, all swept and stated next to the results. Any “cascades save X%” figure below is a statement about the swept assumptions, not about real providers.

The question

Chapter 29’s router chose one provider per request, before running anything. A cascade makes the choice after looking: run a cheap stage, check how confident it is, and escalate only the requests it is unsure about. Escalation keeps going until some stage answers, and the last stage is a human.

This is attractive for a reason Chapter 17 set up. If a stage’s confidence is trustworthy, it tells you which of its own answers to believe, and you pay for the expensive provider only on the remainder. It is also exactly where uncertainty stops being a number and becomes control flow: whether the next, costlier stage runs depends on a probability.

The chapter asks: does uncertainty-driven escalation beat always using the strongest provider, and does a per-stage guarantee give you an end-to-end one?

What the literature gives you

The FrugalGPT cost figures were checked against its primary paper, Table 3. The quantile-deferral comparison was checked in Gupta et al., §3–§4. These remain external results.

Source The cascade How deferral is decided What it reports Where it stops
FrugalGPT, Chen, Zaharia and Zou (2023), §3-§5 A list of LLM APIs queried in order, stopping when an answer is judged reliable A learned scorer (a DistilBERT regressor in the case study) gives a reliability score in [0, 1]; a threshold per stage is chosen by constrained optimisation under a cost budget Matching the best model’s accuracy at 98.3% (HEADLINES), 73.3% (OVERRULING) and 59.2% (COQA) lower cost, and in places higher accuracy at equal cost, because cheaper models are sometimes right where the strongest is wrong Needs labelled examples; assumes the test distribution resembles training; learning the cascade has an up-front cost; latency and uncertainty quantification are left open (§5)
Gupta et al. (2024), §3-§4 A two-model cascade (FLAN-T5 Base to Large) Compares sequence-level probability (Chow-Sum, biased towards deferring long outputs; Chow-Average, which over-corrects) with token-level quantiles of the small model’s probabilities, then trains a small post-hoc rule on those features Quantile features beat sequence-level scores on the main datasets; adding embeddings helps most on classification Only encoder-decoder FLAN-T5; RLHF-tuned models may be miscalibrated; extracting embeddings adds cost
Viola and Jones (2001) A boosted cascade of detectors: early stages reject cheaply, later ones are costly Each stage is tuned to almost never reject a positive Real-time face detection Vision, and a stage’s error is one-sided by design. Cited at summary level (IEEE 10.1109/CVPR.2001.990517; a classic, not on arXiv)

Three things to take from the table.

First, the architecture is old and the cost is in the scorer. Viola and Jones cascaded in 2001. What changed with LLMs is not the cascade but what plays the confidence role, and that is where FrugalGPT and Gupta et al. differ most. A cascade is only as good as the signal that says “I might be wrong”.

Second, simple confidence is a weak signal. Gupta et al. find that the obvious rule, defer when the sequence probability is low, is biased by output length, and that averaging can hide a few highly uncertain tokens. This matters here because Chapter 9 already showed that a probability-shaped number can be useless. A decision with a bounded answer set avoids the length bias but not the calibration problem.

Third, FrugalGPT’s headline sets our expectation, and it is conditional. Its savings hold when training and test data match and a labelled set exists to learn the scorer. This chapter’s hypothesis keeps that condition in view: the saving should be large on skewed traffic and collapse under shift.

The hypothesis and prior work

Our starting hypothesis (HYPOTHESIS, preregistered in metadata/30-chapter.yaml) is that the saving is large on skewed traffic and collapses under shift. Skewed traffic means most requests are easy, so the cheap stage answers most of them. Shift means the confidence a stage reports no longer matches how often it is right, so the escalation threshold, set on yesterday’s traffic, sends the wrong requests onward.

The build

Decision flow for Chapter 30

src/arbiter/cascade.py runs the stages rule → linear → judge → human. A stage answers when its assumed confidence clears a threshold learned on a calibration stream (fit_thresholds sets each stage’s threshold so it answers roughly a chosen fraction of what it sees); otherwise the request escalates. The human stage is capacity-limited: once its queue is full, overflow items fail. run_ch30.py sweeps the answer fraction, the shift (a drift factor that multiplies stage-1 confidence) and the human capacity, writing results/ch30.jsonl (mode: simulation).

Three design choices in the simulator decide what the results can mean. A stage’s confidence is its true accuracy plus Gaussian noise, so every stage’s confidence is informative by construction, and the noise size is the assumed quality of the signal. The thresholds are fitted on one stream and used on another, so the calibration and evaluation streams are separate. And drift only inflates stage 1’s confidence, so the shift tested is one specific, optimistic failure.

from arbiter.cascade import Stage, p_ok
# 1. A request escalates until a stage's assumed confidence clears a threshold.
print("1. escalation (ASSUMED stage accuracies)")
stages = [
    Stage("rule", 0.95, 0.45, 1.0, 0.2),
    Stage("judge", 0.99, 0.92, 20.0, 0.05),
]
d = 0.7
for s in stages:
    print(f"   {s.name:<8} P(correct)={p_ok(s, d):.2f} cost={s.cost}")
# 2. The naive product does not equal the chain.
print("2. the chain is not a product")
p_rule, p_judge = p_ok(stages[0], d), p_ok(stages[1], d)
print(f"   P(rule ok)={p_rule:.2f} P(judge ok)={p_judge:.2f} product={p_rule*p_judge:.2f}")
print("   the chain's joint is P(rule|escalated) style, not the product")
1. escalation (ASSUMED stage accuracies)
   rule     P(correct)=0.60 cost=1.0
   judge    P(correct)=0.94 cost=20.0
2. the chain is not a product
   P(rule ok)=0.60 P(judge ok)=0.94 product=0.56
   the chain's joint is P(rule|escalated) style, not the product

At difficulty 0.7 the rule stage is right 60% of the time and the judge 94%. A request that the rule answers is right with probability 0.60; a request that escalates is right with probability 0.94. The product 0.56 describes neither. The second block is the seed of the correction made below.

The sweep

run_ch30.py, n=4,000, assumed stage curves in every row. Navigation:

config accuracy cost/req naive product judge traffic
always-judge 0.952 20.00 — 4,000
answer 0.5, drift 1.0 0.830 11.80 0.577 433
answer 0.5, drift 0.5 0.918 20.08 0.805 874
answer 0.5, drift 1.5 0.746 4.96 0.543 121
answer 0.7, drift 1.0 0.778 5.02 0.548 226
human capacity 50 0.673-0.752 3.6-4.2 — —

The “naive product” column is the product of the per-stage accuracies stored in each row. The next section says what that number is and is not.

What a cascade’s accuracy actually is

Before interpreting the sweep, fix the arithmetic, because an earlier draft of this chapter described it loosely. In a cascade each request is answered by exactly one stage. So the end-to-end accuracy is a mixture: each stage’s share of the traffic times that stage’s accuracy on what it answered, summed. It is not a product of stage accuracies. For the first sweep row, the stages answered 2,004, 925, 433 and 638 requests with accuracies 0.76, 0.836, 0.938 and 0.969, so

(2004 × 0.76 + 925 × 0.836 + 433 × 0.938 + 638 × 0.969) / 4000 = 0.830,

which is the measured value. examples/ch30-cascades/check_mixture.py does this for every row and asserts agreement:

traffic, acc = row["per_stage"], row["per_stage_accuracy"]
mixture = sum(traffic[s] * acc[s] for s in traffic if traffic[s]) / N
assert math.isclose(mixture, row["accuracy"], abs_tol=0.0015), row
python examples/ch30-cascades/check_mixture.py
answer drift  measured  mixture  product
   0.5   1.0  0.830     0.830    0.577
   0.5   0.5  0.918     0.918    0.805
   0.5   1.5  0.746     0.746    0.543
   0.7   1.0  0.778     0.778    0.548
   0.7   0.5  0.890     0.890    0.783
   0.7   1.5  0.721     0.721    0.482
mixture matches measured accuracy in every row

The product column is much lower, and it should be: it is the probability that every stage is right on a request that went through all of them, which is an event the cascade never produces. The earlier draft read the gap between product and measured accuracy as evidence that independence fails. That reading was wrong; the product is simply the wrong formula. The real composition problem is subtler and is the second point below.

What the results show

  1. At matched accuracy the cascade does not save here. The cheapest way to reach the judge’s 0.952 is to call the judge. The best cascade row, drift 1.0 at answer fraction 0.5, costs 11.80 (41% less) but reaches 0.830, twelve points lower. Under-confident drift 0.5 is worse than useless: it reaches 0.918 at 20.08, more expensive than always-judge, because the rule stage never fires and 1,049 items reach the 50-cost human stage. A “cascades save 41%” headline would be true here without the accuracy match and false with it. The hypothesis’s skewed-traffic half is not tested by these curves, because the assumed difficulty is uniform; it would need a skewed difficulty distribution.

  2. A per-stage guarantee does not compose into an end-to-end one. Since end-to-end accuracy is a mixture, it depends on which requests each stage gets. Changing the stage-1 threshold changes stage 2’s population, and so its accuracy, and so everything downstream. Each stage’s accuracy is conditional on what the earlier thresholds let through. Chapter 17’s risk-control guarantee covers one decision at one threshold; a cascade has several coupled thresholds, and the end-to-end risk must be measured on a held-out stream. P2 holds in this corrected sense.

  3. Shift breaks it in both directions. Drift 1.5 (stage 1 over-confident) sends only 121 items to the judge and accuracy collapses to 0.746: hard items are answered by the weak rule at 0.716 accuracy. Drift 0.5 (under-confident) swamps the judge. Thresholds calibrated in-distribution go stale. This is the same lesson as Chapter 10’s changed-source result, now with a cost attached.

  4. The human stage is a real, capped cost. At capacity 50 the cascade’s accuracy falls to 0.673-0.752 because overflow items fail (635 of 685 human-bound requests at answer fraction 0.5). A capacity-free human stage is a fantasy. Whether an overflowed item should fail, wait, or fall back to the judge is a policy this simulator does not model, and the policy changes the answer.

Wrong / Correct. Wrong: “Cascades save most of the cost at the same quality.” Correct: “Under these assumed profiles the cascade’s saving is bought with accuracy unless the confidence signal is near-perfect; the guarantee does not compose, because later stages’ accuracy depends on earlier thresholds; shift and human capacity break it. Anyone claiming a cascade saving must state the accuracy match and the assumptions.”

Four cascade stages with traffic shares and accuracies. The product of stage accuracies is 0.577; the measured traffic-weighted mixture is 0.830.
Figure 30.1. Per-stage numbers do not give an end-to-end guarantee when escalation chooses the next stage. The mixture uses the traffic share each stage actually answered.

Reading FrugalGPT against this result

FrugalGPT reports savings at matched accuracy, and our simulation finds none. These are not in conflict, and the difference is informative. FrugalGPT’s scorer is trained on labelled data from the target distribution, and its cheap models are sometimes right where the strongest is wrong (§4), so escalation can add accuracy rather than only recover it. Our stages are stylised: the judge is at least as accurate as the cheaper stage at every difficulty, so there is no complementary-error gain to harvest. To test whether real stages have that complementarity, you would measure the cheap model’s accuracy on the cases the strong model gets wrong. We did not.

What this means for the decide construct

PROPOSED. A cascade is if decide chained: Chapter 17’s construct, whose else-branch is another decide. This chapter suggests the construct itself is the easy part and the hard parts are elsewhere: stage thresholds that are validated jointly on a held-out stream, a policy for human overflow, and monitoring for shift. None of that is syntax. A library function cascade(stages, thresholds) would capture the control flow. The language-level question, taken up in Chapters 32 and 33, is whether a compiler can pick and re-validate the thresholds, which is a stronger claim than the syntax makes.

What to carry forward

Chapter 31 learns the router from the outcomes of routing. This chapter hands it a warning: the cascade’s thresholds were calibrated in-distribution and broke under shift, and a learned router will be worse. A router that only sees the outcomes of providers it selects learns the wrong thing. That is Chapter 31’s topic.

Limitations

  • SIMULATION over assumed stage profiles; results/ch30.jsonl is mode: simulation with the assumptions in every row. FrugalGPT and Gupta et al. are not measured here.
  • Difficulty is uniform and every stage’s confidence is informative by construction; skewed traffic and complementary errors are not modelled.
  • Drift inflates stage-1 confidence only. A shift in the true accuracy curves is not tested.
  • Human overflow is modelled as failure; other policies would change the capacity rows.
  • “Saving” figures are for the specific answer fractions and curves swept; the direction of the findings (accuracy match needed, no composition, shift breaks it) is the durable part.
  • An earlier version of this chapter treated the naive product as evidence about independence; that was an error in interpretation, corrected here. The numbers were unchanged.
  • Viola-Jones cited at summary level (IEEE 10.1109/CVPR.2001.990517).

What this chapter establishes

Which model should handle each decision, and who checks the cascade? Under this evidence: no single model, and a controller whose thresholds are re-validated end to end, because the guarantee does not compose and shift breaks it.