You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**RouterArena** is an open evaluation platform and leaderboard for **LLM routers**—systems that automatically select the best model for a given query. As the LLM ecosystem diversifies with models varying in size, capability, and cost, **routing** has become critical for balancing performance and cost. Yet, LLM routers currently lack a standardized evaluation framework to assess how effectively they trade off accuracy, cost, and other related metrics.
20
+
**RouterArena** is an open evaluation platform and leaderboard for **LLM routers** — systems that automatically select the best model for a given query. As the LLM ecosystem diversifies into specialized models of varying size, capability, and cost, routing has become essential for balancing performance and efficiency. Yet, unlike models, routers currently lack a unified evaluation standard that measures how well they trade off accuracy, cost, robustness, and latency.
21
21
22
-
RouterArena bridges this gap by providing an open evaluation platform and benchmarking framework for both open-source and commercial routers. It has the following key features:
22
+
RouterArena addresses this gap by providing a uniform, multi-dimensional benchmarking framework for both open-source and commercial routers. It introduces a principled dataset with diverse domains and difficulty levels, a comprehensive suite of evaluation metrics, and an automated leaderboard for transparent comparison. By standardizing router evaluation, RouterArena lays the foundation for reproducible, fair, and continuous progress in the next generation of routing systems.
23
23
24
-
- 🌍 **Diverse Data Coverage**: A principly-constructed, diverse evaluation dataset spanning 9 domains and 44 categories with easy, medium, and hard difficulty levels.
25
-
- 📊 **Comprehensive Metrics**: Five router-critical metrics measuring accuracy, cost, optimality, robustness, and latency.
26
-
- ⚙️ **Automated Evaluation**: An automated evaluation framework to simplify the evaluation process for open-source and commercial routers.
27
-
- 🏆 **Live Leaderboard**: A live leaderboard to track the performance of routers across multiple dimensions.
24
+
<h3align="left">Key Features</h3>
28
25
29
-
*We aim for RouterArena to serve as a foundation for the community to evaluate, understand, and advance LLM routing systems.*
26
+
-**Diverse Data Coverage**: A principled, diverse evaluation dataset spanning 9 domains and 44 categories
27
+
-**Comprehensive Eval Metrics**: Five complementary evaluation metrics capturing accuracy, cost, optimality, robustness, and latency.
28
+
-**Uniform Eval Framework**: Fairly benchmarked open-sourced and commercial routers.
29
+
-**Live Leaderboard**: Ranking routers across multiple dimensions.
30
30
31
-
# Current Leaderboard
32
-
33
-
For more details, please see our [website](https://routeworks.github.io/leaderboard) and [blog](https://huggingface.co/blog/JerryPotter/who-routes-the-routers).
<img src="images/leaderboard.png" alt="Make GPU Sharing Flexible and Easy" width="500" />
54
52
</p> -->
55
53
56
-
<!-- # Have your router on the leaderboard! -->
54
+
The current leaderboard is computed considering the accuracy and overall cost for each router. For more details, please read our [blog](https://huggingface.co/blog/JerryPotter/who-routes-the-routers).
57
55
58
-
# Evaluating Your Router
56
+
<h2align="left">Have your router on there!</h3>
59
57
60
-
To use our framework to evaluate your router and get your router on the leaderboard, you can follow the steps below. The evaluation pipelines include two stages as shown in the diagram below. First, you need to generate a prediction file for your router. Then, you can open a Pull Request with your router's prediction file to trigger our automated evaluation workflow.
58
+
If you want your router on the leaderboard, submit a Pull Request with your router's prediction file. For questions or issues, please open a GitHub issue. For fairness, we have withheld the ground truth answers for the full dataset. However, you can still test your router using the sub-sampled 10% dataset by following the steps below.
Download the dataset from [HF dataset](https://huggingface.co/datasets/RouteWorks/RouterArena).
75
+
Run this command to download the dataset from the[HF dataset](https://huggingface.co/datasets/RouteWorks/RouterArena).
78
76
79
77
```bash
80
78
uv run python ./scripts/process_datasets/prep_datasets.py
81
79
```
82
80
83
-
### Step 3: Set Up API Keys (Optional)
81
+
### Step 3: Set Up API Keys
84
82
85
-
Update the API keys in the `.env` file in the project root. This step is **required only if you use our pipeline for LLM inferences**.
83
+
This step is **required only if you plan to use our pipeline to make LLM inferences**. Create a `.env` file in the project root and add the API keys for the providers you need:
86
84
87
85
```bash
88
86
# Example .env file
89
87
OPENAI_API_KEY=<Your-Key>
90
88
ANTHROPIC_API_KEY=<Your-Key>
89
+
HF_TOKEN=<Your-Key>
91
90
# ...
92
91
```
93
92
94
-
See the [`ModelInference`](./llm_inference/model_inference.py) class for the complete list of supported providers and required environment variables. You can extend that class to support more models, or submit a GitHub issue to request support for new providers.
93
+
#### Optional:
94
+
See the `ModelInference` class in `RouterArena/llm_inference/model_inference.py` for the complete list of supported providers and required environment variables. You can extend that class to support additional models, or submit a GitHub issue to request support for new providers.
95
95
96
-
## Get Routing Decisions
96
+
## Usage
97
97
98
-
Follow the steps below to obtain your router's model choices for each query. Start with the `sub_10` split (a 10% subset with ground-truth answers) for local testing. Once your setup works, you can evaluate on the `full` dataset for official leaderboard submission.
98
+
Follow the steps below to evaluate your router. You can start with the `sub_10` split (10% sub-sampled dataset) to test your setup and code. The `sub_10` split includes groundtruth answers for local testing. Once ready, you can evaluate on the `full` dataset for official leaderboard submission.
99
99
100
100
### Step 1: Prepare Config File
101
101
102
-
Create a config file in `./router_inference/config/<router_name>.json`. An example config file is included [here](./router_inference/config/your-router.json).
102
+
Create a config file in `./router_inference/config/<router_name>.json`. We have created an example router for demonstration purposes:
103
103
104
104
```json
105
105
{
@@ -108,13 +108,16 @@ Create a config file in `./router_inference/config/<router_name>.json`. An examp
108
108
"models": [
109
109
"gpt-4o-mini",
110
110
"claude-3-haiku-20240307",
111
-
"gemini-2.0-flash-001"
111
+
"gemini-2.0-flash-001",
112
+
"mistral-medium"
112
113
]
113
114
}
114
115
}
115
116
```
116
117
117
-
For each model in your config, add an entry with the pricing per million tokens in this format at [`model_cost/cost.json`](./model_cost/cost.json):
118
+
*Note: The model name must be the same as the one used in `./universal_model_names.py` (see next step for details)*
119
+
120
+
**Important**: For each model in your config, add an entry with the pricing per million tokens in this format at `model_cost/cost.json`:
118
121
119
122
```json
120
123
{
@@ -125,23 +128,26 @@ For each model in your config, add an entry with the pricing per million tokens
125
128
}
126
129
```
127
130
128
-
> [!NOTE]
129
-
> Ensure all models in your above config files are listed in [`./universal_model_names.py`](./universal_model_names.py). If you add a new model, you must also add the API inference endpoint in [`llm_inference/model_inference.py`](./llm_inference/model_inference.py).
131
+
### Step 2: Verify Model Names
130
132
131
-
### Step 2: Generate Router's Prediction File
133
+
Ensure all models in your config are listed in `./universal_model_names.py`. If you add a new model, you must also add the API inference endpoint in `RouterArena/llm_inference/model_inference.py`.
134
+
135
+
### Step 3: Generate Router's Prediction File
132
136
133
137
Generate a template prediction file:
134
138
135
139
```bash
136
-
uv run python ./router_inference/generate_prediction_file.py your-router [sub_10|full]
140
+
uv run python ./router_inference/generate_prediction_file.py your-router sub_10
137
141
```
138
142
139
-
**Important**: Replace the placeholder model choices in the `prediction` field with your router's actual selections.
143
+
Use `full` instead of `sub_10` for the complete dataset. **Important**: Replace the placeholder model choices in the `prediction` field with your router's actual selections.
144
+
145
+
### Step 4: Validate Config and Prediction Files
140
146
141
-
### Step 3: Validate Config and Prediction Files
147
+
Validate your config and prediction files before proceeding:
142
148
143
149
```bash
144
-
uv run python ./router_inference/check_config_prediction_files.py your-router [sub_10|full]
150
+
uv run python ./router_inference/check_config_prediction_files.py your-router sub_10
145
151
```
146
152
147
153
This script checks: (1) all model names are valid, (2) prediction file has correct size (809 for `sub_10`, 8400 for `full`), and (3) all entries have valid `global_index`, `prompt`, and `prediction` fields.
0 commit comments