Skip to main content

How can I use production usage data to evaluate AI models?

Summary

  • Production data answers two different questions: usage records (latency, errors, tokens, cost per model) show which model is cheaper and healthier on real traffic, and logged requests and responses show which model gives better answers.
  • Turn real production examples into an evaluation dataset, then score candidate models against the same examples so the comparison reflects what your users actually ask.
  • Confirm a winner on a slice of live traffic with a weighted traffic split before moving everyone, and check the observed split and per-model metrics in the usage table.
  • On Databricks, Unity Gateway logs usage to system.ai_gateway.usage and payloads to inference tables or the unified trace table (Beta), and MLflow builds evaluation datasets from traces and scores them.

How can I use production usage data to evaluate AI models?

Use it twice: once to compare models on cost and reliability, and once to compare them on quality. Usage records tell you which model is faster, cheaper and less error-prone on the traffic you really serve. The prompts and responses themselves are the better test set, because they come from your users rather than a benchmark. Curate real examples into an evaluation dataset, score candidate models against it, then try the winner on a slice of live traffic before rolling it out.

Which production data helps evaluate models?

Data What it contains Evaluation use Where it lives on Databricks
Usage records Requester, model, tokens, latency, time to first byte, status code Compare cost drivers and reliability per model system.ai_gateway.usage
Cost records Spend by model service, destination model and user Compare what each model costs on real work system.billing.usage, system.ai_gateway.external_model_spend
Request and response payloads The raw JSON a model received and returned Review outputs, build test sets Inference tables on a model service
Traces Every request and response across gateway services, in OpenTelemetry format Reconstruct agent runs, review behavior Unified trace table (Beta)
Agent traces and feedback Multi-step agent runs with scorer and human assessments Build evaluation datasets, track quality MLflow Tracing and evaluation

How Databricks approaches evaluation from production data

Compare models on operational metrics. Unity Gateway logs every request to system.ai_gateway.usage, so grouping by destination_model gives latency, time to first byte, error rates and token use per model on your own traffic. Cost for Databricks-hosted models comes from system.billing.usage, which Unity Gateway enriches with the destination model and the requesting principal. For cost questions, these numbers are often all you need.
Capture real inputs and outputs. Enable inference tables on a model service to log request and response payloads to a Unity Catalog Delta table; the docs list reviewing interactions "to improve model prompts and configurations" as a use. For new deployments, the docs recommend the unified trace table (Beta), which a metastore admin sets up once to capture all Unity Gateway traffic. Its spans use an MLflow-compatible schema that MLflow tools can read directly.
Turn production examples into a test set. MLflow evaluation datasets live in Unity Catalog, with versioning and lineage, and can be built from existing traces. The docs list comparing app versions as a use: "Test different prompts, models, or app logic against the same data." From the docs:

import mlflow
import mlflow.genai.datasets

eval_dataset = mlflow.genai.datasets.create_dataset(name="<catalog>.<schema>.<table>")
traces = mlflow.search_traces(
    filter_string="attributes.status = 'OK' AND tags.environment = 'production'"
)
eval_dataset = eval_dataset.merge_records(traces)

Then run mlflow.genai.evaluate() with scorers, which are LLM judges and code-based checks, once per candidate model, so each model faces the same examples.
Test on live traffic. Traffic splitting in Unity Gateway distributes requests across several model backends behind one model service, and the docs list gradual rollouts and A/B tests as uses. Routing decisions land in the usage table, so you can confirm the observed split and compare latency, errors and tokens by destination. Session affinity keeps a session on one destination, which keeps prompt caching intact during the test.
Keep scoring after rollout. MLflow production monitoring (Beta) runs the same scorers on a configurable sample of production traces, so quality checks from development carry into production.

Govern the data you evaluate with

Production payloads contain whatever users typed, and Databricks calls coding-agent traces "extremely sensitive data." Unity Catalog permissions apply throughout: inference tables follow standard Unity Catalog ACLs, and only the metastore admin who creates the unified trace table can query it until access is granted, with ABAC row filter policies recommended for sharing. Usage system tables need account and metastore admin roles by default.

FAQs

Is production data better than a public benchmark for choosing a model?

For your workload, yes. It reflects your users' prompts and your cost structure. Use public benchmarks to shortlist candidates and production data to decide.

Do I need to log full payloads to evaluate models?

Not for cost and reliability: the usage table has tokens, latency and status codes without payloads. To judge answer quality, you need logged requests and responses or traces.

How do I compare two models on the same production examples?

Build an MLflow evaluation dataset from production traces, then run mlflow.genai.evaluate() with the same scorers for each model and compare the results.

Can I test a new model on live traffic safely?

Yes. Send a small share of a model service's traffic to the new model with traffic splitting, and add fallbacks so failed requests retry on a backup destination.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.