Large Language Model Routing with Benchmark Datasets

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

TL;DR

This paper tackles the challenge of selecting the best Large Language Model (LLM) for a given task without requiring labeled data from that specific task. They propose a novel "router" model trained on existing benchmark datasets to predict which LLM will perform best, achieving improved performance over using any single LLM.

What Problem Does This Paper Address?

The rapid proliferation of open-source LLMs has created a landscape where choosing the right model for a specific task is increasingly difficult. While benchmarks exist to evaluate LLMs, no single model excels across all tasks. Current approaches to model selection often require labeled examples from the target task, which are not always available. This paper addresses this gap by proposing a method to learn an LLM "router" that can predict the best model for a new task using only the input itself, leveraging existing benchmark datasets without requiring new labeled data.

Methods

The core of the proposed method is to train a "correctness predictor" for each LLM. This predictor learns to estimate whether a given LLM will perform correctly on a specific input. These predictors are trained using data from existing benchmark datasets. The authors then formulate three scores (S1, S2, and S3) to leverage these predictors for LLM routing. S1 is a direct estimator using the correctness predictor, S2 uses a binary version of the predictor, and S3 incorporates a model for out-of-distribution (OOD) confidence, aiming to improve robustness when the new task differs from the benchmark tasks. For the correctness predictors themselves, they employ a k-nearest neighbors (kNN) classifier on embedded inputs.

Datasets

The authors utilize a collection of existing benchmark datasets for training their LLM routers. Specifically, they use 29 datasets from the HELM (Holistic Evaluation of Language Models) benchmark, covering a variety of tasks like question answering, text classification, and reasoning. They also evaluate their approach on the MixInstruct benchmark dataset, which focuses on instruction-following tasks.

Key Insights and Ideas

  • Leveraging existing benchmarks for unseen tasks: The paper demonstrates that existing benchmark datasets, even if not perfectly aligned with a new task, can be effectively repurposed to train a model selector. This is a significant departure from methods requiring task-specific labeled data.
  • The importance of OOD confidence: The S3 score, which explicitly models the confidence of the correctness predictor on out-of-distribution data, shows improved performance, highlighting the challenge of generalization and the benefit of accounting for potential model weaknesses.
  • Smaller models can be sufficient: The research suggests that by intelligently routing tasks, smaller LLMs can achieve performance comparable to much larger models, offering significant cost and efficiency benefits.
  • kNN as a simple yet effective predictor: The use of a kNN classifier for correctness prediction, despite its simplicity, proves effective and allows for a focus on the OOD generalization problem rather than complex predictor architectures.

Key Results

  • The proposed routing strategy consistently improves performance over using any single LLM for all tasks.
  • In the HELM experiments, the S3 score (with true OOD accuracy) achieved an accuracy of 0.735, outperforming the best model on average (BMA) which achieved 0.688.
  • The routing method can recommend smaller LLMs that perform comparably to larger ones, as seen in the HELM experiments where the average number of parameters of chosen models was significantly lower.
  • Even a small number of in-distribution samples (e.g., 50 samples) for a new task can significantly reduce the OOD gap and improve routing performance.

Limitations and Future Work

  • OOD generalization remains a challenge: The accuracy of correctness predictors on unseen tasks is still a limiting factor, and further research into improving OOD generalization is needed.
  • Dataset sparsity: The effectiveness of the router is influenced by the similarity between benchmark datasets and the new task. Learning from a larger and more diverse set of benchmarks is suggested to mitigate this.
  • "Expert" LLMs: The authors suggest exploring routing "expert" LLMs fine-tuned for specific domains, which could simplify the learning process and improve performance.
  • Encouraging smaller LLMs: Future work could focus on modifying routing scores to explicitly encourage the selection of smaller LLMs when their performance is comparable to larger ones, further optimizing for cost and efficiency.

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},
}

Loading related content...

Figure