Manuscript Offprint
arXiv:2609.00662Drift-Aware LLM Routing with Sparse Contexts and Shared Budgets
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
A multi-model language service must route each request while preserving workload-level budgets for compute, latency, memory, or monetary cost. Two features make this problem materially harder than static model selection. Prompt representations are high dimensional, so only a small subset of embedding directions may predict the incremental value of a model; and both the request mix and the model frontier drift after launches, fine-tunes, quantization changes, and system updates. We formulate nonstationary sparse contextual routing with multiple knapsack constraints and an optional shadow-audit stream that evaluates a small fraction of prompts on several models.
We propose Drift-Aware Sparse Routing (DR-SPARSE). The policy estimates reward and resource use from a rolling audit window, routes using pessimistic reward and optimistic cost estimates, updates resource shadow prices online, and applies a hard meter before commitment. The analysis separates control from statistics. On any event with uniform prediction radii , regret against a paced dynamic fluid benchmark is bounded by the sum of the radii, a capacity-buffer term, and an pacing term. Under a sparse linear model and bounded drift , rolling estimation gives
where is sparsity, is the audit rate, and is the window length. Optimizing yields the usual stationary rate when and a adaptation term under drift.
A reproducible synthetic study with four model classes, two shared budgets, 28-dimensional contexts, and two model updates illustrates the mechanism. Rolling sparse routing retains roughly 97–98% of the clairvoyant policy's utility and improves on a frozen router after the change points, while the resource meter remains feasible. The paper closes with a measurement protocol for real routing panels and a discussion of selective auditing, change detection, and integration with inference schedulers.
1 Introduction
Large language model services increasingly expose a portfolio rather than a single model. A request may be handled by a small local model, a medium generalist, a frontier model, a code specialist, a retrieval pipeline, or a deterministic tool. Routing can substantially reduce cost, but it is not a sequence of independent classifications. The service has shared limits on GPU time, tokens, tail-latency capacity, cache memory, and external API spend. Using the strongest model on one request changes the set of feasible decisions later in the workload.
Production routing is also nonstationary. The prompt mix changes by hour, product surface, customer cohort, and release cycle. A model update can improve coding while worsening verbosity, quantization can change latency without changing benchmark accuracy, and a new retrieval index can alter the relative value of a tool call. A router trained on a dense historical panel may therefore be accurate in an average offline sense while pacing scarce capacity toward the wrong requests after a change.
The statistical difficulty is amplified by representation dimension. Routers commonly use prompt embeddings, predicted length, task labels, user features, and model metadata. The raw feature dimension can be large even when the incremental benefit of a particular model depends on a small number of directions. A dense estimator fitted to a short recent window has high variance; a sparse estimator using the full history has low variance but can average across obsolete regimes. The operational question is therefore not only which model to choose, but how much history to use, which coordinates to trust, and how rapidly the resource prices should react.
This paper develops a modular answer. We formulate a contextual online allocation problem in which expected answer utility and resource use are sparse functions of context and can drift over time. A shadow-audit process reveals counterfactual outcomes on a small fraction of prompts. Such audits may be generated by replaying prompts across approved models, by human or verifier scoring, or by delayed batch evaluation. They need not cover every request, but they provide the common-support data required to distinguish a bad routing decision from a model-quality change.
Our policy, DR-SPARSE, has four components. First, it fits rolling sparse predictors for utility and each resource. Second, it converts statistical uncertainty into a lower confidence estimate of utility and an upper confidence estimate of consumption. Third, it selects the action with the highest uncertainty-adjusted surplus after subtracting current shadow prices. Fourth, it meters the realized action against remaining capacity. This architecture separates the semantic predictor from the online control layer and makes the effect of drift explicit.
A drift-aware router with auditable modules. DR-SPARSE uses a rolling window, hard-thresholded regression, uncertainty-adjusted surplus, queue-like shadow-price updates, and a hard meter. The estimator can be replaced by a sparse generalized linear model or a neural uncertainty model without changing the control proof. The shadow-audit rate appears explicitly in the statistical term.
A confidence-to-regret theorem. The main theorem assumes only simultaneous prediction radii. It bounds regret by , the value loss from a capacity buffer, and a pacing term. A sparse-window corollary then shows how the statistical error and drift bias trade off. The result makes window choice interpretable: short windows track model changes but require more audits; long windows reduce variance but retain obsolete data.
An executable experimental design. The attached simulator creates three request regimes and two model updates. It compares rolling sparse, rolling dense, full-history sparse, frozen sparse, and clairvoyant policies under identical audit traces and two hard budgets. The outputs include all repetition-level data, figures, and the exact table used in the paper.
2 Related Work
2.1 LLM routing and serving
FrugalGPT develops cost-aware cascades and prompt-level selection across language-model APIs [Chen et al., 2023]. RouteLLM learns routing preferences from pairwise data [Ong et al., 2024], while RouterBench provides a panel-style evaluation environment for multi-model routers [Hu et al., 2024]. A unified treatment of routing and cascading emphasizes that the two are different uses of a quality estimator [Dekoninck et al., 2024]. These works establish the cost-quality opportunity. Our focus is the workload-level control problem when the query mix and model frontier change and multiple resource budgets must remain feasible.
At a lower systems layer, vLLM and PagedAttention demonstrate that memory management and batching shape attainable throughput [Kwon et al., 2023]. We treat the scheduler's predicted compute, latency, and cache footprint as resource coordinates. The router can therefore respond to congestion through shadow prices without embedding a full queueing model in the semantic predictor.
2.2 Contextual learning with resource constraints
Bandits with knapsacks add cumulative resource constraints to sequential learning [Badanidiyuru et al., 2013]; contextual extensions let observed request features determine action values [Agrawal et al., 2016]. Dual mirror descent gives a broad framework for online allocation across stochastic and adversarial regimes [Balseiro et al., 2023]. High-dimensional contextual decision making requires regularization and sufficient covariate diversity [Bastani and Bayati, 2020, Hastie et al., 2015]. The sparse constrained methodology of Ma et al. [2024] is closest statistically. Our audit model gives a practical source of multi-action labels, while our theorem treats the resulting confidence sequence as an input rather than tying the controller to one estimator.
2.3 Nonstationarity
Variation-budget models quantify the cost of tracking changing rewards [Besbes et al., 2015], and restarting or sliding-window algorithms are standard tools in nonstationary contextual bandits [Luo et al., 2018]. Resource constraints introduce a second channel: the same local quality change can have a large or small global impact depending on which resource is scarce. This interaction motivates the global measures in Liu et al. [2022]. Distributional metrics offer a complementary view; Jiang et al. [2020] measures both prior error and temporal drift with Wasserstein distance. We use a simpler sup-norm path variation in the main theorem because it produces a direct window-bias bound, and discuss Wasserstein calibration in Section 8.
3 Model
3.1 Requests, actions, and resources
Time is indexed by . Before acting, the service observes a context with . The action set is . Action 0 is a fallback that gives zero reward and consumes no scarce resource; it may represent abstention, a cached response, or a deferred batch. Other actions correspond to models, tools, or model-tool pipelines.
After choosing , the service obtains reward and consumes . Let
The conditional distribution may change with . The total capacity is for . A policy is hard feasible when
The hard meter in Algorithm 1 enforces this definition even on low-probability paths.
3.2 Shadow-audit feedback
Ordinary routing feedback reveals only the outcome of the selected action. We additionally allow an audit indicator , independent conditional on the past, with . When , the service obtains an unbiased outcome vector for every approved action. An audit may be simultaneous shadow inference, delayed replay, a human comparison, or a trusted evaluator. Its engineering cost is not assumed zero; in practice it can be charged to a separate experimentation budget. We omit that budget from the notation to keep the routing theorem readable.
The audit assumption is not essential to the control result. It is used only in the sparse estimation corollary. Under ordinary bandit feedback, inverse-propensity or doubly robust estimators can provide the same confidence interface, with a larger radius.
3.3 Sparse time-varying outcome model
Let be a joint representation with . For each action and output coordinate, suppose
Each parameter has at most nonzero coordinates. The clipping is convenient rather than essential; generalized linear models can replace it.
Define the one-step drift
and the path variation . This measure captures both model changes and changes in the mapping from context to resource use. Distribution shift in can be incorporated by replacing the supremum with a metric between joint outcome distributions; see Section 8.
3.4 Paced dynamic fluid benchmark
For a realized context and resource rate , define
The benchmark is
It knows the current outcome model and may randomize between an expensive action and the fallback, but it cannot borrow arbitrarily from distant periods. This paced benchmark is appropriate when the system has a stable service-rate target and when congestion makes early budget exhaustion undesirable. It is no larger than the fully anticipatory fluid benchmark with only an aggregate constraint, so guarantees against it should not be interpreted as guarantees against an unrestricted prophet.
Let be an optimal dual vector for (3). We use a standard sensitivity condition.
Assumption 1 (Bounded benchmark prices). There is such that an optimal dual solution satisfies almost surely for every on the line segment between and the buffered rate used by the algorithm.
This assumption is a local Lipschitz condition for the fluid value. It holds, for example, when a strictly feasible fallback exists and the relevant capacity rates remain away from zero.
4 Drift-Aware Sparse Routing
4.1 Rolling estimation
At update time , the estimator uses audited samples from
For each action, it fits reward and resource regressions and hard-thresholds the slope vector to its largest coordinates. Let and denote the predictions. The controller receives a simultaneous radius satisfying
for every on a high-probability event .
In a production implementation, can combine sampling uncertainty, auditor disagreement, model-version uncertainty, and an explicit drift allowance. Newly deployed models should receive larger radii until enough shadow data arrive.
4.2 Uncertainty-adjusted surplus
Let be the current vector of internal resource prices. Define the lower reward and upper consumption
The routing score is
The fallback has score zero. The controller selects a maximizer when its score is positive and otherwise falls back.
This score is deliberately asymmetric. Optimism in reward can overspend on an uncertain model; pessimism in cost can exhaust capacity before the drift is detected. Lower reward and upper consumption cause uncertain actions to earn their way into the routing mix through audits.
4.3 Price update and buffer
The price update uses the planned upper consumption:
Algorithm 1 Drift-Aware Sparse Routing (DR-SPARSE)
Require: Window , update interval , audit stream , step size , capacity , buffer .
1: Initialize , remaining capacity , and conservative outcome priors.
2: for do
3: if is an update time then
4: Fit sparse reward and resource models on ; construct .
5: end if
6: Observe and compute scores (5).
7: Rank actions by score, appending the fallback.
8: Choose the highest-ranked action whose reservation envelope fits .
9: Execute it, observe , and set .
10: Update by (6).
11: if then
12: Store audited outcomes for all approved actions.
13: end if
14: end for
where and denotes componentwise projection onto the nonnegative orthant. The scalar buffer covers both the virtual queue carried by the price update and random deviations of realized consumption from its conditional mean.
Immediately before commitment, the hard meter checks whether the action's reservation envelope fits remaining capacity. If not, the policy selects the best feasible lower-cost action or the fallback. The theorem below gives conditions under which this correction is inactive with high probability; hard feasibility holds without those conditions.
5 Performance Guarantees
5.1 Regularity assumptions
The first assumption bounds the virtual queue induced by (6).
Assumption 2 (Consumption granularity). There is such that for every resource , action , and context , either and almost surely, or . The confidence radii satisfy .
The granularity condition can be enforced by choosing resource units at the service-class level. It is not needed for hard feasibility, but it gives a simple deterministic price bound. A more general analysis can use Slater drift arguments from stochastic network optimization [Neely, 2010].
Define
Because the fallback score is zero, no action with positive consumption in resource is selected once is above the first term, up to a single update overshoot.
Lemma 1 (Price bound). Under Assumption 2, the virtual prices generated by (6) satisfy for all and on the confidence event .
5.2 A confidence-to-control theorem
Let denote the action selected before the hard meter. The next theorem compares the virtual policy to the paced benchmark and then controls meter activation.
Theorem 1 (Regret and feasibility from prediction radii). Suppose Assumptions 1 and 2 hold, rewards and consumptions lie in [0,1], and (4) holds with probability at least . Set and
If , then:
(i) the metered policy is hard feasible on every sample path;
(ii) with probability at least , the meter never changes the virtual action sequence; and
(iii) its expected paced regret satisfies
(8)
The three terms have distinct meanings. The first is statistical and includes drift bias. The second is the value of capacity reserved for feasibility. The third is the pacing loss from online price updates. With and , the nonstatistical terms are .
Remark 1 (Why the benchmark is paced). The proof uses a feasible mixed action for each current context and rate . A fully anticipatory benchmark can intentionally overspend in one regime and compensate in another, which requires additional assumptions on how future drift is predicted. The paced benchmark isolates whether the router chooses the right model at the current scarcity level. Epoch-level borrowing can be added by re-solving with remaining capacity; see Section 8.
5.3 Sparse rolling-window estimation
We next translate the abstract radii into a rate. Let . Assume the audited design in each sufficiently long window satisfies a restricted eigenvalue condition with constant , and the reward and resource noises are conditionally sub-Gaussian with scale .
Proposition 1 (Window confidence radius). There is a constant depending only on such that, with probability at least , hard-thresholded regularized least squares can be tuned so that for all ,
For the first W periods, one may use the trivial radius 1 or a historical prior.
The first term is sampling error; the second is the bias from fitting a single parameter to a drifting window. Summing the drift terms counts each one-step change at most W times.
Corollary 1 (Drift-adaptive regret). Under the assumptions of Theorem 1 and Proposition 1, and suppressing logarithmic and fixed regularity factors,
When , gives . When and the warm-start term is lower order, choosing
yields an adaptation term .
5.4 Interpretation
The bound identifies three operational levers. Increasing the audit rate reduces variance but consumes evaluation capacity. Increasing also reduces variance, but a model update contaminates the estimator for approximately requests. Sparsity is valuable precisely when recent data are scarce: a dense estimator pays for all coordinates every time the window is shortened.
The theorem does not claim that hard thresholding is universally optimal. If a learned embedding is dense but low rank, a factor model may be better. If drift is concentrated in a small subset of actions, action-specific windows can improve the rate. The confidence-to-control theorem remains unchanged as long as the resulting radii are valid.
6 Synthetic Experiments
6.1 Environment
The simulator contains requests, four nonfallback model classes, two resources, and 28-dimensional contexts. Seven coordinates determine expected utility. Requests belong to three latent task types whose mixture changes after requests 1,600 and 3,200. At the same change points, the inexpensive models and the specialist receive different quality updates, while the expensive generalist remains comparatively stable. Compute and latency depend on model identity and a context coordinate that proxies expected generation length.
An audit is available with probability and is forced during a common 400-request warm start. Audits reveal noisy outcomes for all actions and are identical across policies. The total compute and latency capacities correspond to per-request rates 0.31 and 0.35. All policies use the same queue update and hard meter; they differ only in the prediction model and data window.
6.2 Policies
Clairvoyant dynamic. Uses the true current reward and consumption means with the same price update. It is a strong score-based reference, not the exact dynamic program.
Rolling sparse. The proposed implementation. It refits every 200 requests on the most recent 700 requests and hard-thresholds each regression to seven coordinates.
Rolling dense. Uses the same window but retains all coordinates.
Full-history sparse. Uses sparse regression on every audited request observed so far. It has lower sampling variance but retains obsolete regimes.
Static sparse. Fits once after the warm start and never updates.
Each reported point averages independent workload and outcome draws. The script exports the raw trajectories, aggregate table, and window sweep.
Table 1: Synthetic nonstationary routing results. Intervals are 95% normal intervals across repetitions. Utilization is relative to hard capacity. “Abstained” includes fallback decisions; meter rejections are reported separately.
| Policy | Total utility | % clairvoyant | Compute util. | Latency util. | Abstained |
|---|---|---|---|---|---|
| Clairvoyant dynamic | 100.0% | 98.3% | 88.3% | 0 | |
| Rolling sparse | 97.6% | 98.4% | 88.3% | 0 | |
| Rolling dense | 97.4% | 98.4% | 88.3% | 0 | |
| Full-history sparse | 97.6% | 98.4% | 88.8% | 0 | |
| Static sparse | 96.9% | 98.4% | 89.3% | 0 |

Figure 1: Mean cumulative utility. Dashed vertical lines mark the two changes in task mix and model quality.
6.3 Results
Figure 1 shows cumulative utility. All learned policies share the same warm start. The frozen router begins to separate after the first update and loses additional utility after the second. Rolling sparse recovers more rapidly because it discards obsolete labels while controlling the variance introduced by the 28-dimensional context. Full-history sparse is competitive in the first transition but reacts more slowly once two regimes are mixed in its training set.
The local view in Figure 2 makes the adaptation delay visible. Rolling dense uses the same recent data but pays additional variance for irrelevant coordinates. This difference is modest in the present dimension and would be expected to grow with representation size or a lower audit rate.
Figure 3 shows compute pacing. The virtual prices keep average consumption close to the pro-rata path, and the hard meter records no capacity violation. A policy can still use the wrong actions while consuming the correct amount of compute; this is why budget utilization alone is not a quality metric.
Finally, Figure 4 sweeps the rolling window. Very short windows are noisy, while very long windows combine incompatible regimes. The broad optimum around the intermediate windows illustrates the statistical-drift tradeoff in (10); it should not be read as a universal tuning recommendation.

Figure 2: Mean utility per request in 150-request blocks. Rolling policies respond to the two changes; the frozen policy continues to route using first-regime relationships.
6.4 What the experiment establishes
The simulation verifies the implementation logic and produces the qualitative behavior predicted by the bound: recent sparse data are useful when relationships change, and resource pacing is distinct from model-quality adaptation. It does not establish the magnitude of gains for real LLMs. The outcome model is linear after clipping, audits are unbiased, and the change points are abrupt. Real systems may have gradual drift, strategic traffic, correlated evaluator error, and queue-dependent latency.
7 Real-Data Evaluation Protocol
A credible empirical paper would require a panel that jointly measures quality and resources across models. We propose the following design.
7.1 Construct a time-indexed query-model panel
Collect prompts from several product surfaces or public task suites over multiple periods. Preserve timestamps, task metadata, prompt and response length, and an embedding computed by a frozen encoder. Run each audited prompt on all approved models with fixed decoding settings. Record generated tokens, wall-clock latency, accelerator seconds when available, and cache footprint or a calibrated proxy.
Quality should be application specific. For coding, use tests and human review of failures. For extraction, use exact or structured metrics. For open-ended tasks, combine blinded pairwise judgments, a validated judge model, factuality checks, and safety flags. A single scalar utility can be used for the routing algorithm, but the paper should report the underlying dimensions separately.

Figure 3: Mean cumulative compute use. The dashed line is the pro-rata capacity path.
7.2 Create realistic drift
Natural drift can be studied across product releases or time periods. Controlled drift is also valuable: update one model, change quantization, alter retrieval, shift the task mix, or change the price of an external API while keeping the evaluation protocol fixed. The study should distinguish covariate shift in prompts from conditional shift in model performance. A frozen model can face the first; a deployment update creates the second.
7.3 Simulate online audits
Subsample the full panel to create audit rates from 1% to 30%. Outside the audit set, reveal only the selected model's outcome. Compare shadow-audit regression, inverse-propensity estimators, and doubly robust estimators. Report how much additional model inference is required to recover each percentage point of routing utility.
7.4 Workload replay
Replay requests in timestamp order under fixed hard budgets. Strong baselines should include the best single model, a static preference router, a cost-threshold cascade, a dense rolling router, and a periodically retrained router without dual pacing. Report cumulative utility, utility by task, resource utilization, meter activations, adaptation delay after each change, and worst-group quality.
7.5 Prospective deployment
A safe online test can begin with low audit rates and conservative uncertainty penalties. Shadow prices and recommended actions should be logged before commitment. Guardrails should prevent the router from sending high-risk requests to an unvalidated model even when its predicted utility is high. The primary endpoint should be workload-level utility under a fixed capacity envelope, not only per-request win rate.

Figure 4: Total utility as a function of the rolling estimation window. Error bars are 95% normal intervals across independent repetitions.
8 Extensions
8.1 Adaptive window selection
The optimal depends on unknown drift. A practical controller can maintain several estimators with geometric windows and aggregate them using a change detector or an expert algorithm. Residual tests should be action specific: a specialist update should not force the generalist's estimator to forget stable data. The challenge is to preserve confidence validity after data-dependent window selection.
8.2 Wasserstein drift
Sup-norm path variation is conservative for high-dimensional prompts. A distributional alternative measures the distance between consecutive joint laws of context, reward, and consumption. If the routed surplus is Lipschitz in that metric, a Wasserstein radius can be converted into a value-error term. This gives a direct way to calibrate robustness from held-out forecast error and is aligned with distributional nonstationarity in constrained stochastic optimization.
8.3 Aggregate rather than paced capacity
Some services can borrow capacity across periods. Divide time into epochs, allocate each epoch its remaining capacity divided by remaining time, and run DR-SPARSE within the epoch. Re-solving lets the router exploit underuse from earlier regimes. Analysis against an aggregate dynamic benchmark requires controlling the variation of optimal dual prices or assuming advance information about the change process.
8.4 Ordinary bandit feedback
Without shadow audits, selected-model outcomes are confounded with the routing policy. Forced exploration, randomized traffic splits, and doubly robust estimation can replace full-panel observations.
The audit rate is then an effective minimum propensity. Safety constraints may restrict exploration for high-stakes tasks, making offline coverage and conservative fallback essential.
8.5 Scheduler feedback
The consumption predictor can include current queue length, batch composition, or cache pressure. This makes endogenous to system state rather than purely exogenous drift. A two-timescale design can let the serving scheduler expose congestion prices while the router adapts model-quality estimates more slowly. Stability becomes a key issue: both layers should not overreact to the same short-lived latency spike.
9 Conclusion
LLM routing under shared budgets is not stationary classification. A useful router must learn which context coordinates predict incremental model value, forget data that no longer describe the deployed frontier, and pace several scarce resources over the workload. DR-SARSE combines rolling sparse estimation, uncertainty-adjusted surplus, online shadow prices, and a hard meter. The analysis makes the statistical-control interface explicit: any valid confidence sequence yields a regret bound, and sparse rolling windows translate drift and audit rates into an interpretable adaptation term.
The main empirical opportunity is to measure this tradeoff on versioned multi-model panels. Such a study would reveal how quickly routers should forget, how much shadow evaluation is worth buying after a model update, and whether the operational value of sparse representations persists at production scale.
A Proofs
A.1 Proof of the price-bound lemma
Fix resource . On , if an action has positive true expected consumption in coordinate , then
More conservatively, if the upper estimate is formed before clipping and the prediction error is used explicitly, its positive component is at least . The lower reward is at most one. Hence whenever
any action with positive consumption in resource has score strictly below the score of an otherwise identical zero-consumption fallback; in particular, a maximizer with positive -consumption cannot be selected unless another coordinate makes the comparison tie through clipping. Defining the action set at the service-class level and breaking ties toward lower consumption removes this case. The selected upper consumption in coordinate is then zero, so (6) weakly decreases . From a value below the threshold, one update can increase the coordinate by at most because all normalized consumptions and rates lie in . This proves the stated bound.
A.2 Approximate surplus maximization
Lemma 2. On , the virtual action satisfies
(11)
Proof. For every action,
The reverse difference is at most up to clipping, which can only reduce the deviation. Because maximizes the lower score, compare its lower score to that of a true-surplus maximizer and apply the error bound once to each action. The common term gives (11).
A.3 Proof of the main theorem
Hard feasibility follows directly from the meter: an action is committed only when its reservation envelope fits remaining capacity, and the fallback consumes zero.
We first analyze the virtual action sequence. Let solve (3) at rate . By Lemma 2 and linearity in a randomized action,
(12)
The last inequality uses feasibility of and nonnegativity of .
Rearranging and summing gives
(13)
On , componentwise. Projection in (6) implies
Therefore
The sum telescopes from , yielding at most in (13).
By LP sensitivity under Assumption 1,
Summing establishes (8) for the virtual policy on , up to the failure contribution .
It remains to show that the meter is inactive with high probability. The queue recursion and Lemma 1 imply, for each coordinate,
On , the true conditional mean is no larger than the upper estimate. The martingale differences lie in . Hoeffding-Azuma and a union bound over resources give, with probability at least ,
by (7). Thus the virtual path fits capacity, and the meter does not alter it. Combining the confidence and martingale events and adding another contribution proves the theorem.
A.4 Proof of the rolling-window proposition
Condition on an audited window with samples satisfying the restricted eigenvalue condition. Standard high-dimensional regression bounds imply an prediction error of order
uniformly across the regressions after a union bound; see, for example, Hastie et al. [2015]. Chernoff concentration gives for all full windows with high probability after adjusting constants.
The estimator fits one parameter over the window while the current mean may differ from earlier means. For any audited time , telescoping gives
and the same bound holds for each resource coordinate. Averaging cannot increase the maximum deviation, so the misspecification bias is bounded by the sum of changes in the window. Combining statistical and drift terms and enlarging the constant to cover clipping proves (9).
A.5 Proof of the drift corollary
Use the trivial radius one during the first periods. For the remaining periods, sum (9). The statistical term contributes
Each appears in at most windows, so the drift contribution is at most . Substitute these terms into (8), set and , and suppress logarithmic and fixed regularity factors. Optimization of gives the stated window and rate.
B Additional Experimental Details
B.1 Data-generating process
The first three context coordinates encode noisy task-type signals, the fourth is correlated with expected output length, and the remaining coordinates are nuisance features. Reward logits depend on seven coordinates. The task-type mixture is (0.60, 0.25, 0.15) in the first regime, (0.18, 0.62, 0.20) in the second, and (0.22, 0.18, 0.60) in the third. Model updates change both task bonuses and selected sparse coefficients.
The four model classes have baseline compute levels approximately 0.13, 0.27, 0.66, and 0.39 before a length adjustment; corresponding latency levels are approximately 0.16, 0.30, 0.59, and 0.39. Realized utility and consumption add independent bounded noise. The exact coefficients are in simulate_drift_routing.py.
B.2 Estimator and controller
The implementation uses multi-output ridge regression followed by hard thresholding to seven slopes for the sparse policies. This is computationally lighter than solving a separate lasso at every update and keeps the simulation fully reproducible. The dense baseline uses the same ridge parameter without thresholding. Prices are updated after every request with step size 0.055; this finite-sample tuning differs from the theorem's asymptotic choice.
The simulator uses a hard meter. If a sampled realized cost would exceed remaining capacity, the action is replaced by fallback and counted as a meter rejection. In the reported runs, the price controller and capacity rates make such rejections negligible or zero.
B.3 Reproducibility
Running
python simulate_drift_routing.py --out .
regenerates the CSV files, LaTeX table, and all figures. Random seeds are fixed and recorded in the script. The default run uses ten main repetitions and an additional window sweep.
C Further Modeling Variants
C.1 Model-specific audit rates
A newly launched model can receive a higher audit rate than a mature model. Replace by in the action-specific confidence radius. An audit-all policy is statistically convenient but operationally expensive; pairwise audits against the currently selected model may offer a better cost-information tradeoff.
C.2 Safety constraints
Add resources for expected safety violations, ungrounded answers, or human escalations. These are not literally consumable inventories, but cumulative limits can represent risk budgets. Hard per-request safety rules should remain outside the Lagrangian and remove inadmissible actions before scoring.
C.3 Fairness across user groups
Group-specific minimum quality or maximum expensive-model rates can be written as additional constraints. Their dual variables become internal prices. Care is needed under drift: unequal audit coverage can create apparent group differences that are estimation artifacts rather than genuine model-performance gaps.
C.4 Cascades
A cascade can be treated as an action whose expected reward and cost depend on the probability of escalation. The context can include the first model's confidence or verifier score. If the first stage is executed before the routing decision, its output becomes part of ; if the entire cascade is committed at once, it is a compound action with stochastic consumption.
References
Shipra Agrawal, Nikhil R. Devanur, and Lihong Li. An efficient algorithm for contextual bandits with knapsacks, and an extension to concave objectives. In Proceedings of the 29th Conference on Learning Theory, pages 4–18, 2016.
Ashwinkumar Badanidiyuru, Robert Kleinberg, and Aleksandrs Slivkins. Bandits with knapsacks. In Proceedings of the 54th Annual IEEE Symposium on Foundations of Computer Science, pages 207–216, 2013.
Santiago R. Balseiro, Haihao Lu, and Vahab Mirrokni. The best of many worlds: Dual mirror descent for online allocation problems. Operations Research, 71(1):101–119, 2023.
Hamsa Bastani and Mohsen Bayati. Online decision making with high-dimensional covariates. Operations Research, 68(1):276–294, 2020.
Omar Besbes, Yonatan Gur, and Assaf Zeevi. Non-stationary stochastic optimization. Operations Research, 63(5):1227–1244, 2015.
Lingjiao Chen, Matei Zaharia, and James Zou. FrugalGPT: How to use large language models while reducing cost and improving performance. arXiv preprint arXiv:2305.05176, 2023.
Jasper Dekoninck, Maximilian Baader, and Martin Vechev. A unified approach to routing and cascading for LLMs. arXiv preprint arXiv:2410.10347, 2024.
Trevor Hastie, Robert Tibshirani, and Martin Wainwright. Statistical Learning with Sparsity: The Lasso and Generalizations. CRC Press, 2015.
Qitian Jason Hu, Jacob Bieker, Xiuyu Li, Nan Jiang, Benjamin Keigwin, Gaurav Ranganath, Kurt Keutzer, and Shriyash Kaustubh Upadhyay. RouterBench: A benchmark for multi-LLM routing system. arXiv preprint arXiv:2403.12031, 2024.
Jiashuo Jiang, Xiaocheng Li, and Jiawei Zhang. Online stochastic optimization with wasserstein based non-stationarity. arXiv preprint arXiv:2012.06961, 2020.
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with PagedAttention. Proceedings of the 29th Symposium on Operating Systems Principles, pages 611–626, 2023.
Shang Liu, Jiashuo Jiang, and Xiaocheng Li. Non-stationary bandits with knapsacks. In Advances in Neural Information Processing Systems, volume 35, pages 16522–16532, 2022.
Haipeng Luo, Chen-Yu Wei, Alekh Agarwal, and John Langford. Efficient contextual bandits in non-stationary worlds. In Proceedings of the 31st Conference on Learning Theory, pages 1739–1776, 2018.
Wanteng Ma, Dong Xia, and Jiashuo Jiang. High-dimensional linear bandits with knapsacks. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 34008–34037. PMLR, 2024.
Michael J. Neely. Stochastic network optimization with application to communication and queueing systems. Synthesis Lectures on Communication Networks, 3(1):1–211, 2010.
Isaac Ong, Amjad Almahairi, Vincent Wu, Wei-Lin Chiang, Tianhao Wu, Joseph E. Gonzalez, M. Waleed Kadous, and Ion Stoica. RouteLLM: Learning to route LLMs with preference data. arXiv preprint arXiv:2406.18665, 2024.