Manuscript Offprint
arXiv:2610.22695Chance-Constrained Personalized LLM Routing with Online Preference Learning
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We study personalized LLM routing, where a router selects among heterogeneous models with different costs and capabilities. The router must minimize cumulative inference cost while ensuring reliable realized response quality, even though user preferences are unknown and must be learned from feedback during deployment. We formulate this problem as a constrained contextual bandit and develop a primal-dual GLM-UCB algorithm that learns preferences while balancing cost and quality. Under a logistic preference model and a strict-feasibility condition, we establish sublinear expected cost regret relative to an optimal stationary randomized contextual oracle and a high-probability guarantee on realized cumulative satisfaction. The framework extends beyond LLM routing to broader online model-selection problems with reliability requirements.
1. Introduction
Modern machine learning systems increasingly rely on collections of models with different capabilities and inference costs. Rather than using the same model for every input, a system can route each request to an appropriate model, using inexpensive models when they are sufficient and reserving more expensive models for difficult inputs. This model-routing paradigm is particularly relevant for large language models (LLMs), whose costs and capabilities can differ substantially across models (Chen et al., 2024a; Hu et al., 2024; Ong et al., 2025).
The challenge becomes more subtle when the appropriate model depends not only on the request but also on the user. Different users may prefer different models for the same request, and these preferences may not be known before deployment. A router must therefore learn a user's preferences from feedback while making routing decisions, gradually discovering which model is more likely to satisfy that user for a given request. This connection between personalization and online learning has long been studied through contextual-bandit methods for personalized recommendation (Li et al., 2010; Xu et al., 2020), and recent work has begun to explore personalized and online LLM routing (Dai et al., 2025; Xie et al., 2025; Zeng et al., 2026). These developments motivate an online routing problem in which user preferences are unknown and must be learned from the outcomes of the models selected by the router.
Learning user preferences, however, is only part of the challenge. In many deployments, consistently poor responses may be unacceptable even if average satisfaction is high. A router may instead need to ensure that at least a fraction of responses satisfy a desired quality criterion over a horizon of requests, with probability at least . If indicates whether the response at round satisfies the user's requirements, this requirement is
Here, the satisfaction outcome depends on both the selected model and the user's preferences. Therefore, the router must learn the preferences governing satisfaction likelihood while ensuring that the resulting sequence of outcomes remains sufficiently reliable by satisfying the chance constraint.
This leads to a challenging online decision problem. The router must learn from the limited feedback generated by its own model choices, keep cumulative inference cost low, and ensure that the realized number of satisfactory responses does not fall too far below the target. This differs from an expectation-level constraint, which can balance expected cost and expected satisfaction through a Lagrangian objective. Here, controlling expected satisfaction alone does not directly control the probability of falling below the desired level in the realized sequence. The router must therefore account for both uncertainty in what it has learned about the user's preferences and randomness in the resulting satisfaction outcomes.
We formulate this setting as a constrained contextual bandit with known model costs and unknown preference parameters. At each round, the learner observes the request context, selects one model, incurs its cost, and observes only the satisfaction feedback from that model. The goal is to minimize cumulative cost while satisfying the high-probability requirement in (1).
Our solution follows a simple principle: learn what the user prefers while continuously monitoring whether the routing decisions are keeping pace with the desired satisfaction level. The router maintains optimistic estimates of how likely each model is to satisfy the user, allowing it to explore uncertain choices while favoring cost-effective ones. At the same time, it keeps track of any accumulated deficit in satisfaction. When the router begins to fall behind, it shifts toward models that are more likely to satisfy the user. We use this idea to propose an algorithm and provide sublinear regret bounds with respect to a stationary routing policy while ensuring that the chance constraints are met.
Although personalized LLM routing motivates our study, the framework applies more broadly. It applies whenever a system repeatedly chooses among heterogeneous models, services, or alternatives with different costs, while learning an unknown preference or satisfaction model from feedback and seeking to maintain a reliability requirement. This includes, for example, personalized recommendation and online advertising under resource or budget constraints (Zhao & Yang, 2024), cloud or edge service selection subject to cost, quality-of-service, and reliability requirements (Ma et al., 2026), and dynamic procurement among suppliers with heterogeneous costs and uncertain quality under operational constraints (Vassos et al., 2023).
These considerations lead to the following contributions:
-
We formulate personalized online LLM routing as a contextual bandit with unknown user preferences and a cumulative requirement on realized satisfaction, going beyond the usual expectation-level cost-quality formulation.
-
We develop a primal-dual GLM-UCB algorithm that combines optimistic preference learning with a virtual satisfaction-deficit queue and a safety buffer.
-
Under a logistic preference model and a uniform strict-feasibility condition, we establish sublinear expected cost regret relative to an optimal stationary randomized contextual oracle while guaranteeing the required realized cumulative satisfaction with high probability.
-
Finally, we provide numerical experiments to demonstrate the effectiveness of our algorithm. We evaluate its performance through synthetic experiments and a real-world LLM routing case study, examining chance constraint satisfaction, routing cost, personalization, and finite-horizon behavior.
Table 1. Comparison of LLM routing approaches.
| Method | Online | Personalized | Safety |
|---|---|---|---|
| FrugalGPT | ✕ | ✕ | ✕ |
| RouteLLM | ✕ | ✕ | ✕ |
| PersonalizedRouter | ✕ | ✓ | ✕ |
| MetaRouter | ✓ | ✓ | ✕ |
| BaRP | ✓ | ✓ | ✕ |
| Conformal Routing | ✕ | ✕ | ✓ |
| SLARouter | ✓ | ✕ | ✓ |
| Ours | ✓ | ✓ | ✓ |
References: 1) FrugalGPT (Chen et al., 2024a); 2) RouteLLM (Ong et al., 2025); 3) PersonalizedRouter (Dai et al., 2025); 4) MetaRouter (Zeng et al., 2026); 5) BaRP (Wei et al., 2025a); 6) Conformal Routing (Uddin & Bauer, 2026); 7) SLARouter (Woisetschläger et al., 2026).
Personalized routing addresses the additional challenge that different users may prefer different models. PersonalizedRouter (Dai et al., 2025) models heterogeneous user preferences, while GMTRouter (Xie et al., 2025) and MetaRouter (Zeng et al., 2026) explore learning-based approaches to personalized routing. BaRP (Wei et al., 2025a) further studies routing under bandit feedback. These methods move closer to our setting, where user preferences are learned through interaction rather than assumed to be known in advance. However, our work differs from these approaches by combining online personalization with an explicit high-probability guarantee on realized cumulative satisfaction.
Online learning with constraints. Primal–dual methods provide a general framework for online learning under cumulative constraints. Prior work studies long-term constraints in online convex optimization (Mahdavi et al., 2012), constrained Markov decision processes (Cardoso et al., 2019), and contextual bandits with knapsacks (Agrawal & Deva-nur, 2016; Badanidiyuru et al., 2018; Balseiro et al., 2020). These methods typically regulate resource consumption or optimize expected performance under cumulative constraints. In contrast, our method uses a virtual queue to track the realized satisfaction deficit and learns unknown satisfaction probabilities from contextual bandit feedback. This enables a high-probability guarantee on realized cumulative satisfaction, rather than merely controlling expected performance or constraint violation.
Table 1 summarizes how representative routing approaches compare along three dimensions: online learning, personalization, and explicit satisfaction or safety guarantees. Among the approaches considered, our method is the only one that combines all three.
3. Problem Formulation
We study personalized LLM routing in which a router selects one of candidate models for each incoming prompt. The models may differ in computational cost, and a user's preferred model may depend on the prompt. Since these preferences are unknown, the router must learn them from user feedback while keeping inference cost low and maintaining a desired level of satisfaction.
We formulate this problem as a contextual bandit with generalized linear feedback and a cumulative chance constraint (also referred to as Quality constraint). The router observes the prompt and features of all candidate models, but receives satisfaction feedback only from the selected model.
3.1. Online Routing Model
Consider a routing system operating over a horizon of rounds, indexed by . At each round:
-
Context. The router observes a prompt , drawn independently from the prompt distribution.
-
Model selection. After observing , the router selects
- Features. A known feature map assigns a feature vector to each prompt-model pair:
Thus, the router can compute the features of all candidate models before making its selection.
- Cost and feedback. Selecting model incurs a known deterministic cost
After the response is generated, the router observes binary satisfaction feedback , where indicates that the response satisfies the user's requirements.
The router therefore observes the features of every candidate model but only observes satisfaction feedback for the selected model.
3.2. User Satisfaction Model
We model the probability that a response satisfies the user through a generalized linear model with a logistic link:
Let denote the information available before observing , including the current context and selected action. We assume
(4)
Here, is unknown and captures how the observed prompt-model features relate to the user's satisfaction.
Assumption 3.1 (Boundedness). For every and ,
where are known. Moreover, the model costs are normalized so that they satisfy for all .
To ensure that the cumulative satisfaction requirement remains feasible, we assume the availability of a reliable fallback model with known satisfaction performance.
Assumption 3.2 (Fallback). There exists a baseline model that is exempt from the generalized linear model and has a known satisfaction probability , . We additionally assume , so the fallback is strictly feasible; its feedback is not used to estimate .
This assumption does not imply that every LLM routing problem necessarily admits such an action. In practice, the fallback may correspond to a more expensive model that provides sufficiently reliable responses to user queries or a validated service with a known satisfaction guarantee exceeding the target.
We use the following slack factor to quantify this margin.
Definition 3.3 (Slack Factor). For and fallback satisfaction probability , define the slack factor by
The strict-feasibility assumption ensures .
3.3. Chance-Constrained Routing Objective
The router seeks to minimize cumulative inference cost while maintaining a prescribed level of cumulative user satisfaction. Rather than constraining only the expected satisfaction, we require the realized satisfaction over the entire horizon to meet the target with high probability.
Definition 3.4 (Quality Constraint). For a target level , failure probability , and a known time horizon , the routing policy must satisfy
Equivalently, at least responses must satisfy the user with probability at least . This chance constraint directly captures the reliability requirement of the routing system.
3.4. Stationary Contextual Oracle
To measure the cost of online learning, we compare the router with a stationary randomized contextual policy that knows the true satisfaction model.
Definition 3.5 (Stationary Contextual Oracle). Let denote the class of stationary randomized contextual policies
where is the probability of selecting model for prompt . The oracle is any solution to
subject to
where , and the probability is taken over the prompts, model selections, and satisfaction outcomes.
The oracle represents the minimum expected cost that could be achieved by a stationary router with complete knowledge of the user's satisfaction model.
Lemma 3.6 (Necessary Expectation Condition). Under the stationary contextual oracle, for and , there exists a maximum margin such that
for every .
where denotes the cumulative distribution function (CDF) of the standard normal distribution, and denotes its inverse (quantile) function.
Remark 3.7. This lemma shows that, to meet the satisfaction requirement with high probability, the oracle's expected satisfaction must be slightly above the target . Further, the corollary shows that this required gap decreases as and becomes smaller as the horizon grows.
3.5. Cost Regret
We measure the additional cost incurred while learning relative to the oracle.
Definition 3.8 (Cumulative Cost Regret). Let denote the model selected by the oracle at round . The expected cumulative cost regret is
Our goal is therefore to achieve sublinear cost regret while satisfying the chance constraint in (7).
Algorithm 1 Primal-Dual GLM-UCB Router
Require: Time horizon ; action set ; parameters ; regularization parameter ; stepsize ; safety buffer .
1: Initialize , . 2: for do 3: Observe prompt and compute . 4: Compute according to (11). 5: for all do 6: Compute according to (14) with confidence radius given by (15). 7: end for 8: Select
.
9: Route using model and observe . 10: if .
11: else 12: . 13: end if 14: Update
.
15: end for
4. Primal-Dual GLM-UCB Router
The router must address several challenges simultaneously. It must learn which models are likely to satisfy the user while preventing cumulative satisfaction from falling below its target and keeping the cost as low as possible.
We now propose our main algorithm that achieves sublinear regret while satisfying the chance constraint (1). The algorithm proceeds in the following steps:
-
At each round, the router first uses the observed feedback from previous rounds to estimate the unknown GLM parameter .
-
Next, it selects a model by balancing its inference cost against its estimated satisfaction, with the tradeoff determined by the current dual variable.
-
After observing the realized satisfaction, the router updates the dual variable according to the resulting satisfaction deficit.
The overall algorithm is summarized in Algorithm 1.
4.1. Learning User Satisfaction
The router estimates using all feedback observed so far. At round , it computes the constrained regularized logistic estimator
where and
After observing the selected model's feedback, the design matrix is updated if according to
The parameter constraint ensures that both the true and estimated parameters lie in the same bounded domain. Since the logistic link has positive derivative on any bounded interval, this gives the uniform curvature needed for the confidence analysis.
4.2. Optimistic Satisfaction Estimates
For every candidate model, we form
Here, is the confidence radius defined by
where is a constant defined by,
Moreover, for , we set
The confidence-based formula is used for ; the fallback is handled separately by its known value . Thus, the router can explore potentially useful models without treating an uncertain model as poor simply because it has not yet received enough feedback.
4.3. Model Selection and Virtual Satisfaction Queue
To balance inference cost against the cumulative satisfaction requirement, we maintain a nonnegative virtual satisfaction queue , initialized with . The variable can equivalently be viewed as a dual variable associated with the satisfaction requirement. After selecting model and observing the realized satisfaction , the queue is updated according to
where is the step size and is a safety buffer. Thus, the queue increases when the realized satisfaction falls below the buffered target and decreases otherwise.
At round , given the current queue , the router selects the model according to
The queue therefore determines how strongly the router prioritizes satisfaction relative to cost. When is small, the router places greater emphasis on cost, whereas a larger favors models with higher optimistic satisfaction estimates.
We choose
where and . The safety buffer provides additional slack to account for the random deviation between expected and realized cumulative satisfaction.
We note that under Assumption 3.1, all relevant linear predictors satisfy .

Figure 1. Comparison of the proposed routing algorithm with alternative routing strategies as the satisfaction tolerance varies. In the third panel, the green and orange curves overlap.
5. Theoretical Guarantees
We now establish theoretical guarantees for the algorithm, including a sublinear regret bound. We first derive a high-probability confidence bound for the estimated satisfaction model, which is then used to control the terms. Building on these results, we analyze the evolution of the virtual queue and establish the main theoretical guarantees of the algorithm.
We begin with the following lemma, which provides a high-probability bound on the estimation error of .
Lemma 5.1 (Uniform GLM Confidence Bound). Under Assumption 3.1, with probability at least , simultaneously for all and ,
and
Next, the following lemma establishes that the router’s satisfaction estimate is optimistic, providing an upper bound on the true satisfaction probability. As more feedback is collected, the estimate becomes increasingly accurate, which plays a key role in the subsequent regret analysis.
Lemma 5.2 (UCB Bounds). On the confidence event of Lemma 5.1, for every and ,
- The UCB is optimistic:
- The optimism gap satisfies
5.1. Control of the Satisfaction Queue
Next, we show that the virtual satisfaction queue remains controlled with high probability.
For the fallback action, the UCB is set to its known satisfaction probability .
Lemma 5.3 (High-Probability Queue Bound). Suppose Assumptions 3.1 and 3.2 hold. For any , there exist
such that, with probability at least ,
The queue bound in (26) establishes that the dual queue remains bounded throughout the execution of the algorithm. This result is then used to show that the desired quality constraint is satisfied with high probability.
5.2. Main Guarantee
We can now state the main result.
Theorem 5.4 (Cost Regret and Satisfaction Guarantee). Suppose Assumptions 3.1 and 3.2 hold, and the constants in Algorithm 1 are chosen as specified in Section 4. Then, there exists a constant such that for the proposed router satisfies
and its expected cumulative cost regret relative to the optimal stationary contextual oracle satisfies
Proof Sketch. The proof has two main steps. First, Lemmas 5.1 and 5.2 establish the accuracy of the router's optimistic satisfaction estimates, with estimation errors decreasing as more feedback is collected. Under the decision rule in Eq. (20), the router balances cost against these estimates, allowing the cost regret to be bounded in terms of the estimation errors weighted by the virtual queue . Lemma 5.3 plays a crucial role by establishing a bound on the queue, thereby limiting the impact of estimation errors.

Figure 2. Overall performance and ablation results. Error bars denote 95% confidence intervals. The dotted lines indicate the required satisfaction level and constraint probability , respectively.
on regret. Summing these errors over time yields the regret bound in Eq. (28). Second, the queue update in Eq. (19) tracks accumulated satisfaction deficits and increases the queue when realized satisfaction falls below the buffered target. The boundedness of the queue, together with the safety buffer and a concentration argument, ensures that the cumulative satisfaction requirement in Eq. (27) holds with probability at least . The detailed proofs are provided in Appendices A.4 and A.5.
Theorem 5.4 shows that the router can learn user preferences while maintaining the required satisfaction level, incurring only sublinear additional cost relative to an oracle. Moreover, the dependence of our regret bounds on the slack factor indicates that achieving lower routing costs becomes increasingly challenging as the fallback performance approaches the target satisfaction level .
6. Experimental Results
We evaluate the proposed algorithm through five experiments and a real-LLM case study, examining routing baselines, ablations, real-world performance, personalization, and scalability with the decision horizon. Details are provided in Appendix B.
6.1. Comparison with Alternative Routing Strategies
We first compare the proposed method with three representative routing strategies: a SLARouter-style global constrained router (Woisetschläger et al., 2026), a BaRP-style unconstrained personalized router (Wei et al., 2025b), and an expectation-constrained primal-dual router (Yang et al., 2025). We vary the satisfaction tolerance while fixing , , and all methods are evaluated over the same 1000 replay trials.
Figure 1 shows the resulting cost, average satisfaction, and empirical constraint satisfaction probability. As increases, the proposed method reduces its average routing cost because the required satisfaction level becomes less stringent. At the same time, its empirical constraint satisfaction probability remains close to the target . We observe that the SLARouter does not exploit contextual information and therefore has a higher average cost, while the BaRP-style router and the expectation-constrained primal-dual router fail to satisfy the chance constraint.
6.2. Ablation
Next, we examine the contributions of the dual queue and safety margin in the proposed algorithm. We compare Ours with No-Queue, which removes the update equation, and No- , which sets the safety margin to . All methods are evaluated with and . We report the average routing cost, the average satisfaction, and the probability of empirical constraint satisfaction with 95% confidence intervals.
As shown in Figure 2, Ours satisfies the empirical chance constraint in almost all trials. No-Queue and No- achieve lower routing costs, but their empirical constraint-satisfaction probabilities are close to zero. These results suggest that the dual queue helps adapt routing decisions to accumulated constraint violations, while the safety margin provides additional protection against uncertainty in the learned satisfaction estimates.
6.3. Real-LLM Routing
We next evaluate the proposed method on real LLMs using 100 queries from WildBench v2 and five available LLMs as routing actions. For each query–model pair, the response is represented by a six-dimensional quality vector measuring correctness, relevance, completeness, clarity, conciseness, and safety, evaluated by a lightweight judge model. We then apply a fixed parameter in the logistic model of Section 3.2 to generate simulated satisfaction outcomes.
Figure 3 illustrates the routing cost and model selection as the satisfaction tolerance varies. The average routing
Additional details are in Appendix B


Figure 3. Real-LLM routing POC: (a) average routing cost as a function of and (b) model-selection composition as a function of .

Figure 4. Personalized and global routing costs for Users 1–3.

Figure 5. Per-round and cumulative cost gap relative to the oracle across horizons.
cost decreases as increases, since it permits more frequent selection of inexpensive models. In particular, the router increasingly selects Qwen3.8-27B, the lowest-cost model, as the constraint is relaxed. Conversely, for smaller , it places greater weight on higher-satisfaction models such as DeepSeek-V4-Flash despite their higher cost. This illustrates how the routing policy adapts model selection to the quality–cost trade-off imposed by the chance constraint.
6.4. Personalization
We next evaluate whether explicitly modeling user-specific preferences can improve routing efficiency. We consider three users who receive the same sequence of requests but have different preference parameters. We compare a personalized learner, which maintains separate model estimates and safety queues for each user, with a global learner that pools observations across users. Both methods use the same requests and counterfactual outcomes.
Figure 4 reports the average routing cost for each user. The personalized learner achieves lower routing cost while maintaining satisfaction above the required level. We omit a separate satisfaction plot because all methods satisfy the constraint in this experiment; therefore, the cost comparison more clearly illustrates the benefit of personalization.
6.5. Finite-Horizon Scaling
Finally, we examine how the proposed method performs as the number of routing decisions increases. We consider horizons and compare the cumulative cost of the proposed method with that of an oracle policy that knows the true model parameters.
As shown in Fig. 5, the cumulative cost gap relative to the oracle grows sublinearly over the evaluated horizons. This empirical behavior is consistent with the sublinear regret guarantee established in our analysis. Satisfaction results are omitted for brevity.
7. Conclusion
We presented a framework for online personalized LLM routing that learns user preferences, minimizes inference costs, and enforces a high-probability quality constraint. Our primal-dual GLM-UCB algorithm combines optimistic preference learning with a satisfaction-deficit queue and achieves sublinear cost regret while ensuring satisfaction with high probability. Experimental results demonstrate that the proposed method can reduce routing costs through personalization while maintaining the required quality level, including in a real-world LLM routing task.
Future research directions include accommodating nonsta-tionary user preferences and incorporating richer feedback signals. Additionally, the current analysis assumes a uniform fallback satisfaction level. Extending the analysis to accommodate context-dependent or uncertain fallback guarantees is another interesting direction for future work.
References
Agrawal, S. and Devanur, N. R. Linear contextual bandits with knapsacks. In Advances in Neural Information Processing Systems, volume 29, 2016.
Badanidiyuru, A., Kleinberg, R., and Slivkins, A. Bandits with knapsacks. Journal of the ACM, 65(3):1–55, 2018. doi: 10.1145/3164539.
Balseiro, S., Lu, H., and Mirrokni, V. Dual mirror descent for online allocation problems. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 613–628. PMLR, 2020.
Cardoso, A. R., Wang, H., and Xu, H. Large scale markov decision processes with changing rewards. In Advances in Neural Information Processing Systems, volume 32, 2019.
Chen, L., Zaharia, M., and Zou, J. Frugalgpt: How to use large language models while reducing cost and improving performance. Transactions on Machine Learning Research, 2024a.
Chen, S., Jiang, W., Lin, B., Kwok, J. T., and Zhang, Y. Routerdc: Query-based router by dual contrastive learning for assembling large language models. In Advances in Neural Information Processing Systems, volume 37, 2024b.
Dai, Z., Feng, T., and You, J. Personalizedrouter: Personalized llm routing via graph-based user preference modeling. arXiv preprint arXiv:2511.16883, 2025.
DeepSeek-AI. Deepseek-v4: Towards highly efficient million-token context intelligence, 2026.
Hu, Q. J., Bieker, J., Li, X., Jiang, N., Keigwin, B., Ranganath, G., Keutzer, K., and Upadhyay, S. K. Routerbench: A benchmark for multi-llm routing system. arXiv preprint arXiv:2403.12031, 2024.
Labs, M. S. Muse-glimmer-30b: An open-weight dense multimodal causal transformer. https://huggingface.co/meta-models/Muse-Glimmer-30B, 2026. Apache 2.0 License.
Li, L., Chu, W., Langford, J., and Schapire, R. E. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th Inter-
national Conference on World Wide Web, pp. 661–670, 2010.
Ma, Q., Chen, Z., Wang, Z., Gao, L., and Chen, X. Efficient service selection and pricing in edge-cloud computing markets. IEEE Transactions on Networking, 34:471–485, 2026.
Mahdavi, M., Jin, R., and Yang, T. Trading regret for efficiency: Online convex optimization with long term constraints. Journal of Machine Learning Research, 13(81):2503–2528, 2012.
NVIDIA. Nvidia nemotron 3: Efficient and open intelligence, 2025. URL https://arxiv.org/abs/2512.20856. White Paper.
Ong, I., Almahairi, A., Wu, V., Chiang, W.-L., Wu, T., Gonzalez, J. E., Kadous, M. W., and Stoica, I. Routellm: Learning to route llms from preference data. In International Conference on Learning Representations, 2025.
Qwen Team. Qwen3.6-35B-A3B: Agentic coding power, now open to all, April 2026a. URL https://qwen.ai/blog?id=qwen3.6-35b-a3b.
Qwen Team. Qwen3.8-Max: A new bar for coding and cowork, August 2026b. URL https://qwen.ai/blog?id=qwen3.8.
Somerstep, S., Polo, F. M., Melo de Oliveira, A. F., Mangal, P., Silva, M., Bhardwaj, O., Yurochkin, M., and Maity, S. Carrot: A cost aware rate optimal router. arXiv preprint arXiv:2502.03261, 2025.
Team, G. Gemma 4 technical report, 2026. URL https://arxiv.org/abs/2607.02770.
Uddin, I. and Bauer, A. Conformal LLM routing with distribution-free safety guarantees. In Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop), pp. 791–799, San Diego, California, United States, 2026. Association for Computational Linguistics. doi: 10.18653/v1/2026.acl-srw.70. URL https://aclanthology.org/2026.acl-srw.70/.
Vassos, G., Holst, K. K., Pinson, P., and Lusby, R. M. A simulation framework of procurement operations in the container logistics industry, 2023. URL https://arxiv.org/abs/2303.12765.
Wei, W., Yang, T., Chen, H., Zhao, Y., Dernoncourt, F., Rossi, R. A., and Eldardiry, H. Learning to route llms from bandit feedback: One policy, many trade-offs. arXiv preprint arXiv:2510.07429, 2025a.
Wei, W., Yang, T., Chen, H., Zhao, Y., Dernoncourt, F., Rossi, R. A., and Eldardiry, H. Learning to route llms from bandit feedback: One policy, many trade-offs, 2025b.
Woisetschlager, H., Mammadli, A., Zhang, R., and Wang, S. Cost-optimal LLM routing with limited user feedback under user satisfaction guarantees, 2026. URL https://arxiv.org/abs/2606.19376.
Woisetschlager, H., Mammadli, A., Zhang, R., and Wang, S. Cost-optimal llm routing with limited user feedback under user satisfaction guarantees, 2026.
Xie, E., Sun, Y., Feng, T., and You, J. Gmtrouter: Personalized llm router over multi-turn user interactions. arXiv preprint arXiv:2511.08590, 2025.
Xu, X., Dong, F., Li, Y., He, S., and Li, X. Contextual-bandit based personalized recommendation with time-varying user interests. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 6518–6525, 2020.
Yang, S., Li, X., and Lan, G. Data-driven minimax optimization with expectation constraints. Operations Research, 73(3):1345–1365, 2025. doi: 10.1287/opre.2022.0110.
Zeng, J., Tang, M., and Ding, N. Learning to route llms from implicit cost-performance preferences via meta-learning, 2026. URL https://arxiv.org/abs/2606.06178.
Zhao, Y. and Yang, L. Constrained contextual bandit algorithm for limited-budget recommendation system. Engineering Applications of Artificial Intelligence, 128:107558, 2024. ISSN 0952-1976. doi: https://doi.org/10.1016/j.engappai.2023.107558. URL https://www.sciencedirect.com/science/article/pii/S0952197623017426.
A. Proofs
A.1. Necessary Expectation Condition
Lemma A.1 (Necessary Expectation Condition). Suppose the stationary contextual oracle generates i.i.d. satisfaction outcomes under the model described in Section 3. In particular, prompts are i.i.d., the oracle randomizes independently across rounds according to , and satisfaction randomness is conditionally independent across rounds. Given , , and , define
Let denote the unique value satisfying
where
Define the maximum expectation margin
Then, for any
satisfying the chance constraint
necessarily requires
In particular, is the largest expectation margin implied by the chance constraint.
Proof. Let
and define
Under the stated assumptions, the random variables are i.i.d., and
Consequently, the marginal outcomes are i.i.d. Bernoulli with mean , so that
The chance constraint can therefore be written as
Let be defined by (29). The binomial upper-tail probability
is continuous and strictly increasing in . Therefore, if
then
Thus the chance constraint cannot hold when . Hence, satisfying the chance constraint necessarily requires
By the definition of ,
Therefore,
Since
we obtain
This proves the result.

Corollary A.2 (Large-Horizon Approximation). For fixed and , as , the maximum expectation margin defined in Lemma 3.6 satisfies
where denotes the inverse cumulative distribution function of the standard normal distribution. Thus, for sufficiently large ,
Proof. By Lemma 3.6, is defined through the binomial threshold satisfying
where . Write
For fixed and , the central limit theorem gives
Since as , we have
Consequently,
which yields (33).

A.2. Proof of Regret Bounds
Before proving the regret bounds, we first list and prove the results needed for the main theorem.
A.2.1. PROOF OF LEMMA 5.1
Define
For a given confidence parameter , define
Let denote the event on which the corresponding confidence inequality holds uniformly over all rounds.
Lemma A.3 (Uniform GLM Confidence Bound). Under Assumption 3.1, with probability at least , simultaneously for all and ,
and
Proof. Define the regularized negative log-likelihood at round as
The estimator is obtained via constrained minimization over the ball :
Since is convex and is a closed convex set, satisfies the first-order optimality condition:
Since by Assumption 3.1, setting yields:
Using the fundamental theorem of calculus along the line segment connecting and , we obtain:
(42) where
Taking the inner product with on both sides:
\begin{align*}\|\widehat{\theta}_{t}-\theta^{*}\|_H_t^2&=\langle\nabla\mathcal{L}_{t}(\widehat{\theta}_{t})-\nabla\mathcal{L}_{t}(\theta^{*}),\widehat{\theta}_{t}-\theta^{*}\rangle\\&=\langle\nabla\mathcal{L}_{t}(\widehat{\theta}_{t}),\widehat{\theta}_{t}-\theta^{*}\rangle-\langle\nabla\mathcal{L}_{t}(\theta^{*}),\widehat{\theta}_{t}-\theta^{*}\rangle\\&\leq-\langle\nabla\mathcal{L}_{t}(\theta^{*}),\widehat{\theta}_{t}-\theta^{*}\rangle,\end{align*}(44)
where the final step applies the variational inequality (41).
Evaluating the gradient at gives:
where is a conditionally zero-mean martingale difference.
The Hessian at any point is:
Because and is convex, any point on the line segment for satisfies . Under Assumption 3.1, , which guarantees:
Consequently, . Therefore, using the fact that :
(48)
Applying to (44) along with the Cauchy-Schwarz inequality in the dual norms gives:
\begin{align*}&\kappa\|\widehat{\theta}_{t}-\theta^{*}\|_V_t^2\leq \|\widehat{\theta}_{t}-\theta^{*}\|_H_t^2\\&\leq \left\langle\sum_{\substack{\tau=1\\ a_{\tau}\neq \tilde{a}}}^{t-1} \eta_\tau x_{a_\tau,\tau}-\beta\theta^{*},\widehat{\theta}_{t}-\theta^{*}\right\rangle\\&\leq \left\|\sum_{\substack{\tau=1\\ a_{\tau}\neq \tilde{a}}}^{t-1} \eta_\tau x_{a_\tau,\tau}-\beta\theta^{*}\right\|_V_t^{-1}\|\widehat{\theta}_{t}-\theta^{*}\|_V_t.\end{align*}(49)
Dividing both sides by \kappa\|\widehat{\theta}_t-\theta^*\|_V_t yields:
\begin{align*}\|\widehat{\theta}_{t}-\theta^{*}\|_V_t&\leq \frac{1}{\kappa}\left\|\sum_{\substack{\tau=1\\ a_{\tau}\neq \tilde{a}}}^{t-1} \eta_\tau x_{a_\tau,\tau}-\beta\theta^{*}\right\|_V_t^{-1}\\&\leq \frac{1}{\kappa}\left(\left\|\sum_{\substack{\tau=1\\ a_{\tau}\neq \tilde{a}}}^{t-1} \eta_\tau x_{a_\tau,\tau}\right\|_V_t^{-1} + \sqrt{\beta}S\right).\end{align*}Since , the noise is conditionally -sub-Gaussian. Applying the self-normalized vector martingale inequality, with probability at least , uniformly for all :
\begin{align*}&\left\|\sum_{\substack{\tau=1\\ a_{\tau}\neq \tilde{a}}}^{t-1} \eta_\tau x_{a_\tau,\tau}\right\|_V_t^{-1}\\&\leq \frac{1}{2}\sqrt{2\log\left(\frac{2}{\delta_\mathcal{E}}\right)+d\log\left(1+\frac{(t-1)L^2}{\beta d}\right)}.\end{align*}(50)
Combining these results establishes that \|\widehat{\theta}_t-\theta^*\|_V_t\leq \alpha_t.
Finally, by the Mean Value Theorem on the link function and Cauchy-Schwarz:
\begin{align*}\left|\mu(x_{a,t}^\top\widehat{\theta}_{t})-\mu(x_{a,t}^\top\theta^{*})\right|&\leq \sup_{|z|\leq LS} \mu'(z)\cdot \left|x_{a,t}^\top(\widehat{\theta}_{t}-\theta^{*})\right|\\&\leq L_\mu\|x_{a,t}\|_V_t^{-1}\|\widehat{\theta}_{t}-\theta^{*}\|_V_t\\&\leq \alpha_t\|x_{a,t}\|_V_t^{-1},\end{align*}(51)
where , completing the proof.
Next, using this result, we bound the UCB terms.
A.3. UCB Bounds
Lemma A.4 (UCB Bounds). On the event , for every :
- The prediction error satisfies
- The UCB is optimistic:
- The optimism gap is bounded by
Proof. Under the confidence event,
By the mean-value theorem and the fact that ,
(55)
This proves the prediction error bound.
For optimism, the preceding inequality gives
Since , taking the minimum with preserves the inequality, and hence
Finally,
□
A.3.1. BOUNDING THE DUAL VARIABLE
Lemma A.5 (Uniform Boundedness of the Dual Variable). Suppose Assumptions 3.1 and 3.2 hold. For any , there exist such that for a sufficiently large , with probability at least ,
Proof. We first establish a high-probability bound on the dual variable. Define
and let
We condition on the pre-outcome information defined in Section 3.2:
Let . Since , we have , so is a martingale-difference sequence. Since ,
On the confidence event, Assumption 3.2 implies
By the primal minimization rule,
Consequently,
where
Therefore,
Using the confidence bound,
and hence
(57)
(58)
Now, we consider the case where where . Therefore, we choose . Also, note that and . Therefore, for sufficiently large , .
In particular, whenever
for we have
Define an exceptional round to be a round satisfying
On every non-exceptional round for which we have , equation (60) gives
Let
Every exceptional round satisfies
By the elliptical potential count lemma, the number of exceptional rounds satisfies
(61)
(62)
where we used and .
We now control excursions of the dual process above the threshold
Suppose that , and let
be the most recent time before at which the process was at or below . Since and ,
During the excursion, , and hence the conditional drift is non-positive on all non-exceptional rounds. On an exceptional round, we use the crude bound
Therefore, writing for the set of exceptional rounds,
Let and . Since is a martingale-difference sequence with , the maximal Azuma–Hoeffding inequality gives, with probability at least ,
Every interval sum is a difference of two prefix sums, so on the same event,
Combining this inequality with (65), we obtain
with probability at least .
Using and the bound in (62), it follows that
with probability at least .
We choose and , with .
Choose instead . Then stays bounded away from zero for fixed , so the exceptional-round term is . Therefore,
For sufficiently large , and . Now, for a sufficiently large , and . Substituting gives
<div style="text-align: center;">$\square$</div>A.4. Proof of the Cost Regret Bound
Proof of Theorem 5.4, regret bound. We first define , so that (hence and ) is -measurable, while and (drawn with independent external randomness) are not. Let also denote the history up to the end of round . Then and are -measurable, while and are independent of .
Fix the failure level , used only in this proof, and let be the bound of Lemma 5.3 on at this level.
Define
with if neither event occurs. Therefore,
By definition of as the first crossing time, holds only for , not at itself; we therefore work with throughout, rather than .
Step 1: Primal comparison. By the selection rule of Algorithm 1, for every ,
so
Step 2: Replacing UCB by the true satisfaction probabilities. By Lemma 5.2, on , for every ,
For , holds at round by definition of , so
Combining (70)–(71), for ,
Step 3: Decomposition. With , , , and , adding and subtracting in (72) gives, for ,
We bound , and in Steps 4–6.
Step 4: Term . From and ,
(pathwise).
(74)
Since , summing (74) over and using ,
Since is -measurable and for , is a bounded martingale, so by optional stopping,
Step 5: Term . By the proof of Lemma 3.6, feasibility of implies . Because and are independent of (prompts are i.i.d. and is stationary with external randomization), . Hence
(77)
Since is -measurable with on ,
(If this is 0)
Step 6: Term . For , and . By Cauchy–Schwarz and the elliptical potential lemma (with ),
Step 7: Cost of the bad event. Rounds (nonempty only if , i.e. the stopping round itself plus everything after) each contribute at most 1, so
using .
Step 8: Combining. Summing (73) and splitting at , then applying (76), (78), (79), (80),
With and, from the crude (Azuma-based) form of Lemma 5.3 at ,
(the dependence is absorbed into ). Choose . Then and
Therefore (81) gives
We can show that for , , therefore, we can simplify the expression to get the last term.
A.5. Proof of High-Probability Quality Constraint Satisfaction
Proof. Consider the dual update
Since ,
Summing this inequality from to and using gives
Rearranging,
On the event where the dual variable is uniformly bounded,
Therefore,
Finally, we have
Choose
Then
which is sufficient for the satisfaction guarantee.
Using the queue bound above with and , its leading terms satisfy
For , the right-hand side converges to as . Since , the strict inequality therefore holds for all sufficiently large under the stated queue bound. Hence there exists such that, for , the chance constraint holds with probability at least .
Consequently,
Since this conclusion holds on an event of probability at least , we obtain
This establishes that our algorithm satisfies the quality constraint.

Figure 6. Sensitivity to the satisfaction tolerance . Dashed lines indicate the corresponding satisfaction and constraint thresholds.

Figure 7. Confidence Calibration

Figure 8. Empirical probability of satisfying the chance constraint over 5000 independent trials.
B. Additional Experiments
B.1. Experimental Details
All experiments are implemented in Python. For the synthetic experiments, we consider feature dimensions and routing actions. Unless otherwise stated, we use rounds, , , and initialize the model parameters and covariance matrix as specified in the algorithm. Results are averaged over multiple independent runs, with confidence intervals computed across runs.
For our experiments, for , we fix , for and further scale them with respect to for other values of . Similarly, in the experiments we multiply the theoretical confidence radius by 0.005 as an empirical calibration. This calibrated radius is used only for the experiments. We report their constraint-satisfaction performance empirically.
All experiments were conducted on a CPU-based machine equipped with an Intel Core i5-14600KF processor and 32 GB of RAM. The total runtime for all experiments was approximately six hours.
For the real-LLM experiments, we use 100 queries from WildBench v2 and five LLMs as the available routing actions. The LLMs are mentioned as follows:
-
nemotron-3-super-120b-a12b (NVIDIA, 2025)
-
deepseek-v4-flash (DeepSeek-AI, 2026)
-
qwen3.6-35b-a3b (Qwen Team, 2026a)
-
gemma-4-31b-it (Team, 2026)
-
qwen3.8-27b (Qwen Team, 2026b)
Each response is evaluated by an independent lightweight judge model (muse-glimmer-30b (Labs, 2026)) using six quality dimensions: correctness, relevance, completeness, clarity, conciseness, and safety. The resulting quality scores are used to compute the satisfaction outcome and routing cost. All methods use the same queries, models, costs, and evaluation procedure to ensure a fair comparison. The code for all the experiments can be found at https://github.com/ameyanjarlekar/LLM-Routing, and the models are hosted at https://lumen.ncsa.illinois.edu/.
B.2. Sensitivity to the Satisfaction Tolerance
We study how the routing performance changes with the satisfaction tolerance . A smaller imposes a stricter satisfaction requirement, while a larger allows greater flexibility in model selection. We vary over a range of values and evaluate the resulting routing cost, satisfaction, and chance-constraint probability.
B.3. Confidence Width Calibration
We evaluate the tightness of the theoretical confidence width for the predicted satisfaction probabilities. At , the raw theoretical width is highly conservative in our evaluated data. We also evaluate a calibrated width obtained by applying a fixed scaling factor of 0.005. The calibrated width covers 83.4% of the observed errors in this experiment, which justifies our choice of multiplying the theoretical confidence radius by 0.005.
B.4. Quality-Constraint Satisfaction
We next evaluate the reliability of constraint satisfaction across independent trials. For each independent trial, we run the algorithm for rounds and record whether the realized average satisfaction meets the target . We repeat this procedure over 5000 independent trials and report the empirical constraint-satisfaction frequency with 95% confidence intervals. Figure 8 compares this empirical frequency with the target