arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.12170cs.LGcs.AI
收藏

PickLLM:上下文感知的强化学习辅助大语言模型路由

PickLLM: Context-Aware RL-Assisted Large Language Model Routing

Broadcom(博通公司);VMware Cloud Foundation (VCF) Division(VMware 云基础架构(VCF)部门);AI and Advanced Services(AI 与高级服务部门)

Dimitrios Sikeridis, Dennis Ramdass, Pranay Pareek

AI总结:

PickLLM提出一种基于强化学习的轻量级路由框架,通过加权奖励函数权衡成本、延迟和准确性,从模型池中为查询选择最优LLM,并验证了收敛速度与性能提升。

摘要:

近年来,现成的大语言模型(LLM)数量激增,涌现出许多开源选项。这造就了多样化的格局,既体现在服务选项上(例如,在本地硬件上推理与远程LLM API),也体现在模型异构的专业能力上。然而,用户难以在考虑运营成本(定价结构、大规模查询量的昂贵LLM即服务)、效率,甚至诸如响应准确性、偏见或毒性等针对具体案例的度量时进行高效优化。此外,现有的LLM路由解决方案主要侧重于降低成本,其响应准确性优化依赖于不可泛化的监督训练,而集成方法则需要对每个考虑的LLM候选者进行输出计算。在本工作中,我们解决了从模型池中为特定查询选择最优LLM并具有可定制目标的挑战。我们提出了PickLLM,一个轻量级框架,依赖强化学习(RL)将实时查询路由到可用模型。我们引入了一个加权奖励函数,通过可定制的评分函数考虑每次查询的成本、推理延迟和模型响应准确性。关于学习算法,我们探索了两种替代方案:PickLLM路由器作为学习自动机,利用梯度上升选择特定LLM;或利用无状态Q学习探索LLM集合,并使用ε-贪心方法进行选择。该算法在剩余会话查询中收敛到单个LLM。为了评估,我们使用了四个LLM的池,并针对不同上下文对提示-响应数据集进行基准测试。一个单独的评分函数在实验期间评估响应准确性。我们展示了不同学习率下的收敛速度,以及硬性指标(如每次查询会话的成本和整体响应延迟)的改进。

英文摘要:

Recently, the number of off-the-shelf Large Language Models (LLMs) has exploded with many open-source options. This creates a diverse landscape regarding both serving options (e.g., inference on local hardware vs remote LLM APIs) and model heterogeneous expertise. However, it is hard for the user to efficiently optimize considering operational cost (pricing structures, expensive LLMs-as-a-service for large querying volumes), efficiency, or even per-case specific measures such as response accuracy, bias, or toxicity. Also, existing LLM routing solutions focus mainly on cost reduction, with response accuracy optimizations relying on non-generalizable supervised training, and ensemble approaches necessitating output computation for every considered LLM candidate. In this work, we tackle the challenge of selecting the optimal LLM from a model pool for specific queries with customizable objectives. We propose PickLLM, a lightweight framework that relies on Reinforcement Learning (RL) to route on-the-fly queries to available models. We introduce a weighted reward function that considers per-query cost, inference latency, and model response accuracy by a customizable scoring function. Regarding the learning algorithms, we explore two alternatives: PickLLM router acting as a learning automaton that utilizes gradient ascent to select a specific LLM, or utilizing stateless Q-learning to explore the set of LLMs and perform selection with a $ε$-greedy approach. The algorithm converges to a single LLM for the remaining session queries. To evaluate, we utilize a pool of four LLMs and benchmark prompt-response datasets with different contexts. A separate scoring function is assessing response accuracy during the experiment. We demonstrate the speed of convergence for different learning rates and improvement in hard metrics such as cost per querying session and overall response latency.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑