用带预算约束的智能路由,让大模型按需调用更省钱
WISERouter: LLM Routing with Workload Budget Constraint

- 将路由问题建模为带约束的上下文多臂老虎机,动态分配模型
- 离线版在固定预算下性能超基线,且严格遵守预算限制
- 在线版探索数据少,适合资源有限的真实场景
大语言模型在多个领域表现优异,但对每个查询都使用最强模型在大规模下不可行。LLM路由通过根据查询特性分配合适模型,在效果与成本间取得平衡。现有方法存在两大局限:一是依赖启发式规则,无法始终保证预算约束,或采用固定每查询预算,难以适应工作负载变化;二是需要在密集数据集上进行监督学习,收集每查询-模型对的统计信息,成本高昂。为此,本文将LLM路由建模为带约束的上下文多臂老虎机问题,提出WISERouter(WR)框架,支持从历史交互中进行离线学习,也支持带探索的在线学习。理论证明,WR-Online在时间跨度T内实现$O(\sqrt{T})$的次线性后悔界。在RouterBench和SWE-Bench上的实验证明:(i) WR-Offline在固定预算下性能优于基线,且更严格遵守预算约束;(ii) WR-Online性能接近基线,同时所需探索数据显著减少。
原文摘要 · Abstract (English)
Large language models (LLMs) achieve impressive performance across multiple domains, but using the most capable model for every query is prohibitive at scale. LLM routing exploits diversity in model capability and cost by assigning each query to a suitable model to balance utility and budget. Current methods have two limitations: (i) they either use heuristics that do not always enforce the budget constraint or impose a fixed per-query budget that cannot adapt across the workload and leads to suboptimal performance; (ii) they require supervised learning on a dense dataset with statistics for every query-model pair, which is expensive to collect. To address these challenges, we formulate LLM routing as a constrained contextual multi-armed bandit problem and introduce WISERouter (WR for short), a framework that supports offline learning from historical interactions as well as online learning with exploration. We further prove that WR-Online achieves a sublinear regret bound of $O(\sqrt{T})$ over a time horizon $T$. Empirical results on RouterBench and SWE-Bench demonstrate that (i) WR-Offline surpasses existing baselines in performance under a fixed budget and adheres more closely to budget constraints, and (ii) WR-Online achieves comparable performance to the baselines, while using substantially less exploration data.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。