一次预训练,随处路由:迈向LLM路由的基础模型
研究论文 · 2026/10/02
大语言模型(LLM)路由旨在将每个查询分配给异构候选池中最合适的模型,以改善LLM推理的质量-效率权衡。现有路由器通常通过局部拟合学习:针对特定查询工作负载和候选池优化,且当路由环境变化时往往需要额外监督或重新训练。本文提出能否从基础模型视角处理LLM路由,学习一种可复用的路由能力,泛化到任务、候选模型和部署条件。为此,作者提出RouteFM,它从行为上下文中刻画匿名候选模型并推断其目标特定能力,而非将路由决策绑定到固定模型身份或单一环境。通过跨异构路由环境的片段式预训练,该能力可被冻结的路由器复用,并仅通过上下文适应新环境。实验证明在领域、模态、候选池和上下文预算变化下具有迁移性,当行为证据有限时增益最大。在未参与预训练的MMR-Bench上,RouteFM仅用每个候选八次观察就比最强基线高出2.23个质量点。这些结果支持将LLM路由从重复局部拟合转向“一次预训练,随处路由”范式。代码公开于https://github.com/LAMDA-Model-Reuse/RouteFM。
该工作将LLM路由从针对特定环境的局部拟合转向可复用的基础模型能力,显著提升了跨任务、模型和部署条件的泛化性,尤其在行为证据有限时优势明显,为构建通用路由基础模型提供了新思路。
Large language model (LLM) routing aims to assign each query to the most suitable model from a heterogeneous candidate pool, improving the quality--efficiency trade-off of LLM inference. Existing routers are typically learned through local fitting: a router is optimized for a particular query workload and candidate pool, and often requires additional supervision or retraining as the routing environment changes. We ask whether LLM routing can instead be approached from a foundation-model perspective, learning a reusable routing capability that generalizes across tasks, candidate models, and deployment conditions. To this end, we introduce RouteFM, which learns to characterize anonymous candidate models from behavioral context and infer their target-specific capabilities, rather than binding routing decisions to fixed model identities or a single environment. Through episodic pretraining across heterogeneous routing environments, this capability can be reused by a frozen router and adapted to new environments through context alone. Experiments demonstrate transfer across changes in domains, modalities, candidate pools, and context budgets, with the largest gains when behavioral evidence is limited. On MMR-Bench, which is excluded from pretraining, RouteFM outperforms the strongest baseline by 2.23 quality points with only eight observations per candidate. These results support moving LLM routing from repeated local fitting toward a pretrain once, route anywhere paradigm. Our code is publicly available at https://github.com/LAMDA-Model-Reuse/RouteFM.