TensorOpera Router: A Multi-Model Router for Efficient LLM Inference

Dimitris Stripelis, Zhaozhuo Xu, Zijian Hu, Alay Dilipbhai Shah, Han Jin, Yuhang Yao, Jipeng Zhang, Tong Zhang, Salman Avestimehr, Chaoyang He

Introduction

TensorOpera Router (TO-Router) is a multi-model routing system designed to address the "multi-LLM routing trilemma"—the complex trade-off between query throughput, monetary cost, and model performance. By dynamically directing queries to the most suitable "expert" model within a fleet, TO-Router achieves significant efficiency gains: up to a 30% reduction in cost and a 40% increase in throughput, while simultaneously improving overall response quality by up to 11%.

The Routing Problem

The current Large Language Model (LLM) landscape features a wide array of models, ranging from massive general-purpose powerhouses to smaller, domain-specific experts. For developers, this presents a challenge: using a large, expensive model for every simple query is inefficient, yet relying solely on small models may lead to poor accuracy for complex tasks. TO-Router acts as a predictive traffic controller, analyzing incoming prompts to decide which specific LLM is best equipped to handle the request, thereby optimizing for speed and cost without sacrificing accuracy.

Methodology

The authors propose a structured three-phase pipeline for building and deploying the TO-Router system.

The three-phase pipeline of TensorOpera Router: Data Preparation, Training, and Deployment.
  1. Router Data Preparation: Expert models are queried with diverse datasets to collect performance metrics, including inference time, token counts, and BERTSim (a semantic similarity metric). The system uses a softmax function to create "soft labels," teaching the router the relative ranking of experts rather than a simple binary choice.
  2. Router Training: Several architectures were evaluated, including k-Nearest Neighbors (kNN), Multi-Layer Perceptrons (MLP), and a fine-tuned BERT-Router (110M parameters). The BERT-Router performs sequence classification to select the optimal expert based on the semantic space of the query.
  3. Router Deployment: The router operates as a standalone endpoint. It tokenizes user queries, predicts the best expert, executes the query on that expert, and returns the result with negligible added latency.

Experimental Setup

The system was evaluated using four diverse benchmarks representing different domains:

  • Ai2-ARC: General science knowledge.
  • GSM8k: Math word problems and reasoning.
  • MBPP: Programming and coding tasks.
  • PubMedQA: Biomedical research question-answering.

The expert pool consisted of seven models, including specialized variants like BioLlama-8B, CodeLlama-7B, and the high-efficiency Fox-1.6B.

Key Results and the Routing Trilemma

The BERT-Router emerged as the superior architecture across all evaluated metrics. By learning the embedding space of queries, it significantly outperformed naive routing methods.

3D visualization of the routing trilemma, showing the trade-offs between cost, throughput, and model performance (BERTSim).

Key performance highlights include:

  • Cost Efficiency: A 30% cost reduction compared to a baseline without routing.
  • Throughput: A 40% increase in query processing speed.
  • Quality: An 11% improvement in model performance (BERTSim) and a 6% reduction in Negative Log-Likelihood (NLL).
  • Resource Optimization: The router frequently utilized the small Fox-1.6B model for simpler queries, "escalating" to larger models only when complexity required it. Because the BERT-Router itself is small (110M parameters), it adds minimal overhead to the inference pipeline.

Conclusion and Future Work

TO-Router demonstrates that intelligent routing can effectively navigate the trade-offs of LLM deployment. Future research will focus on scaling the system to extremely large models (70B+), implementing dynamic routing to allow for on-the-fly expert pool adjustments, and exploring top-k ensembling to further enhance response accuracy.

Summary updated

BibTeX
@inproceedings{stripelis2024tensoropera,
  author = {Dimitris Stripelis and Zhaozhuo Xu and Zijian Hu and Alay Dilipbhai Shah and Han Jin and Yuhang Yao and Jipeng Zhang and Tong Zhang and Salman Avestimehr and Chaoyang He},
  title = {{TensorOpera Router: A Multi-Model Router for Efficient LLM Inference}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-industry.34},
}
Figure