Skip to content

Commit a264ed1

Browse files
authored
Revert "Update evaluation pipeline figure (#20)" (#21)
This reverts commit 6bbdd7b.
1 parent 6bbdd7b commit a264ed1

2 files changed

Lines changed: 52 additions & 46 deletions

File tree

README.md

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,54 @@
1111

1212
</div>
1313

14-
<h1 align="center"> Make Router Evaluation Open and Standardized </h1>
14+
<h2 align="center"> Make Router Evaluation Open and Standardized </h2>
1515

1616
<p align="center">
17-
<img src="images/routerarena-diagram.png" alt="RouterArena Diagram" width="700" />
17+
<img src="images/routerarena-diagram.png" alt="RouterArena Diagram" width="1000" />
1818
</p>
1919

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 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.
2121

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.
2323

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+
<h3 align="left">Key Features</h3>
2825

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.
3030

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).
31+
<h3 align="left">RouterArena Leaderboard</h3>
3432

3533
| Rank | Router | Affiliation | Arena | Opt.Sel | Opt.Cost | Opt.Acc | Lat | Robust |
3634
|------|---------|--------------|--------|------------|-----------|----------|----------|-------------|
37-
| 🥇 | MIRT-BERT | 🎓 USTC | 66.89 | 3.44 | 19.62 | 78.18 | 27.03 | 94.50 |
38-
| 🥈 | Azure | 💼 Microsoft | 66.66 | 22.52 | 46.32 | 81.96 |||
39-
| 🥉 | NIRT-BERT | 🎓 USTC | 66.12 | 3.83 | 14.04 | 77.88 | 10.42 | 44.50 |
40-
| 4 | GPT-5 | 💼 OpenAI | 64.32 ||||||
41-
| 5 | vLLM-SR | 💼 vLLM | 64.32 | 4.79 | 12.54 | 79.33 | 0.19 | 100.00 |
42-
| 6 | CARROT | 🎓 UMich | 63.87 | 2.68 | 6.77 | 78.63 | 1.50 | 93.60 |
43-
| 7 | NotDiamond | 💼 NotDiamond | 63.00 | 1.55 | 2.14 | 76.81 |||
44-
| 8 | MLP | 🎓 Academic | 57.56 | 13.39 | 24.45 | 83.32 | 90.91 | 96.90 |
45-
| 9 | GraphRouter | 🎓 UIUC | 57.22 | 4.73 | 38.33 | 74.25 | 2.70 | 97.50 |
46-
| 10 | KNN | 🎓 Academic | 55.48 | 13.09 | 25.49 | 78.77 | 1.33 | 51.30 |
47-
| 11 | RouteLLM | 🎓 Berkeley | 48.07 | 99.72 | 99.63 | 68.76 | 0.40 | 99.80 |
48-
| 12 | RouterDC | 🎓 SUSTech | 33.75 | 39.84 | 73.00 | 49.05 | 10.75 | 97.60 |
49-
50-
🎓 Academic  💼 Commercial 
35+
| 🥇 | MIRT-BERT | 🟨 USTC | 66.89 | 3.44 | 19.62 | 78.18 | 27.03 | 94.50 |
36+
| 🥈 | Azure | 🟦&nbsp;Microsoft | 66.66 | 22.52 | 46.32 | 81.96 |||
37+
| 🥉 | NIRT-BERT | 🟨 USTC | 66.12 | 3.83 | 14.04 | 77.88 | 10.42 | 44.50 |
38+
| 4 | GPT-5 | 🟦 OpenAI | 64.32 ||||||
39+
| 5 | vLLM-SR | 🟦 vLLM | 64.32 | 4.79 | 12.54 | 79.33 | 0.19 | 100.00 |
40+
| 6 | CARROT | 🟨 UMich | 63.87 | 2.68 | 6.77 | 78.63 | 1.50 | 93.60 |
41+
| 7 | NotDiamond | 🟦&nbsp;NotDiamond | 63.00 | 1.55 | 2.14 | 76.81 |||
42+
| 8 | MLP | 🟨 Academic | 57.56 | 13.39 | 24.45 | 83.32 | 90.91 | 96.90 |
43+
| 9 | GraphRouter | 🟨 UIUC | 57.22 | 4.73 | 38.33 | 74.25 | 2.70 | 97.50 |
44+
| 10 | KNN | 🟨 Academic | 55.48 | 13.09 | 25.49 | 78.77 | 1.33 | 51.30 |
45+
| 11 | RouteLLM | 🟨 Berkeley | 48.07 | 99.72 | 99.63 | 68.76 | 0.40 | 99.80 |
46+
| 12 | RouterDC | 🟨 SUSTech | 33.75 | 39.84 | 73.00 | 49.05 | 10.75 | 97.60 |
47+
48+
🟨 Academic  🟦 Commercial 
5149

5250
<!-- <p align="center">
5351
<img src="images/leaderboard.png" alt="Make GPU Sharing Flexible and Easy" width="500" />
5452
</p> -->
5553

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).
5755

58-
# Evaluating Your Router
56+
<h2 align="left">Have your router on there!</h3>
5957

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.
6159

6260
<p align="center">
63-
<img src="images/pipeline.png" alt="RouterArena Evaluation Pipeline" width="700" />
61+
<img src="images/pipeline.png" alt="RouterArena Evaluation Pipeline" width="1000" />
6462
</p>
6563

6664
## Setup
@@ -74,32 +72,34 @@ uv sync
7472
```
7573

7674
### Step 2: Download Dataset
77-
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).
7876

7977
```bash
8078
uv run python ./scripts/process_datasets/prep_datasets.py
8179
```
8280

83-
### Step 3: Set Up API Keys (Optional)
81+
### Step 3: Set Up API Keys
8482

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:
8684

8785
```bash
8886
# Example .env file
8987
OPENAI_API_KEY=<Your-Key>
9088
ANTHROPIC_API_KEY=<Your-Key>
89+
HF_TOKEN=<Your-Key>
9190
# ...
9291
```
9392

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.
9595

96-
## Get Routing Decisions
96+
## Usage
9797

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 ground truth answers for local testing. Once ready, you can evaluate on the `full` dataset for official leaderboard submission.
9999

100100
### Step 1: Prepare Config File
101101

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:
103103

104104
```json
105105
{
@@ -108,13 +108,16 @@ Create a config file in `./router_inference/config/<router_name>.json`. An examp
108108
"models": [
109109
"gpt-4o-mini",
110110
"claude-3-haiku-20240307",
111-
"gemini-2.0-flash-001"
111+
"gemini-2.0-flash-001",
112+
"mistral-medium"
112113
]
113114
}
114115
}
115116
```
116117

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`:
118121

119122
```json
120123
{
@@ -125,23 +128,26 @@ For each model in your config, add an entry with the pricing per million tokens
125128
}
126129
```
127130

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
130132

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
132136

133137
Generate a template prediction file:
134138

135139
```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
137141
```
138142

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
140146

141-
### Step 3: Validate Config and Prediction Files
147+
Validate your config and prediction files before proceeding:
142148

143149
```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
145151
```
146152

147153
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.

images/pipeline.png

-5 KB
Loading

0 commit comments

Comments
 (0)