stanford-futuredata/FrugalGPT

FrugalGPT: better quality and lower cost for LLM applications

Jupyter Notebook

290

5 commits

updated Feb 10, 2025

See the code

README

πŸŽ“ FrugalGPT: Better Quality and Lower Cost for LLM Applications

The FrugalGPT framework offers a collection of techniques for building LLM applications with budget constraints.

πŸš€ Getting Started

You can directly run the Google Colab Notebook to experience FrugalGPT. You don't even need API keys to get started with it.

Once you go through the notebook, you'll be ready to build your own LLM applcations with FrugalGPT!

πŸ”§ Installation

You can also install FrugalGPT locally by running the following commands:

git clone https://github.com/stanford-futuredata/FrugalGPT
cd FrugalGPT
pip install git+https://github.com/stanford-futuredata/FrugalGPT
wget  https://github.com/lchen001/DataHolder/releases/download/v0.0.1/HEADLINES.zip
unzip HEADLINES.zip -d strategy/
rm HEADLINES.zip
wget -P db/ https://github.com/lchen001/DataHolder/releases/download/v0.0.1/HEADLINES.sqlite
wget -P db/ https://github.com/lchen001/DataHolder/releases/download/v0.0.1/qa_cache.sqlite

Now you are ready to use the local intro notebook!

πŸ“š Read More

You can get an overview via our Twitter threads:

And read more in the pre-print paper:

A detailed blog with code examples:

Our updated paper in Transactions on Machine Learning:

πŸ“£ Updates & Changelog

πŸ”Ή 2025.02.09 - Evaluation on recent models

  • βœ… Added support to Cluade 3.5 Sonnet, Gemini 1.5 Pro, and a few more models.

  • βœ… Released evaluations with more recent models. For example, you can run the following colab notebook to evaluate the tradeoffs achieved on the AGNEWS dataset using 2024 model: Open in Colab

  • βœ… Updated the paper and reference format

πŸ”Ή 2024.09.18 - Provided tradeoffs evaluation examples

  • βœ… Provided tradeoffs evaluation examples. For example, you can run the following colab notebook to evaluate the tradeoffs achieved on the SCIQ dataset: Open in Colab

πŸ”Ή 2024.09.10 - Added support to more recent models

  • βœ… Added support of a few new models. This includes proprietary models such as GPT-4o, GPT-4-Turbo, and GPT-4o-mini, and a few open-source models such as Llama 3.1 (405B), Llama 3 (70B) and Gemma 2 (9B)
  • βœ… Released prompts and in-context examples used for SCIQ

πŸ”Ή 2024.01.01 - Extracted API generations

  • βœ… Added the generations from 12 commercial LLM APIs for each dataset evaluated in the paper
  • βœ… Included both input queries and associated parameters (e.g., temperature and stop token)
  • βœ… Released them as CSV files here

🎯 Reference

If you use FrugalGPT in a research paper, please cite our work as follows:

@article{chen2024frugalgpt,
  title={FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance},
  author={Chen, Lingjiao and Zaharia, Matei and Zou, James},
  journal={Transactions on Machine Learning Research},
  year={2024}
}

stanford-futuredata/FrugalGPT

FrugalGPT: better quality and lower cost for LLM applications

Jupyter Notebook

290

5 commits

updated Feb 10, 2025

See the code

README

πŸŽ“ FrugalGPT: Better Quality and Lower Cost for LLM Applications

The FrugalGPT framework offers a collection of techniques for building LLM applications with budget constraints.

πŸš€ Getting Started

You can directly run the Google Colab Notebook to experience FrugalGPT. You don't even need API keys to get started with it.

Once you go through the notebook, you'll be ready to build your own LLM applcations with FrugalGPT!

πŸ”§ Installation

You can also install FrugalGPT locally by running the following commands:

git clone https://github.com/stanford-futuredata/FrugalGPT
cd FrugalGPT
pip install git+https://github.com/stanford-futuredata/FrugalGPT
wget  https://github.com/lchen001/DataHolder/releases/download/v0.0.1/HEADLINES.zip
unzip HEADLINES.zip -d strategy/
rm HEADLINES.zip
wget -P db/ https://github.com/lchen001/DataHolder/releases/download/v0.0.1/HEADLINES.sqlite
wget -P db/ https://github.com/lchen001/DataHolder/releases/download/v0.0.1/qa_cache.sqlite

Now you are ready to use the local intro notebook!

πŸ“š Read More

You can get an overview via our Twitter threads:

And read more in the pre-print paper:

A detailed blog with code examples:

Our updated paper in Transactions on Machine Learning:

πŸ“£ Updates & Changelog

πŸ”Ή 2025.02.09 - Evaluation on recent models

  • βœ… Added support to Cluade 3.5 Sonnet, Gemini 1.5 Pro, and a few more models.

  • βœ… Released evaluations with more recent models. For example, you can run the following colab notebook to evaluate the tradeoffs achieved on the AGNEWS dataset using 2024 model: Open in Colab

  • βœ… Updated the paper and reference format

πŸ”Ή 2024.09.18 - Provided tradeoffs evaluation examples

  • βœ… Provided tradeoffs evaluation examples. For example, you can run the following colab notebook to evaluate the tradeoffs achieved on the SCIQ dataset: Open in Colab

πŸ”Ή 2024.09.10 - Added support to more recent models

  • βœ… Added support of a few new models. This includes proprietary models such as GPT-4o, GPT-4-Turbo, and GPT-4o-mini, and a few open-source models such as Llama 3.1 (405B), Llama 3 (70B) and Gemma 2 (9B)
  • βœ… Released prompts and in-context examples used for SCIQ

πŸ”Ή 2024.01.01 - Extracted API generations

  • βœ… Added the generations from 12 commercial LLM APIs for each dataset evaluated in the paper
  • βœ… Included both input queries and associated parameters (e.g., temperature and stop token)
  • βœ… Released them as CSV files here

🎯 Reference

If you use FrugalGPT in a research paper, please cite our work as follows:

@article{chen2024frugalgpt,
  title={FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance},
  author={Chen, Lingjiao and Zaharia, Matei and Zou, James},
  journal={Transactions on Machine Learning Research},
  year={2024}
}

Significant stargazers

Chandan Singh

541 followers Β· starred Aug 2023

Natasha

288 followers Β· starred Aug 2026

Elad Segal

34 followers Β· starred Feb 2024

Edward

15 followers Β· starred Mar 2024