FrugalGPT cuts commercial LLM API spending by 59.2% to 98.3% while matching or beating the accuracy of the strongest individual model on three classification and question-answering benchmarks. Instead of sending every query straight to an expensive frontier endpoint like GPT-4, Lingjiao Chen, Matei Zaharia, and James Zou (Stanford University) route requests sequentially through a learned three-model cascade and stop as soon as a tiny scoring classifier trusts the cheap model’s answer.
The core observation is economic and statistical: across 12 commercial LLM APIs from 5 providers (OpenAI, AI21, Cohere, Textsynth, and ForeFrontAI), input pricing varies by more than two orders of magnitude (from $0.20 per 10M input tokens on Textsynth GPT-J to $30.00 on OpenAI GPT-4 in March 2023), and cheap models often answer queries correctly where GPT-4 makes mistakes.
- Up to 98.3% cost savings at parity: FrugalGPT matches GPT-4’s accuracy on HEADLINES for $0.60 versus $33.10 (98.3% saved) and on OVERRULING for $2.60 versus $9.70 (73.3% saved); on COQA, it matches GPT-3 for $29.60 versus $72.50 (59.2% saved).
- Higher accuracy on the same budget: With a $6.50 budget on HEADLINES (one-fifth of GPT-4’s spend), FrugalGPT raises accuracy from 85.7% to 87.2% (+1.5 percentage points), and reaches up to 4% higher accuracy than GPT-4 when spending the full budget.
- Cheap models fix GPT-4 blind spots: On HEADLINES, GPT-J, GPT-Curie, and J1-Large each answer 6% of queries correctly that GPT-4 gets wrong; on COQA, GPT-3 gets 13% right where GPT-4 fails.
- Pricing structure flips cost rankings: AI21 charges $0 per input token plus a fixed request fee and high output fee ($30 to $250 per 10M output tokens), making J1 costlier than GPT-3 on HEADLINES but cheaper than GPT-3 on OVERRULING and COQA.
How It Works
The paper outlines three cost-reduction levers: prompt adaptation (shorter prompts or batched queries), LLM approximation (completion caches and fine-tuned smaller models), and LLM cascade, which FrugalGPT builds and tests.
A FrugalGPT cascade pairs two components:
- Generation scoring function
g(q, a): A DistilBERT regression model trained on labeled query-answer pairs to predict in[0, 1]whether a model’s response is correct. DistilBERT is orders of magnitude cheaper than any LLM API in the chain. - Constrained cascade optimizer: Given budget
band 12 APIs, the optimizer picks an ordered 3-model chainLand thresholdstau, pruning chains with low answer disagreement and interpolating over training samples.
At inference time, a query starts at the cheapest model in L and escalates only if g(q, answer) falls below tau. Unlike RouteLLM, which routes before generation, a cascade inspects the candidate output first, similar to speculative decoding and constitutional classifier cascades.
Key Findings
The experiments cover three datasets using few-shot prompts: HEADLINES (10,000 financial news titles classifying gold price direction, 8 examples), OVERRULING (2,400 legal sentences, 5 examples), and COQA (7,982 reading comprehension questions adapted to direct QA, 2 examples).
First, generation diversity enables free accuracy gains. Using Maximum Performance Improvement (MPI), the authors measure how often a cheap API succeeds when GPT-4 fails. On the headline “Gold off the lows after dismal U.S. GDP data”, GPT-J predicts "price down" with a 0.97 DistilBERT score while GPT-4 answers "price up". On OVERRULING, GPT-J catches valid overruling language where GPT-4 answers "No". Combining complementary models lets FrugalGPT exceed GPT-4 by 1% on OVERRULING at 73% lower cost and by 1.5% on HEADLINES at 80% lower cost.
Second, more expensive APIs are not strictly better. On HEADLINES, AI21’s J1-Jumbo costs more per run than GPT-3 (because 8-shot prompts generate pricey completion behavior relative to AI21’s per-request and output rates), yet scores lower accuracy than GPT-3. On COQA, GPT-3 outperforms GPT-4 overall (around 45% vs. 40% accuracy in Figure 5), making GPT-3 the single-API baseline to beat.
Third, imperfect confidence calibration still leaves money on the table. In a COQA failure trace (Figure 5c), GPT-3, J1, and GPT-4 all output "black-walnut", yet DistilBERT assigns scores of 0.1 (below 0.2) and 0.2 (below 0.3), forcing FrugalGPT to pay for all three models for an answer the cheapest model already got right.
Caveats and Builder Takeaway
- Labeled in-distribution training data is mandatory: Training DistilBERT and optimizing thresholds requires labeled examples from the target query distribution; the upfront labeling and optimization cost only pays back when production volume dwarfs the calibration set.
- Sequential tail latency is unmeasured: The paper evaluates dollar API cost and accuracy, not wall-clock latency. Escalating through two or three sequential endpoints adds the latency of failed calls plus DistilBERT scoring before the final answer starts streaming.
- Narrow task scope and dated 2023 pricing: All three benchmarks are short-output classification or extractive QA tasks with 2 to 8 few-shot examples, not open-ended chat, coding, or tool-use traces where scoring correctness with DistilBERT is far harder.
Builder takeaway: Cascades pay off immediately on high-volume classification, extraction, or routing workloads where cheap models already handle most traffic and correctness can be scored cheaply by a small verifier or schema check. If end-to-end latency matters more than per-answer verification, pre-generation routing is usually the cleaner default.


