[论文解读] Towards Optimizing the Costs of LLM Usage
该论文提出 QC-Opt 框架,通过在不调用模型的情况下估计输出质量,实现 LLM 选择与输入 token 长度的优化,从而降低 LLM 使用成本。该框架通过质量感知的 LLM 路由、token 优化启发式方法以及基于 0-1 背包问题的启发式应用策略,实现了 40–90% 的成本降低和 4–7% 的质量提升。
Generative AI and LLMs in particular are heavily used nowadays for various document processing tasks such as question answering and summarization. However, different LLMs come with different capabilities for different tasks as well as with different costs, tokenization, and latency. In fact, enterprises are already incurring huge costs of operating or using LLMs for their respective use cases. In this work, we propose optimizing the usage costs of LLMs by estimating their output quality (without actually invoking the LLMs), and then solving an optimization routine for the LLM selection to either keep costs under a budget, or minimize the costs, in a quality and latency aware manner. We propose a model to predict the output quality of LLMs on document processing tasks like summarization, followed by an LP rounding algorithm to optimize the selection of LLMs. We study optimization problems trading off the quality and costs, both theoretically and empirically. We further propose a sentence simplification model for reducing the number of tokens in a controlled manner. Additionally, we propose several deterministic heuristics for reducing tokens in a quality aware manner, and study the related optimization problem of applying the heuristics optimizing the quality and cost trade-off. We perform extensive empirical validation of our methods on not only enterprise datasets but also on open-source datasets, annotated by us, and show that we perform much better compared to closest baselines. Our methods reduce costs by 40%- 90% while improving quality by 4%-7%. We will release the annotated open source datasets to the community for further research and exploration.
研究动机与目标
- 为解决在文档处理任务(如摘要生成和问答)中使用 LLM 所带来的高且可变的成本问题。
- 在不调用模型的情况下估计 LLM 输出质量,从而实现成本效益更高的路由决策。
- 联合优化 LLM 选择与输入 token 数量,以在保持或提升质量与延迟的前提下最小化成本。
- 设计一个基于启发式方法的 token 减少流水线,以控制质量下降并最大化 token 节省。
- 在企业级和开源数据集上对框架进行实证验证,展示成本节约与质量提升。
提出的方法
- 提出一种使用自定义损失函数的质量估计模型,用于在不运行模型的情况下预测摘要任务中 LLM 的输出质量。
- 引入一种 LP 四舍五入算法,以在成本、质量与延迟约束下求解 LLM 选择问题。
- 设计一个 token 优化模块,采用 8 种确定性启发式方法(如停用词移除、缩写简化)来减少输入长度。
- 将每条句子的启发式最优应用策略建模为一个 0-1 背包问题,其中质量损失作为成本,token 节省作为收益。
- 对小型启发式集合使用暴力搜索,以确定每条句子的最优操作顺序。
- 采用智能路由器,根据预测的质量与成本约束选择最佳 LLM,并应用 token 优化。
实验结果
研究问题
- RQ1是否可以在不调用模型的情况下准确预测 LLM 输出质量,从而实现成本效益更高的路由?
- RQ2如何联合优化 LLM 选择与输入 token 长度,以在保持质量的前提下最小化成本?
- RQ3在应用基于启发式的压缩时,token 减少与质量下降之间的权衡关系如何?
- RQ4基于 0-1 背包问题的建模是否能有效指导 token 减少启发式的最优应用?
- RQ5在多种文档处理任务中,所提出方法与基线方法在成本、质量与延迟方面的表现如何比较?
主要发现
- 所提出的 QC-Opt 框架在企业级与开源数据集上将 LLM 使用成本降低了 40–90%,同时输出质量提升了 4–7%。
- 质量估计模型能够在不进行实际推理的情况下准确预测 LLM 性能,从而降低运行时成本与延迟。
- 通过启发式方法进行的 token 优化在摘要数据集上实现了最高达 22.07% 的压缩率,且质量损失可控。
- 与暴力搜索启发式应用相比,基于 0-1 背包问题的启发式应用策略将质量下降减少了 30–50%。
- 由于更多查询被路由至更快、更便宜的模型(如 Text-Curie),延迟降低了约 13%。
- 用户研究表明,人类对输出质量的感知与 BertScore 等自动化指标一致,验证了模型预测准确性的可靠性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。