用上下文强化学习动态选大模型,实时适应用户提问变化。
Online Multi-LLM Selection via Contextual Bandits under Unstructured Context Evolution
- 基于上下文的在线学习框架,不依赖历史数据或模型内部信息。
- 在多轮问答中实现亚线性遗憾,准确率与成本效率双提升。
- 适合追求快速响应和低资源消耗的实时对话系统应用。
大型语言模型(LLMs)在响应行为、成本和优势上差异显著,使得为特定用户查询选择最优模型颇具挑战。本文研究在线环境下自适应的多模型选择问题,学习者通过多步查询精炼与用户交互,需在无离线数据或模型内部信息的情况下顺序选择模型。核心挑战来自非结构化上下文演化:提示词会根据前序模型输出通过黑箱过程动态变化,无法模拟、建模或学习。为此,我们提出首个面向非结构化提示动态的上下文老虎机框架,形式化了短期遗憾概念,并设计基于LinUCB的算法,可证明实现亚线性遗憾,无需预测未来上下文。进一步引入预算敏感与位置敏感(优先早期高质量响应)扩展,以适应可变查询成本和用户对早期满足的偏好。算法理论完备,无需离线微调或数据集特训。在多个基准测试中,所提方法在准确率与成本效率上均优于现有大模型路由策略,验证了上下文老虎机在实时自适应大模型选择中的有效性。
原文摘要 · Abstract (English)
Large language models (LLMs) exhibit diverse response behaviors, costs, and strengths, making it challenging to select the most suitable LLM for a given user query. We study the problem of adaptive multi-LLM selection in an online setting, where the learner interacts with users through multi-step query refinement and must choose LLMs sequentially without access to offline datasets or model internals. A key challenge arises from unstructured context evolution: the prompt dynamically changes in response to previous model outputs via a black-box process, which cannot be simulated, modeled, or learned. To address this, we propose the first contextual bandit framework for sequential LLM selection under unstructured prompt dynamics. We formalize a notion of myopic regret and develop a LinUCB-based algorithm that provably achieves sublinear regret without relying on future context prediction. We further introduce budget-aware and positionally-aware (favoring early-stage satisfaction) extensions to accommodate variable query costs and user preferences for early high-quality responses. Our algorithms are theoretically grounded and require no offline fine-tuning or dataset-specific training. Experiments on diverse benchmarks demonstrate that our methods outperform existing LLM routing strategies in both accuracy and cost-efficiency, validating the power of contextual bandits for real-time, adaptive LLM selection.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。