There is a rapidly growing number of large language models (LLMs) that userscan query for a fee. We review the cost associated with querying popular LLMAPIs, e.g. GPT-4, ChatGPT, J1-Jumbo, and find that these models haveheterogeneous pricing structures, with fees that can differ by two orders ofmagnitude. In particular, using LLMs on large collections of queries and textcan be expensive. Motivated by this, we outline and discuss three types ofstrategies that users can exploit to reduce the inference cost associated withusing LLMs: 1) prompt adaptation, 2) LLM approximation, and 3) LLM cascade. Asan example, we propose FrugalGPT, a simple yet flexible instantiation of LLMcascade which learns which combinations of LLMs to use for different queries inorder to reduce cost and improve accuracy. Our experiments show that FrugalGPTcan match the performance of the best individual LLM (e.g. GPT-4) with up to98% cost reduction or improve the accuracy over GPT-4 by 4% with the same cost.The ideas and findings presented here lay a foundation for using LLMssustainably and efficiently.
URL
Affiliations
Abstract
Translation (by gpt-3.5-turbo)
Summary (by gpt-3.5-turbo)