Skip to content

< CollectionsPaper

FrugalGPT.

FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance

Chen, Zaharia and Zou · 2023 · arXiv 2305.05176

Read the paper (opens in a new tab)

Most queries do not need the biggest model. Spend on the ones that do.

4 sections · 6 problems

0 of 6 done

Start Next: 01 Price a Call

Fig. 1. Each query goes to the small model first. Its answer is scored, and only a low score sends it on to a bigger, dearer one. Most stop at small.

Section 01

Know the price

0 of 1

The paper: Model APIs differ in price by up to two orders of magnitude, so cost has to be counted call by call.

  1. 01Price a Callimplement · easy

Section 02

Prompt adaptation

0 of 2

The paper: A shorter prompt costs less: keep only the examples the query needs.

  1. 02Pick the Examples That Fit the Questionimplement · medium
  2. 03Stay Under the Token Budgetoptimize · medium

Section 03

Approximate the model

0 of 2

The paper: Keep the answers you have already paid for, and answer a repeated query from the cache.

  1. 04Stop Paying for the Same Answer Twiceimplement · medium
  2. 05Lay Out the Prompt So the Cache Hitsoptimize · medium

Section 04

The cascade

0 of 1

The paper: Send the query to a cheap model first, score its answer, and only call a bigger model when the score is low.

  1. 06Try the Small Model Firstoptimize · medium
All collections