Large Language Model Routing with Benchmark Datasets

Tal Shnitzer, Anthony Ou, Mírian Silva, Kate Soule, Yuekai Sun, Justin Solomon, Neil Thompson, Mikhail Yurochkin

Abstract

There is a rapidly growing number of open-source Large Language Models (LLMs) and benchmark datasets to compare them. While some models dominate these benchmarks, no single model typically achieves the best accuracy in all tasks and use cases. In this work, we address the challenge of selecting the best LLM out of a collection of models for new tasks. We propose a new formulation for the problem, in which benchmark datasets are repurposed to learn a "router" model for this LLM selection, and we show that this problem can be reduced to a collection of binary classification tasks. We demonstrate the utility and limitations of learning model routers from various benchmark datasets, where we consistently improve performance upon using any single model for all tasks.

Introduction

The current LLM landscape is characterized by a "winner-takes-all" race where massive models like Llama-2-70B dominate general leaderboards. However, being "best on average" does not equate to being "best on everything." A massive model might excel at general reasoning but lose to a smaller, specialized model on niche legal or medical datasets.

This paper addresses the challenge of Model Routing: given a new, unseen task, how can we predict which LLM in a collection will perform best without running inference on all of them? Unlike existing reranking solutions that require generating outputs from every candidate model, this work seeks an efficient "referee" that picks the right model based only on the user's input.

Methodology

The authors formulate routing as a supervised learning problem reduced to binary classification. The core idea is to treat existing benchmark results—which contain per-sample success and failure data—as a meta-dataset for training.

  1. Predictor Training: For every LLM in the pool, a simple binary classifier (k-Nearest Neighbors using sentence embeddings) is trained to predict: "Given this input, will this specific model get it right?"
  2. Scoring Mechanisms: Three scoring methods are proposed, most notably $S_3$, an Out-of-Distribution (OOD) aware score. $S_3$ uses a dataset distance metric and kernel smoothing to estimate the reliability of the classifier's prediction when the input is far from the training benchmarks.
  3. Inference Efficiency: The router maintains a Model Calls Per Instance (MCPI) near 1, calling only the embedding model and the single selected LLM.
Conceptual overview of the LLM routing framework showing how different models are selected for specific regions of the input space.

Experimental Setup

The study utilizes two major benchmark collections:

  • HELM (Holistic Evaluation of Language Models): 29 datasets covering binary classification, multiple-choice QA, and one-word answers.
  • MixInstruct: A collection of 100k instruction-following samples used to test the router's ability to handle complex generative tasks using metrics like BERTScore and BLEURT.

Key Results

The routing approach demonstrates that "smaller models are underrated." The router often selects 7B or 13B parameter models for tasks where they are sufficient, matching the performance of a 70B model while saving compute.

On the HELM benchmark, the $S_3$ router achieved an accuracy of 0.694, outperforming the best single model (Llama-2-70B) which scored 0.688. Crucially, the router achieved this superior performance using models with an average of 49.8B parameters, a significant reduction in scale compared to the 70B baseline.

Quantitative results on the HELM benchmark showing the router (S3) outperforming the best single model (Llama-2-70B) and the Bayesian Model Averaging (BMA) baseline.

On the MixInstruct dataset, the router outperformed state-of-the-art rerankers like PairRanker while requiring only one LLM call per instance, whereas rerankers require $N$ calls.

Discussion and Limitations

While effective, the router's performance is sensitive to the "OOD gap." If a new task is significantly different from the training benchmarks, performance can degrade. However, the authors show that providing as few as 2-40 labeled examples from the new task can effectively calibrate the router.

Future work involves integrating active learning to identify the most beneficial samples for labeling and expanding the router to handle "Expert LLMs" fine-tuned for specific domains like medicine or law.

Summary updated

BibTeX
@inproceedings{shnitzer2024large,
  author = {Tal Shnitzer and Anthony Ou and Mírian Silva and Kate Soule and Yuekai Sun and Justin Solomon and Neil Thompson and Mikhail Yurochkin},
  title = {{Large Language Model Routing with Benchmark Datasets}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=Zb0ajZ7vAt},
}
Figure