Topic 3 of 4 · 5 min read
Cascades with small models first and LLM fallback
Goal: Design a cascade that sends low-confidence predictions from a small model to an LLM and estimate its cost and accuracy.
A cascade sends every input to a cheap trained model first and escalates to an LLM only when the small model is not confident, so most traffic costs almost nothing and the hard cases get the stronger model. The confidence cut-off is the dial that trades cost against accuracy.
Check yourself · 1 of 3
In a cascade, what decides which requests reach the LLM?
Why it matters
LLM calls are slow and cost money per token. Many real inputs are easy: a clear "reset my password" message does not need a frontier model. The FrugalGPT paper describes this idea for LLMs: try cheaper models first and call larger ones only when a quality check says the answer is not good enough. A small embedding classifier is the cheapest first stage of all.
How to do it
- Get a calibrated score. Use the small model's predicted probability. Raw scores from boosted trees or small networks are often over-confident, so calibrate on a held-out set.
- Pick the cut-off on validation data. Run the small model on a validation set labelled by humans. For each cut-off, compute the share of cases handled by the small model and its accuracy on those.
- Measure the LLM on the rest. Run the LLM on the cases below the cut-off and record its accuracy there. It is often lower than on average, since these are the hard cases.
- Estimate cost and accuracy together. With cut-off covering a share
sof traffic: cost per request is about the small model's cost plus(1 - s)times the LLM's cost, and accuracy is the weighted mix of the two stages. - Choose the point. Pick the cheapest cut-off that meets the accuracy target, and add a floor so that a drifting input mix cannot silently send everything to the LLM or never to it.
- Monitor. Log which stage answered, the confidence, and a sampled human check of both stages.
Before and after
Before: 100,000 requests a month all go to an LLM at roughly 0.4 cents each. After: a classifier answers the 70,000 requests above the cut-off at 97% accuracy and the LLM takes 30,000. The bill falls by about two thirds, and quality on the easy 70% stays high. The numbers here are an illustration, not a benchmark: measure your own.
What goes wrong
- Uncalibrated confidence. A model saying 0.95 and being right 70% of the time sends wrong answers through.
- Choosing the cut-off on test data. The cut-off is tuned there, so the reported score is too optimistic. Use validation for the cut-off and a fresh test set for the final figure.
- Ignoring drift. When inputs change, the confidence distribution shifts, and the routing share changes with it.
- No fallback for the LLM stage. The slow, expensive stage needs timeouts and a plan for when it fails.
Examples
Choosing the cut-off
Validation results for a ticket router: cut-off 0.90 handles 62% of tickets at 98% accuracy, cut-off 0.80 handles 78% at 95%, cut-off 0.70 handles 88% at 91%. The LLM scores 93% on the escalated cases. At 0.80 the blended accuracy is 0.78 x 95% + 0.22 x 93% = 94.6%. The team's target is 94%, so 0.80 is the cheapest cut-off that meets it.
The silent drift
After a product launch, new ticket types arrive that the small model has never seen. Its confidence stays high on them because it was never calibrated for unfamiliar input. Nothing escalates, and accuracy falls. A weekly human check of a random sample of confident answers catches this.
Key points
- A cascade answers confident cases with a cheap trained model and escalates uncertain ones to an LLM.
- The confidence cut-off sets the balance between cost and accuracy, so choose it from measured numbers on validation data.
- Calibrate the small model's probabilities first, because raw scores can be over-confident.
- Estimate cost as the small model's cost plus the escalated share times the LLM's cost per call.
- Log which stage answered and sample both stages for human checks, because drift moves the routing share.
Common mistakes
- Setting the cut-off by feel instead of from validation accuracy and cost.
- Trusting raw model scores without calibration.
- Tuning the cut-off and reporting the final accuracy on the same set.
- Not monitoring the share of traffic each stage handles.
Check yourself · 2 of 3
A small model reports 0.95 confidence but is right only 70% of the time at that score. What should you do before using it in a cascade?
Check yourself · 3 of 3
The small model handles 80% of traffic at 95% accuracy and the LLM handles the other 20% at 90%. What is the blended accuracy?
Practice items, not counted towards your mastery.
Start here
- Sentence Transformers documentation (opens in a new tab)DocsFree
How to encode sentences into embeddings and use them for classification, search and clustering.
- SetFit: few-shot text classification (Hugging Face docs) (opens in a new tab)DocsFree
Train a text classifier from a handful of labelled examples on top of sentence embeddings.
- ChatGPT Outperforms Crowd-Workers for Text-Annotation Tasks (opens in a new tab)PaperFree
A study comparing an LLM's labels with crowd-worker labels, and the cost and accuracy of each.
More for this topic
- FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance (opens in a new tab)PaperFree
Describes LLM cascades that try cheaper models first and escalate only when needed.
- scikit-learn: probability calibration (opens in a new tab)DocsFree
Why predicted probabilities can be over-confident and how to calibrate them before using a threshold.