Abstract
With the rapid advancement of large language models (LLMs), the diversity of multi-LLM tasks and the variability in their pricing structures have become increasingly important, as costs can vary greatly between different LLMs. To tackle these challenges, we introduce the C2MAB-V, a Cost-effective Combinatorial Multi-armed Bandit with Versatile reward models for optimal LLM selection and usage. This online model differs from traditional static approaches or those reliant on a single LLM without cost consideration. With multiple LLMs deployed on a scheduling cloud and a local server dedicated to handling user queries, C2MAB-V facilitates the selection of multiple LLMs over a combinatorial search space, specifically tailored for various collaborative task types with different reward models. Based on our designed online feedback mechanism and confidence bound technique, C2MAB-V can effectively address the multi-LLM selection challenge by managing the exploration-exploitation trade-off across different models, while also balancing cost and reward for diverse tasks.
Introduction: The LLM Selection Challenge
The current AI landscape offers an "LLM buffet," ranging from high-performance models like GPT-4 to lightweight open-source alternatives. However, this variety introduces two significant challenges:
- The Cost-Performance Trade-off: High-performance models are prohibitively expensive for simple queries, while cheap models often sacrifice quality.
- Static vs. Dynamic Environments: Model performance is not static; it can drift over time. Most existing selection methods fail to learn from ongoing user interactions or account for collaborative tasks requiring multiple models.
To address these, we propose an online multi-LLM selection framework that automatically identifies the most cost-effective subset of models for a task while strictly adhering to a budget.
The C2MAB-V Framework
The C2MAB-V (Cost-effective Combinatorial Multi-armed Bandit with Versatile reward models) framework treats model selection as an online learning problem. Unlike single-model selectors, it selects a combination of models to optimize performance.
Versatile Reward Models
The framework supports three distinct reward structures to accommodate different collaboration styles:
- Any Win (AWC): Success if at least one model in the set provides a correct answer (ideal for cascading).
- Sum Up (SUC): Total reward is the sum of individual successes (ideal for parallel, domain-specific tasks).
- All In (AIC): Success only if every model in the set succeeds (ideal for complex multi-module projects).
Optimization via Relaxation
Selecting the optimal subset of models is an NP-hard integer linear programming problem. C2MAB-V addresses this by decomposing the problem into a relaxed continuous form handled by the local server, followed by a discretization rounding scheme on the scheduling cloud to provide optimal model combinations.
Experimental Evaluation
The framework was evaluated using the SciQ dataset (13,669 science questions) and various mathematics benchmarks. The LLM pool included nine models, such as GPT-4, ChatGPT-3.5, Claude 2, and various Llama 2 configurations.
Key Results
- Superior Efficiency: C2MAB-V consistently outperformed standard benchmarks like $\epsilon$-Greedy and Thompson Sampling, improving the reward-to-violation ratio by over 64% in certain scenarios.
- Fast Convergence: The algorithm typically identifies the optimal model team in fewer than 1,000 rounds.
- Computational Speedup: The relaxation-based method is at least 6x faster than direct discrete selection.
Insights and Discussion
A primary insight from this work is the effectiveness of the "cascade" strategy. By attempting a task with a cheaper model first and only escalating to more expensive models if necessary, the system can achieve higher accuracy at a significantly lower cost.
Limitations and Future Work
While C2MAB-V is robust, it currently lacks "contextual" awareness (e.g., identifying a query as a physics problem to prioritize specific models). Future work will explore Contextual Combinatorial Bandits and methods to reduce asynchronous latency in cascading architectures.
Summary updated