[2025.01.22] 🌟 GraphRouter is accepted for ICLR 2025.
# create a new environment
conda create -n graphrouter python=3.10
conda activate graphrouter
# install pytorch. Modify the command to align with your own CUDA version.
pip3 install torch --index-url https://download.pytorch.org/whl/cu118
# install related libraries
pip install -r requirements.txt
# install pyg
pip install torch_geometric
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
First, generate 'data/unified_qa_data.csv'.
python data_processing/multidata_unify.py
Then, generate data/router_data.csv
and configs/llm_description_embedding.pkl
by setting your api_key in configs/config.yaml
.
python data_processing/construct_router_data.py
For your convenience, we provide download links for the 'unified_qa_data.csv' and 'router_data.csv' files we generated. Please download them and put them in data
folder.
unified_qa_data.csv router_data.csv
Run experiments and print/save evaluation results on metrics Performance, Cost, and Reward. You can edit the hyperparameters in configs/config.yaml
or using your own config_file.
python run_exp.py --config_file [config]
@inproceedings{feng2024graphrouter,
title={Graphrouter: A graph-based router for llm selections},
author={Feng, Tao and Shen, Yanzhen and You, Jiaxuan},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2024}
}