Skip to main content

How can AI tracing help evaluate new AI models?

Summary

  • Tracing makes a model swap measurable: it records every step of a request, so you can compare a candidate model with the current one on quality, behavior, latency, token usage and errors, not only on the final answer.
  • The workflow is capture, curate, evaluate, compare: trace real requests, turn representative traces into an evaluation dataset, run the candidate on the same inputs with the same scorers, then compare the runs trace by trace.
  • On Databricks, MLflow Tracing (part of open-source MLflow, managed on Databricks) stores traces in Unity Catalog, and mlflow.genai.evaluate() scores app versions against an evaluation dataset built from those traces.
  • For live traffic, Unity Gateway traffic splitting sends a share of requests to the new model, and system.ai_gateway.usage logs which model served each request with its tokens, latency and status.

How can AI tracing help evaluate new AI models?

Tracing turns a model swap from a hunch into a measured comparison. Capture traces of real requests on the current model, turn representative ones into an evaluation dataset, run the candidate model on the same inputs with the same scorers, and compare quality, latency, token usage and errors step by step. Then route a slice of live traffic to the new model and keep tracing to confirm the offline results hold. Public benchmarks can't tell you how a model behaves inside your agent, with your tools and your data. Your traces can.

What is AI tracing?

A trace records one request end to end: the input, the final output and every intermediate step, such as model calls, tool calls and retrieval, with the inputs, outputs, latency, token usage and cost of each step (agent observability). MLflow Tracing is the open-source, OpenTelemetry-compatible tracing layer in MLflow (mlflow.org).
Step-level detail matters for model evaluation. A new model can produce a better final answer while calling tools in a different order, retrieving less context, spending more tokens or failing on a step the final output hides. As the Databricks docs put it, with only an input and a final response you can't tell which intermediate decision caused a failure.

What to compare when you evaluate a new model

Dimension What the traces show
Answer quality Scorer results, from LLM judges or code checks, attached to each trace
Agent behavior Which tools and retrieval steps ran, with what arguments, in what order
Latency Timing for each span and for the whole request
Token usage and cost Tokens per step and per request
Reliability Errors, retries and fallback attempts
Regressions Cases that passed on the current model and fail on the candidate

How Databricks approaches model evaluation with tracing

Capture. MLflow on Databricks is open-source MLflow, managed and integrated with the platform. Autologging (mlflow.<framework>.autolog()) or the @mlflow.trace decorator records each request as a trace, and Databricks recommends storing traces in Unity Catalog tables in OpenTelemetry format, where you can query them with SQL (Store traces in Unity Catalog).
Curate. In the experiment's Traces tab, select representative traces, including failures, and add them to an evaluation dataset stored in a Unity Catalog schema. You can also build the dataset in code with mlflow.genai.datasets.create_dataset and merge_records (Build evaluation datasets).
Evaluate. Run mlflow.genai.evaluate() with the dataset, a predict_fn for the app version that calls the candidate model, and the same scorers you used for the current version. Built-in judges include Correctness, Completeness and Fluency, and you can add custom LLM judges or code-based scorers (Evaluate and improve). Marking retrieval steps with span_type="RETRIEVER" enables MLflow's retrieval-specific judges.
Compare. In the experiment's Evaluation runs view, select both runs and choose Compare. The comparison shows each trace from both runs side by side, so you can open any request and see where the candidate diverged (tutorial).
Test on live traffic. Unity Gateway model services support traffic splitting, which the docs describe as a way to "gradually roll out new models, run A/B tests, and spread load across providers" (routing and fallbacks). Session affinity keeps a session on one destination. Each request is logged to system.ai_gateway.usage with destination_model, token counts, latency_ms, status_code and routing_information, so you can compare the candidate and the incumbent on real requests. The unified trace table (Beta) adds gateway spans in an MLflow-compatible OpenTelemetry schema.
Keep watching. Production monitoring (Beta) runs the same scorers automatically on a sample of production traces, so the checks you used to approve the model keep running after rollout (production monitoring).

Use cases

  • Moving routine work to a smaller model. Confirm quality holds on your hardest cases, and check that token usage per request drops.
  • Adopting a newly released model. Rerun last quarter's failure cases before any user sees the new model.
  • Changing models in a RAG agent. Retrieval spans show what context each model received, and MLflow's retrieval-specific judges score the answers built on it.

FAQs

Can I evaluate a new model without writing code?

Partly. You can select traces in the Traces tab, choose Actions and then Evaluate, and run built-in LLM judges on them from the UI. Running a candidate model across a full dataset uses mlflow.genai.evaluate().

How do I keep the comparison fair?

Use the same evaluation dataset and the same scorers for both versions. The Databricks tutorial evaluates the improved version with the same judges and dataset as the baseline, then compares the runs.

Do I need production traffic to start?

No. You can start from a small evaluation dataset. Traces from real usage make the dataset more representative, and failing production traces are good regression cases.

Is the tracing tied to Databricks?

MLflow Tracing is open source and OpenTelemetry-compatible. On Databricks it's managed, and traces are stored in Unity Catalog in OpenTelemetry format.

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