Optimizing Model Selection for Compound AI Systems

Lingjiao Chen, Jared Quincy Davis, Boris Hanin, Peter Bailis, Matei Zaharia +2 more
2/20/2025
cs.AIcs.CLcs.LG

No official code found. Best implementation: LLMSELECTOR/LLMSELECTOR (81 stars, Apache-2.0, last commit 2025-09-30).

Abstract

Compound AI systems that combine multiple LLM calls, such as self-refine and multi-agent-debate, achieve strong performance on many AI tasks. We address a core question in optimizing compound systems: for each LLM call or module in the system, how should one decide which LLM to use? We show that these LLM choices have a large effect on quality, but the search space is exponential. We propose LLMSelector, an efficient framework for model selection in compound systems, which leverages two key empirical insights: (i) end-to-end performance is often monotonic in how well each module performs, with all other modules held fixed, and (ii) per-module performance can be estimated accurately by an LLM. Building upon these insights, LLMSelector iteratively selects one module and allocates to it the model with the highest module-wise performance, as estimated by an LLM, until no further gain is possible. LLMSelector is applicable to any compound system with a bounded number of modules, and its number of API calls scales linearly with the number of modules, achieving high-quality model allocation both empirically and theoretically. Experiments with popular compound systems such as multi-agent debate and self-refine using LLMs such as GPT-4o, Claude 3.5 Sonnet and Gemini 1.5 show that LLMSelector confers 5%-70% accuracy gains compared to using the same LLM for all modules.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
8122Python, Jupyter NotebookFeb 13, 20251 years agoApache-2.0

Similar Papers

Cite this paper

@article{chen2025optimizing,
  title  = {Optimizing Model Selection for Compound AI Systems},
  author = {Lingjiao Chen and Jared Quincy Davis and Boris Hanin and Peter Bailis and Matei Zaharia and James Zou and Ion Stoica},
  year   = {2025},
  eprint = {2502.14815},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.14815v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.14815.svg)](https://codeofpaper.com/paper/2502.14815)

Discussion