[论文解读] FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance
FrugalGPT 引入 LLM 层叠(cascade)以自适应地在多种 LLM API 之间进行选择,在保持或超过单个最佳 LLM 的准确率的同时,将成本降低多达 98%。
There is a rapidly growing number of large language models (LLMs) that users can query for a fee. We review the cost associated with querying popular LLM APIs, e.g. GPT-4, ChatGPT, J1-Jumbo, and find that these models have heterogeneous pricing structures, with fees that can differ by two orders of magnitude. In particular, using LLMs on large collections of queries and text can be expensive. Motivated by this, we outline and discuss three types of strategies that users can exploit to reduce the inference cost associated with using LLMs: 1) prompt adaptation, 2) LLM approximation, and 3) LLM cascade. As an example, we propose FrugalGPT, a simple yet flexible instantiation of LLM cascade which learns which combinations of LLMs to use for different queries in order to reduce cost and improve accuracy. Our experiments show that FrugalGPT can match the performance of the best individual LLM (e.g. GPT-4) with up to 98% 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 LLMs sustainably and efficiently.
研究动机与目标
- 激励多样 LLM API 的高查询成本以及对预算感知使用的需求。
- 提出三种降成本策略:提示自适应、LLM 近似,以及 LLM 层叠。
- 展示一个简单的 FrugalGPT 实现(LLM 层叠),将查询分流到更便宜的模型同时保持性能。
提出的方法
- 定义一个带有每次查询成本组件的预算约束的 K 个 LLM API 查询问题。
- 描述三种降成本策略:提示自适应(更小的提示、提示选择、查询拼接)、LLM 近似(完成缓存、对便宜模型的微调)、LLM 层叠(生成评分 + 路由器在 API 之间进行选择)。
- 将 FrugalGPT 实例化为长度为 3 的 LLM 层叠,使用 ChatGPT、GPT-3、GPT-4 等,并在成本约束下学习面向查询的 API 序列以最大化收益。
- 为选择 API 列表和阈值提出混合整数优化,然后提供一个实用的优化器,能够裁剪搜索空间并对目标进行插值以提高效率。
实验结果
研究问题
- RQ1在预算约束下使用多种 LLM API 是否能实现与最好单一 LLM 相当或更好的任务性能?
- RQ2在跨任务的自适应 LLM 层叠下可以实现哪些成本节省与准确性权衡?
- RQ3在构建 FrugalGPT 系统时,提示自适应、LLM 近似和层叠策略如何相互作用并叠加?
- RQ4在现实世界环境中训练和部署 LLM 层叠的实际限制和必要条件是什么?
主要发现
- FrugalGPT 可以在成本降低高达 98% 的情况下达到最佳单一 LLM(如 GPT-4)的性能。
- 在同等成本下,对评估任务,FrugalGPT 的准确性可比 GPT-4 提升最多 4%。
- 在 HEADLINES、OVERRULING 和 COQA 上,FrugalGPT 显示出显著的成本节省(50%–98%),同时保持或提升准确性。
- 该层叠利用生成多样性,便宜模型能够正确回答昂贵模型错的情况,从而实现整体性能提升。
- 在案例研究中,FrugalGPT 通过在 GPT-J 及类似模型提供可靠输出时对其进行顺序查询,降低对 GPT-4 的依赖。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。