Learning to Route and Schedule LLMs from User Retrials via Contextual Queueing Bandits
Seoungbin Bae, Junyoung Son, Dabeen Lee
TL;DR
This work tackles the problem of efficiently routing and scheduling queries for multiple LLMs under user retrials and limited explicit feedback. It introduces CQB-MNL, a contextual queueing bandit framework with multinomial logit feedback, and the anytime ACQB algorithm that combines decaying uniform exploration with Thompson sampling to learn routing and scheduling policies while ensuring queue stability. The paper provides regret guarantees, including a queue-length regret that decays as $R_t = \widetilde{\mathcal{O}}(t^{-1/4})$ and a cumulative regret of $\widetilde{\mathcal{O}}(d^{3/2}\sqrt{t})$, and validates the approach on synthetic and real-world datasets (SPROUT, EmbedLLM, RouterBench). It also proposes two practical extensions: disjoint parameterization to capture LLM heterogeneity and a contrastive-learning-based, utility-aligned embedding scheme (ACQB-CL) to improve routing utilities. Overall, the framework provides an anytime, scalable solution for real-time LLM routing/scheduling with implicit feedback, improving throughput and user experience in high-demand settings.
Abstract
Explosive demands for LLMs often cause user queries to accumulate in server queues, requiring efficient routing (query-LLM matching) and scheduling (query prioritization) mechanisms. Several online algorithms are being deployed, but they overlook the following two key challenges inherent to conversational LLM services: (1) unsatisfied users may retry queries, increasing the server backlog, and (2) requests for ``explicit" feedback, such as ratings, degrade user experiences. In this paper, we develop a joint routing and scheduling algorithm that leverages ``implicit" feedback inferred from user retrial behaviors. The key idea is to propose and study the framework of contextual queueing bandits with multinomial logit feedback (CQB-MNL). CQB-MNL models query retrials, as well as context-based learning for user preferences over LLMs. Our algorithm, anytime CQB (ACQB), achieves efficient learning while maintaining queue stability by combining Thompson sampling with forced exploration at a decaying rate. We show that ACQB simultaneously achieves a cumulative regret of $\widetilde{\mathcal{O}}(\sqrt{t})$ for routing and a queue length regret of $\widetilde{\mathcal{O}}(t^{-1/4})$ for any large $t$. For experiments, we refine query embeddings via contrastive learning while adopting a disjoint parameter model to learn LLM-specific parameters. Experiments on SPROUT, EmbedLLM, and RouterBench datasets confirm that both algorithms consistently outperform baselines.
