What metrics should I use to evaluate AI model routing?
Summary
- Evaluate AI model routing on cost and outcome together: the model mix it produces, how often routed work finishes on the model it was given, what it saves, and whether latency, errors and cache efficiency hold.
- Databricks' routing team monitors three headline metrics for coding agents: the breakdown of sessions by model, the number of sessions completed end-to-end by the routed models, and the dollar savings from routing.
- Cache hit rate belongs on the scorecard, because routing that switches models turn by turn can lose the prompt-cache savings that dominate large-context workloads.
- In Unity Gateway, the
system.ai_gateway.usagetable supplies most of these signals per request, including destination model, latency, status code, fallback attempts, cache tokens and the smart-routing recipe.
What metrics should I use to evaluate AI model routing?
Use a small scorecard that puts cost and outcome side by side, since a router that saves money by quietly lowering quality hasn't worked. Databricks' own Smart Routing team frames it this way: routing "needs to optimize for both cost and developer productivity, and not only cost alone." For coding agents, they continuously monitor the breakdown of sessions by model, the number of sessions completed end-to-end by the routed models, and the dollar savings from routing. Add operational health (latency, errors, fallbacks) and cache efficiency, and you have a scorecard that catches the common failure modes.
What is AI model routing?
Model routing sends each request or task to a model chosen by a policy instead of a fixed default. There are two broad styles. Rule-based routing, such as weighted traffic splits and fallbacks, distributes requests across configured destinations for rollouts, A/B tests and availability. Task-aware routing picks a model per task based on its difficulty. The metrics overlap, but the second style also needs quality signals, because its whole bet is that cheaper models can handle simpler work.
Key metrics to evaluate
| Metric | What it tells you | Where it comes from in Unity Gateway |
|---|---|---|
| Model mix | Whether routing actually moves work off the default model | destination_model and session_metadata.smart_router_name in system.ai_gateway.usage |
| Sessions completed on the routed model | Whether cheaper choices finish the job without a rescue | Session traces, grouped by session_metadata.client_session_id |
| Cost savings | The economic case, measured against a pre-routing baseline | system.billing.usage and system.ai_gateway.external_model_spend |
| Quality of routed output | Whether productivity held, judged by AI scorers and human review | Traces reviewed with evaluators and people |
| Cache efficiency | Whether routing preserved prompt-cache reuse | token_details.cache_read_input_tokens and cache_creation_input_tokens |
| Latency | Whether routing added delay or chose slower models | latency_ms and time_to_first_byte_ms |
| Errors and fallbacks | Whether the policy sends traffic to destinations that fail | status_code and the routing_information attempts array |
| Split adherence | For weighted splits, whether observed traffic matches the configured percentages | A grouped count by destination over the usage table |
Two of these deserve extra attention. Cache efficiency matters because, in the words of the Databricks team, "at scale, costs are dominated by cache hit rate," and per-request routing breaks the cache by changing models between turns. That's why Smart Routing routes at the task level. Quality signals matter because benchmarks flatter routers: "Benchmark tasks are unusually well-behaved," and real sessions start with vague prompts and drift.
How Databricks approaches routing evaluation
One log for every routed request. Unity Gateway writes each request to system.ai_gateway.usage, with the requester, the destination model, token counts, latency and status code. The routing_information field records each fallback attempt with its priority, destination, status code and latency. The traffic-splitting docs include a query that compares the observed share of requests per destination with your configured split.
Routing context per session. For coding agents, session_metadata carries the coding agent, the client session and subagent IDs, reasoning effort, and the name of the smart-routing recipe, so you can group sessions by recipe and by model. These session fields are in Public Preview.
Smart Routing (Beta). Smart Routing selects the lowest-cost model capable of handling each task and works with Claude Code and Codex launched through the Unity Gateway CLI. Each subagent's task is routed on its own, and the agent shows the selected model and, when available, the reason. The release notes describe every routing decision as visible and auditable.
Cost and quality evidence. Dollar cost comes from system.billing.usage for Databricks-hosted models and from estimated spend in system.ai_gateway.external_model_spend for external providers. For quality, the unified trace table (Beta) stores gateway and coding-agent traces in one Unity Catalog table, and its spans use an MLflow-compatible schema so MLflow tools can read them. Databricks used "both AI models and human review to analyze traces to evaluate changes to the router."
A dashboard to start from. The built-in usage dashboard's Performance tab covers latency percentiles, time to first byte and error rates; the Usage tab shows cache hit ratios; and the Cost Observability tab breaks spend down by model and user.
FAQs
What's the single most important routing metric?
There isn't one. Cost savings without a quality signal can hide a regression, so pair savings with the share of routed sessions that finish on the model they were given.
Why track cache hit rate when evaluating routing?
Large-context workloads lean on prompt caching. A router that switches models between turns can lose those cache reads, which can wipe out the savings from the cheaper model.
Can I evaluate routing on a public benchmark?
As a first check, yes. Databricks found that benchmark tasks arrive as tidy, self-contained statements of work and real sessions rarely do, so confirm results on your own traffic and traces before you trust them.
Which Unity Gateway field shows fallbacks?
routing_information in system.ai_gateway.usage. It lists each attempt with priority, destination, status code and latency.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.