TL;DR
Sending every user prompt to a massive frontier LLM is like commuting to the grocery store in a Formula 1 car: effective, yet ruinously expensive. "LLM routers" solve this by directing queries to the cheapest model capable of answering them well, but training a good router normally requires pooling everyone's private prompts and model evaluations in one place. This paper introduces the first federated framework for LLM routing, allowing isolated clients to collaboratively learn an optimal routing policy without ever exposing their local data.
What Problem Does This Paper Address?
When organizations or edge devices access LLMs via APIs, they face a vast menu of models varying wildly in intelligence and token cost. Language query routing optimizes the accuracy–cost trade-off by predicting which model will maximize utility—defined as expected accuracy minus a cost penalty weighted by a user-chosen budget parameter ($\lambda$).
Standard routers assume you have a massive, centralized dataset where diverse prompts have been exhaustively tested across all candidate models. Reality looks very different:
- Privacy: Prompts contain proprietary code, personal queries, or customer chats that cannot be centralized.
- Narrow local views: A single client only sees queries from its specific domain (e.g., biology or coding).
- Sparse evaluations: In the wild, a client typically sends a prompt to just one model, leaving the capabilities of other models on that prompt completely unknown.
If a client trains a router solely on its own sparse, skewed logs, the router overfits and makes noisy decisions.
Methods
The authors apply Federated Learning (FL)—where clients train models locally and a central server aggregates only the learned parameters or statistics—to two canonical router architectures, both operating on fixed text embeddings of the queries. Rather than hardcoding a single budget preference, both routers predict per-model accuracy and cost, letting each client dial in its own $\lambda$ at inference time.
- Federated MLP-Router (Parametric): Uses a shared Multilayer Perceptron (MLP) trunk with model-specific linear heads to predict accuracy and cost. It is trained across clients via standard Federated Averaging (FedAvg) using Mean Squared Error loss on whatever single-model evaluations each client possesses.
- Federated K-Means-Router (Nonparametric): Exploits geometry in the embedding space without neural network training. Clients run local K-means clustering on their query embeddings and send cluster centroids and sizes to the server. The server runs a size-weighted K-means to establish global centroids and broadcasts them back. Clients then tally average accuracy and cost per model within each global cluster, which the server aggregates via weighted averaging.
- Adaptive Personalization: For extreme data heterogeneity (where a global router might struggle on a client's niche domain), the authors introduce a lightweight inference-time mixture. Clients measure the mean absolute error of both the federated router and their local router on their own training data (requiring zero new LLM calls) and blend their predictions inversely proportional to those errors.
Datasets
No new datasets were introduced. Instead, the authors simulate fragmented, non-IID federated environments (partitioning tasks via a Dirichlet distribution and restricting each training query to a single evaluated model) across three existing multi-LLM evaluation benchmarks:
- RouterBench-Data: 11 public and proprietary LLMs across 8 datasets (primary focus of the main text).
- ProxRouter-Data: 14 public LLMs across 12 datasets.
- SPROUT: 13 public and proprietary LLMs across 6 datasets (featuring graded response quality).
Key Insights and Ideas
- Collaboration fixes local blind spots, not just out-of-distribution generalization: You would expect FL to help a client handle unfamiliar query types. More surprisingly, FL substantially improves routing on a client's own local test distribution. Because each client only evaluates a skewed subset of LLMs, cross-client aggregation fills in the missing "model coverage," teaching the client about strong or cheap models it rarely sampled locally.
- Plug-and-play model expansion: With millions of models emerging, retraining routers from scratch is impractical. Both federated designs onboard new LLMs cheaply: K-Means simply computes new cluster averages, while the MLP freezes its trunk and trains a new linear head—requiring clients to evaluate the new models on just a 10% calibration slice of prompts.
- Theoretical backing for collective coverage: The authors prove mathematically that federated routing shrinks suboptimality bounds compared to local routing—scaling with total pooled dataset coverage for MLPs and increasing the minimum cluster-model sample counts ($n_{\text{min}}$) for K-Means.
Key Results
Performance is measured by sweeping the cost-preference $\lambda$ and calculating the normalized Area Under the accuracy–cost Curve (AUC, where higher means a better frontier).
- Global Generalization: On RouterBench global tests, Federated MLP achieves 0.750 AUC vs. 0.683 for client-local routers. Federated K-Means jumps to 0.747 AUC vs. 0.655 locally (local clustering suffers badly from sparse, unstable centers).
- Parity with Centralized Training: Both federated routers achieve an AUC of 0.75, matching centralized oracle routers trained on pooled raw data (0.75).
- In-Distribution Gains: On local client test sets, federated routers consistently beat isolated local routers (e.g., jumping from 0.64 to 0.77 AUC on Client 8 for K-Means).
- Cheap Onboarding & Personalization: Adding three withheld models via 10% calibration lifts global AUC from 0.732 to ~0.749 for both methods. Under extreme heterogeneity (Dirichlet $\alpha = 0.03$), adaptive personalization rescues MLP performance when the global model lags locally (e.g., lifting Client 4 to 0.72 AUC over 0.69 federated and 0.70 local).
Limitations and Future Work
- Offline static logs: The framework assumes clients learn from static, offline historical datasets. Updating routers dynamically in an online bandit-like setting—where routing decisions actively gather new evaluations after deployment—is left for future work.
- Global misalignment in extreme niches: Under severe statistical heterogeneity, a pure federated MLP router can underperform a local router on niche client distributions, requiring the heuristic local-error calibration step to recover performance.
Summary updated