xRouter: Training Cost-Aware LLMs Orchestration System via Reinforcement Learning
Welcome to
xRouter
, Salesforce AI Research's intelligent LLM routing system trained with reinforcement learning to dynamically select optimal models from 20+ available LLMs while optimizing for both performance and cost.
Modern LLM deployments face a widening cost-performance spectrum: premium models deliver strong reasoning but are expensive, while lightweight models are economical yet brittle on complex tasks.
xRouter
learns end-to-end routing policies that balance quality and cost through explicit cost-aware reward shaping, eliminating the need for hand-engineered routing rules.
⭐ Highlights
Cost-Aware Optimization
: RL-trained policies minimize costs (up to 60% reduction) while maintaining quality
Adaptive Routing
: Dynamic model selection based on query complexity - routes simple queries to budget models, complex ones to premium models
Tool-Calling Architecture
: Learns to effectively invoke 20+ models (GPT-5, o3/o4, DeepSeek R1, Qwen3, Kimi K2, etc.) and select best responses
Multi-Model Orchestration
: Coordinates responses from multiple LLMs for complex reasoning tasks
Learned Prompt Engineering
: Automatically generates optimized system prompts for target models
📊 Model Details
Developed by
: Salesforce AI Research
Base Model
: Qwen/Qwen2.5-7B-Instruct
Model Type
: Instruction-tuned language model with tool-calling capabilities
Training Algorithm
: DAPO (Distributional Advantage Policy Optimization) with cost-aware reward shaping
Training Data
: Derived from
Reasoning360
- math, code, reasoning, and STEM tasks
License
: CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0 International)
📈 Key Results
Substantial cost reductions
(up to 60%) at comparable task completion rates
Evaluated on
17 diverse benchmarks
spanning math, coding, reasoning, and OOD tasks
Adaptive behavior
: Learns when to use premium vs. budget models without explicit rules
Multi-turn reasoning
: Effectively coordinates multiple model calls for complex tasks
# Host the router modelcd evaluation
bash host_router.sh # Serves on port 8000# Launch the router API (in another terminal)
bash serve_router.sh # Serves on port 8800
@article{qian2025xrouter,
title={xRouter: Training Cost-Aware LLMs Orchestration System via Reinforcement Learning},
author={Qian, Cheng and Liu, Zuxin and Kokane, Shirley and Prabhakar, Akshara and Qiu, Jielin and Chen, Haolin and Liu, Zhiwei and Ji, Heng and Yao, Weiran and Heinecke, Shelby and Savarese, Silvio and Xiong, Caiming and Wang, Huan},
journal={arXiv preprint arXiv:2510.08439},
year={2025}
}
xRouter huggingface.co is an AI model on huggingface.co that provides xRouter's model effect (), which can be used instantly with this Salesforce xRouter model. huggingface.co supports a free trial of the xRouter model, and also provides paid use of the xRouter. Support call xRouter model through api, including Node.js, Python, http.
xRouter huggingface.co is an online trial and call api platform, which integrates xRouter's modeling effects, including api services, and provides a free online trial of xRouter, you can try xRouter online for free by clicking the link below.
Salesforce xRouter online free url in huggingface.co:
xRouter is an open source model from GitHub that offers a free installation service, and any user can find xRouter on GitHub to install. At the same time, huggingface.co provides the effect of xRouter install, users can directly use xRouter installed effect in huggingface.co for debugging and trial. It also supports api for free installation.