Cost-Effective Online Multi-LLM Selection with Versatile Reward Models

Xiangxiang Dai, Jin Li, Xutong Liu, Anqi Yu, John C.s. Lui · Submission to ICLR 2025 · Rejected

TL;DR

C2MAB-V is an online combinatorial multi-armed bandit framework designed to dynamically select and coordinate cost-effective teams of Large Language Models (LLMs) under long-term budget constraints. By splitting decision-making into a continuous relaxation on local servers and dependent discretization rounding on a central scheduling cloud, it adapts to diverse multi-agent collaborative workflows while achieving sublinear regret and asymptotically zero constraint violations.

What Problem Does This Paper Address?

State-of-the-art LLMs (like GPT-4) offer high accuracy but carry steep inference bills, while cheaper models often suffice for simpler queries. In real-world enterprise deployments, applications rarely rely on a single static LLM; instead, they route queries across multiple models or coordinate multi-LLM teams (e.g., cascades, subject-matter specialists, or multi-agent pipelines).

Existing model-selection strategies suffer from three major shortcomings:

  1. Static, offline routing: Offline routing fails to handle generation diversity (cheap models occasionally outperforming large ones) and data drift over time.
  2. Ignoring stochastic costs: Real-world API usage depends on input/output token lengths that vary stochastically per query, making hard budget enforcement difficult.
  3. Rigid task formulations: Prior routing frameworks mostly consider single-model routing, failing to model different collaborative task structures where rewards interact non-linearly.

Combinatorial selection under unknown stochastic costs and non-linear rewards is an NP-hard problem.

Methods

The authors introduce C2MAB-V (Cost-effective Combinatorial Multi-armed Bandit with Versatile reward models), structured around a two-tiered local-cloud architecture:

  • Versatile Task Reward Models:
  • Any Win Combination (AWC): $r(S; \mu) = 1 - \prod_{k \in S} (1 - \mu_k)$. Used in cascading fallbacks where a query succeeds if any selected LLM provides a satisfactory answer.
  • Sum Up Combination (SUC): $r(S; \mu) = \sum_{k \in S} \mu_k$. Models parallel domain experts independently solving sub-problems.
  • All In Combination (AIC): $r(S; \mu) = \prod_{k \in S} \mu_k$. Fits multi-step dependency pipelines where failure of any sub-module ruins the entire output.
  • Optimistic Reward / Pessimistic Cost Bounds: Uses Upper Confidence Bounds (UCB) on unknown LLM performance means $\mu_k$ to encourage exploration, paired with Lower Confidence Bounds (pessimistic estimation) on token costs $c_k$ to prevent budget overruns.
  • Relaxation and Discretization Rounding:
  • The local server relaxes the combinatorial integer problem into continuous linear or multilinear programs, keeping sensitive query data private.
  • The central scheduling cloud runs randomized dependent rounding algorithms (tailored for matroid and knapsack constraints) to convert continuous solutions back into discrete LLM subsets $S_t$.
  • Partial Feedback Updates: Updates empirical reward and cost statistics only for the subset of models $F_t \subseteq S_t$ actually invoked during task execution.

Datasets

  • Primary Evaluation: SciQ (science exam questions across physics, chemistry, biology, and geography).
  • Additional Benchmarks: PIQA (physical commonsense reasoning), OpenBookQA (multi-step open-book question answering), and MMLU (57-domain multitask test).
  • Models Evaluated: Nine commercial and open-source models: ChatGPT-4, ChatGPT-3.5, Claude 2, ERNIE 3.5, Mixtral-8x7B, Llama 2 (7B, 13B, 70B), and ChatGLM2-6B.

Key Insights and Ideas

  • Asymmetric Confidence Bounds Balance the Budget: Pairing an optimistic reward UCB with a pessimistic cost lower-bound guarantees exploration of high-potential models without breaching long-term cumulative budgets $\rho$.
  • Martingale Bounds for Stochastic Constraints: Using Azuma-Hoeffding inequalities over constructed martingale difference sequences, the authors prove that cumulative cost violations scale as $\tilde{O}(\sqrt{KT})$, meaning per-round violation decays as $\tilde{O}(\sqrt{K/T}) \to 0$ as $T \to \infty$.
  • Convexity via Multilinear Extensions: For non-linear combinatorial objectives (like submodular AWC and logarithmic AIC), continuous relaxations preserve convexity, enabling the local server to solve them in polynomial time before cloud-side dependent rounding.

Key Results

  • Reward-to-Violation Dominance: Across AWC, SUC, and AIC tasks on SciQ, C2MAB-V achieved the highest reward-to-violation ratio, outperforming $\epsilon$-Greedy by at least 64.72%, Thompson Sampling by $3.9\times$, standard CUCB by $4\times$, and an "always GPT-4" policy by $6\times$.
  • Fast Convergence: C2MAB-V converged in fewer than 1,000 rounds, whereas $\epsilon$-Greedy required nearly 10,000 rounds.
  • Runtime Efficiency: Compared to directly solving the integer program (C2MAB-V-Direct), C2MAB-V's relaxation-and-rounding strategy ran over $6\times$ to $60\times$ faster (e.g., 267s vs. 16,890s on SUC).
  • Cross-Dataset Generalization: On MMLU, PIQA, and OpenBookQA, C2MAB-V consistently produced minimal budget violations (0.009–0.014) while maintaining near-ceiling accuracy ($>0.99$ reward in AWC).

Limitations and Future Work

  • Context-Free Arms: The base algorithm formulates LLM selection as a multi-armed bandit rather than a contextual bandit, meaning it does not condition selection on prompt embeddings or query difficulty representations.
  • Synchronous Communication: Although batched asynchronous updates were evaluated experimentally with minor performance drops, theoretical guarantees assume synchronous rounds between the local server and scheduling cloud.
  • Multi-Server Coordination: The formulation assumes a one-to-one local-server-to-cloud relationship; distributed multi-server coordination remains an open area for future investigation.

Summary updated

BibTeX
@misc{dai2024cost,
  author = {Xiangxiang Dai and Jin Li and Xutong Liu and Anqi Yu and John C.S. Lui},
  title = {{Cost-Effective Online Multi-LLM Selection with Versatile Reward Models}},
  year = {2024},
  eprint = {2405.16587},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.16587},
}
Figure