用图模型智能匹配任务与大模型,提升选择效率与适应性。
GraphRouter: A Graph-based Router for LLM Selections
- 构建任务-查询-模型异构图,捕捉三者间上下文关系。
- 预测模型响应效果与成本,最低提升12.3%性能。
- 无需重训练即可适配新模型,适合多场景部署。
大型语言模型(LLMs)数量和种类的快速增长带来了高效选择合适模型的挑战,尤其在性能与计算成本之间需权衡。现有方法因难以泛化到新模型和不同任务,且依赖于归纳学习框架,常受限于对任务、查询与模型间上下文交互的利用不足。为此,我们提出一种新型归纳式图结构框架 GraphRouter,通过构建包含任务、查询与模型节点的异构图,以边表示相互作用,充分捕捉查询需求与模型能力之间的上下文信息。GraphRouter采用创新的边预测机制,可预测潜在边的属性(即模型响应的效果与成本),从而实现无需重训练即可优化推荐,适应已有及新增模型。在三种不同效果-成本权重设置下的综合实验表明,GraphRouter显著优于现有路由系统,最低性能提升达12.3%。此外,其在新模型设置下表现更优,支持多样化任务,效果至少提升9.5%,同时显著降低计算开销。本工作为基于图的方法实现上下文感知与自适应的LLM选择提供了新思路,适用于真实应用场景。代码已开源:https://github.com/ulab-uiuc/GraphRouter。
原文摘要 · Abstract (English)
The rapidly growing number and variety of Large Language Models (LLMs) present significant challenges in efficiently selecting the appropriate LLM for a given query, especially considering the trade-offs between performance and computational cost. Current LLM selection methods often struggle to generalize across new LLMs and different tasks because of their limited ability to leverage contextual interactions among tasks, queries, and LLMs, as well as their dependence on a transductive learning framework. To address these shortcomings, we introduce a novel inductive graph framework, named as GraphRouter, which fully utilizes the contextual information among tasks, queries, and LLMs to enhance the LLM selection process. GraphRouter constructs a heterogeneous graph comprising task, query, and LLM nodes, with interactions represented as edges, which efficiently captures the contextual information between the query's requirements and the LLM's capabilities. Through an innovative edge prediction mechanism, GraphRouter is able to predict attributes (the effect and cost of LLM response) of potential edges, allowing for optimized recommendations that adapt to both existing and newly introduced LLMs without requiring retraining. Comprehensive experiments across three distinct effect-cost weight scenarios have shown that GraphRouter substantially surpasses existing routers, delivering a minimum performance improvement of 12.3%. In addition, it achieves enhanced generalization across new LLMs settings and supports diverse tasks with at least a 9.5% boost in effect and a significant reduction in computational demands. This work endeavors to apply a graph-based approach for the contextual and adaptive selection of LLMs, offering insights for real-world applications. Our codes for GraphRouter is released at https://github.com/ulab-uiuc/GraphRouter.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。