What you will be able to do
- Say which evaluation metrics need ground-truth expected answers and which can score outputs without them
- Compare candidate models by changing only the model and keeping the same evaluation dataset and judges, then read the side-by-side comparison for gains and regressions
- Separate pass/fail constraints such as safety and latency from the metric that actually decides between candidates
- Filter, chart and rank runs and Logged Models on a primary metric, then promote the winner toward Unity Catalog
- Check an embedding model's documented maximum token limit against your largest chunk before comparing benchmark scores
Key concept
Controlled comparison on a deciding metric — Score each candidate model on the same evaluation dataset with the same judges, so the model is the only thing that changes between runs. Then drop any candidate that fails a hard requirement, and pick among the rest using the one metric that still separates them.
1.What the metrics in an experiment measure
You pick a model by reading numbers out of an MLflow experiment, so start by knowing what each number measures. Every run is one execution of model code. It records parameters, metrics, tags and artifacts, and an experiment groups related runs so you can compare and filter them. For a generative AI application, Databricks groups the useful metrics into three dimensions: quality (of retrieval and of the response), cost (token counts) and latency (how long the app takes to run).
The dimensions differ in how they are measured. Cost and latency are computed deterministically from what the app outputs: total_token_count is a count and latency_seconds is a timing, so no judgement is involved. Most quality metrics come from an LLM judge, which is a separate model that reads the request and the response and scores them. Judges themselves come in two kinds, and the difference decides what your evaluation dataset has to contain.
Reference-based judges compare the app's output with a human-labelled expected answer. Correctness is the standard example: it asks whether the response is correct compared with the ground truth, so every row it scores needs that expectation. Reference-free judges look only at the request, the response and any retrieved context. Safety asks whether the content is free from harmful, offensive or toxic material. Groundedness asks whether the response is supported by the retrieved context. Relevance asks whether the response addresses the request. None of these three needs an expected answer. In practice, a dataset of questions without expected answers can still produce safety and groundedness scores, but it cannot produce a correctness score.
| Metric | Dimension | Measured by | Needs ground truth? |
|---|---|---|---|
| correctness | Response | LLM judge | Yes |
| safety | Response | LLM judge | No |
| groundedness | Response | LLM judge | No |
| relevance_to_query | Response | LLM judge | No |
| document_recall | Retrieval | Deterministic | Yes |
| total_token_count | Cost | Deterministic | No |
| latency_seconds | Latency | Deterministic | No |
Checkpoint 1 of 9· Match them up
Match each metric from a RAG evaluation run to how it is produced
Tap a term, then the definition that fits it.
Quality metrics such as correctness and groundedness come from LLM judges. Only correctness is reference-based, so only it needs an expected answer. Token count and latency are code-based measurements that involve no judgement.
“MLflow scores your traces with scorers: LLM judges and code-based checks that attach a quality assessment to each trace.”Source: docs.databricks.com
Checkpoint 2 of 9· Exam question
A team is comparing three candidate models for a RAG question-answering app. They have curated 200 questions with expected answers and want to score both factual correctness and the presence of unsafe content in each model's responses. Which statement correctly matches each metric type to whether it needs the curated expected answers as ground truth?
Correct answer: A — Correctness scoring compares each response with the curated expected answer, while safety scoring grades each response by itself against a harm rubric
- A. Factual correctness can only be judged against a known-good reference, so that scorer needs the 200 curated expected answers as ground truth. Unsafe content is a property of the response itself, so a safety judge can score it with a harm rubric and no reference answer.
- B. Safety judging looks for harmful or policy-violating content in the response. It does not need a curated safe answer for each question, and the team's expected answers are factual references, not safe-response templates. Requiring a reference for both scorers overstates what the safety metric depends on.
- C. This reverses the dependencies. The team wants factual correctness, which a rubric alone cannot establish without a known-good answer to compare against. Safety judging works from the response alone and gains nothing from the curated expected answers.
- D. Safety judging does work without references, but correctness does not. Scoring factual accuracy for 200 questions depends on comparing each response with its curated expected answer, so a rubric-only correctness scorer would leave the team's ground truth unused.
2.Comparing candidates with only the model changed
A metric difference between two runs only means something if the model is the only thing that changed. Each call to the mlflow.genai.evaluate() harness runs a candidate over an evaluation dataset, scores it with a set of judges, and records the result as its own run. If you also swap the dataset, add a judge or change the prompt between calls, a higher score could come from any of those changes. So keep data and scorers the same in every call and change only the candidate passed as predict_fn.
import mlflow
# Run evaluation of the new version with the same judges as before
# Use start_run to name the evaluation run in the UI
with mlflow.start_run(run_name="v2"):
eval_results_v2 = mlflow.genai.evaluate(
data=eval_dataset, # same eval dataset
predict_fn=generate_sales_email_v2, # new app version
scorers=email_judges, # same judges as step 4
)Naming each run with run_name lets you find the candidates in the UI. To compare them there, open the experiment and click Evaluation runs. Check the runs you want, then choose Compare from the Actions menu. The right pane lines up every trace from the selected runs, so you can open the same request and see how each candidate answered it, along with each judge's assessment.
From code, fetch each run with mlflow.search_runs(filter_string=f"run_id = '{...}'") and put the per-judge /mean metric columns side by side. search_runs does not support IN or OR, so fetch the runs one at a time. In the reference tutorial, the new version improved its average quality score by +0.143 overall. In the same comparison, retrieval_groundedness fell from 0.857 to 0.571. An average can hide a regression on exactly the dimension your application can't afford to lose, so read the result one metric at a time, and then open the traces where a score dropped.
Checkpoint 3 of 9· Check yourself
A team scored candidate v1 with mlflow.genai.evaluate() on a 100-question dataset using four judges. For v2, they passed a new predict_fn, added a fifth judge and extended the dataset to 150 questions. v2's average score is higher. What should they conclude?
The dataset, the judges and the candidate all changed, so the higher score could come from any of them. Keeping data and scorers fixed and changing only predict_fn makes the metric difference say something about the model. Comparing only the shared judges still fails, because the dataset is different.
“then move the same scorers into a repeatable mlflow.genai.evaluate() loop as your app matures.”Source: docs.databricks.com
Sources4
3.Requirements as pass/fail gates, then one deciding metric
Treat some metrics as requirements and one metric as the decision. Safety is usually a requirement: a candidate that fails the safety judge is out, however well it scores elsewhere. Latency and cost often come from a budget, such as a response-time limit or a spending cap. A candidate either meets the budget or it doesn't. Once every remaining candidate passes all the gates, the gate metrics no longer tell you which one to pick. The decision falls to the metric where the candidates still differ, which is usually a quality score such as correctness.
Model A. Both models already meet the latency requirement, so B's extra speed doesn't help with any stated need. Correctness is the only metric that still separates them, and A is clearly ahead on it. Speed would matter only if A broke the latency budget or the requirements explicitly favoured faster responses.
The reference tutorial keeps the two kinds of metric apart in code. Its comparison script drops the agent/ metrics (latency and token counts) before it averages quality scores. Mixing them would let a fast but weaker candidate look better on a single blended number. Check latency and tokens against your budgets on their own, and compare candidates on quality.
MLflow doesn't decide which metric matters. The Sort dropdown in the chart view and the order_by argument of the Logged Model search both rank by whatever field you give them. The ranking metric comes from the application's requirements, not from a built-in default such as cost per token. One more thing to check: if a scorer is reference-based, its numbers came from your expected answers. Correctness scores are therefore grounded in ground truth, and you shouldn't throw them out as unreliable.
Checkpoint 4 of 9· Check yourself
Three candidate chatbots were scored on the same dataset with the same judges. Candidate C has the highest correctness, 0.93, but fails the safety judge. Candidates A (0.88 correctness) and B (0.84 correctness) both pass safety and both stay within the latency and token budgets. B is faster and uses fewer tokens. Which selection is right?
Safety is a pass/fail gate, so C is out however well it scores on correctness. A and B both meet the latency and token budgets, so those metrics can't separate them. Correctness is the metric that still differs, and on it A is ahead. MLflow sorts by whichever field you choose and has no cost-per-token default.
“Get all Logged Models greater than a specific metric value on a dataset, then order by that metric value”Source: docs.databricks.com
Checkpoint 5 of 9· Exam question
A generative AI engineer runs an MLflow evaluation comparing two candidate models for a support-ticket summarization app. Both models pass the safety judge, and both comfortably beat the end-to-end latency budget. Model A scores 0.92 on the correctness scorer while Model B scores 0.81 but responds about twice as fast. Based on the logged experiment metrics, which model should be selected?
Correct answer: B — Select Model A, since its 0.92 correctness score is the only logged result that separates the two runs once the other checks are met
- A. Both models already finish well inside the latency budget, so extra speed adds no value for this app. A 0.11 correctness deficit on a summarization task is a real quality loss, and correctness is the metric that still distinguishes the two models.
- B. Correct. Both models pass the safety judge and are comfortably within the latency budget, so neither metric separates them. Model A's higher correctness score (0.92 against 0.81) is the remaining difference in the logged results, which makes it the better choice.
- C. No cost figures appear in the logged experiment metrics, so cost cannot be the basis for this decision. Judged on the metrics that were logged, Model B still trails by 0.11 on correctness and has nothing else to offset that.
- D. The logged evaluation already gives what the choice needs: both models clear the safety and latency checks, and the correctness scorer shows a clear gap. Setting those results aside for a production re-run adds cost and delay, and the selection is supposed to rest on the logged metrics.
4.Filtering, charting and ranking runs and Logged Models
With dozens of runs, filter first and compare second. The search box on the experiment page takes expressions over parameters, metrics and tags. Each expression narrows the runs table to the candidates that clear a bar:
| Expression | Selects runs where |
|---|---|
| metrics.r2 > 0.3 | the last logged r2 value is above 0.3 |
| params.elasticNetParam = 0.5 AND metrics.avg_areaUnderROC > 0.3 | a parameter value and a metric threshold both hold |
| MIN(metrics.rmse) <= 1 | the lowest rmse ever logged in the run is at most 1 |
| MAX(metrics.memUsage) > 0.9 | the highest memUsage logged in the run is above 0.9 |
| tags.estimator_name="RandomForestRegressor" | the run carries that tag value |
A plain metric filter checks the last logged value, not the best value the run ever reached. To filter on the best or worst value, use MIN or MAX, and note that only runs logged after August 2024 store those values. The Time created, State and Datasets dropdowns narrow the list further. The Datasets filter helps keep a comparison to runs that were scored on the same evaluation set.
The chart view turns the filtered runs into pictures. By default it shows the 10 most recent runs, and hovering over a line shows that run's details. The Sort dropdown reorders the runs and Group by groups them by a parameter value. A parallel coordinates plot shows how parameter settings relate to a metric. In the docs' example, lower values of max_depth lined up with higher auc.
In MLflow 3, the candidate itself is a first-class object. The MLflow 3 LoggedModel is a model entity with an ID that links its parameters, metrics and traces across runs. The experiment's Models tab lists every LoggedModel with its metrics, and you can search, filter and chart them just like runs. Metric filters can be limited to a specific dataset, so a model only matches if it hit the threshold on that dataset. The API version filters to the candidates above a bar and sorts them by the deciding metric:
## Get all Logged Models greater than a specific metric value on a dataset, then order by that metric value
mlflow.search_logged_models(
filter_string = "metrics.<metric_name> >= <metric_value>",
datasets = [
{"dataset_name": <dataset_name>, "dataset_digest": <dataset_digest>}
],
order_by = [
{"field_name": metrics.<metric_name>, "dataset_name": <dataset_name>,"dataset_digest": <dataset_digest>}
]
)To trace a top-ranked model back to the evaluations behind its score, run mlflow.search_runs(filter_string = "models.model_id = <my-model-id>"). It returns every run that used the model as an input or produced it as an output. Promotion goes through the Models tab's Charts view, where you compare candidates and pick the versions to register in Unity Catalog. In Catalog Explorer, the model version page then gathers that version's metrics and traces from every linked environment. When you use a deployment job, its evaluation task adds more metrics to that page, and the job's approver reviews them before approving the version for deployment.
Checkpoint 6 of 9· Fill the gap
Which call completes this sample so it returns candidate models that clear a metric bar on one evaluation dataset, ranked by that metric?
## Get all Logged Models greater than a specific metric value on a dataset, then order by that metric value
mlflow. ? (
filter_string = "metrics.<metric_name> >= <metric_value>",
datasets = [
{"dataset_name": <dataset_name>, "dataset_digest": <dataset_digest>}
],
order_by = [
{"field_name": metrics.<metric_name>, "dataset_name": <dataset_name>,"dataset_digest": <dataset_digest>}
]
)In MLflow 3 the candidate is a LoggedModel, and search_logged_models filters and orders those models by a metric scored on a specific dataset. search_runs returns runs, for example every run linked to a model ID. It does not rank the models themselves.
Source: docs.databricks.comCheckpoint 7 of 9· Check yourself
Run R, logged in 2025, recorded correctness three times during evaluation: 0.94, then 0.91, then 0.86. You enter metrics.correctness > 0.9 in the experiment search box. What happens to R?
A plain metric filter checks the last logged value, and 0.86 does not clear 0.9. To filter on the best or worst value, you write MAX(metrics.correctness) or MIN(metrics.correctness). Those values are stored only for runs logged after August 2024.
“By default, metric values are filtered based on the last logged value.”Source: docs.databricks.com
5.Context length as a gate when choosing an embedding model
Embedding models follow the same gate-then-compare rule, and one of the gates comes from the model card rather than from an experiment. That gate is the maximum token limit. A chunk longer than the limit is truncated before it is embedded, so the text past the cutoff never makes it into the vector and can't be retrieved. bge-large-en-v1.5, for example, has a limit of 512 tokens. Choosing a context length in general belongs to embedding model context length selection. Here the limit acts as a gate.
Take a contract-search pipeline that chunks clauses at up to 6,000 tokens. Any embedding model whose documented maximum is below 6,000 drops the end of the longest clauses, whatever its benchmark score. Start by removing those models. Then compare the remaining ones on retrieval metrics from your own experiments, because public leaderboards such as MTEB may not reflect the characteristics of your data. A model ranked lower on MTEB can still win on your evaluation set.
Checkpoint 8 of 9· Check yourself
Your support-ticket search pipeline chunks tickets at up to 2,000 tokens. You are choosing between three embedding models. X tops the MTEB retrieval leaderboard and has a documented maximum of 512 tokens. Y allows 4,096 tokens and Z allows 8,192, and both rank lower on MTEB. Which selection process is right?
The model card's token limit is a gate: X would truncate 2,000-token chunks, so the text past 512 tokens never reaches the vector, whatever X's MTEB rank. Y and Z both pass the gate, so a larger limit doesn't separate them. The choice between them comes from retrieval metrics scored on your own data, not from leaderboard rank or a default MLflow ordering.
“You can filter metrics based on dataset-specific performance, and only models with matching metric values on the given datasets are returned.”Source: docs.databricks.com
Checkpoint 9 of 9· Exam question
A team is building a retrieval system over legal contracts where individual clauses are chunked at up to 6,000 tokens each. While comparing embedding model cards to select a model for this pipeline, which approach correctly uses the context length metric to guide the decision?
Correct answer: C — Choose the embedding model with a maximum input length on its card that exceeds the longest chunk, because text past that limit is truncated before embedding and its content is lost from the vector.
- A. Parameter count and maximum input length are separate attributes on a model card. A larger embedding model can still have a short input window, so size says nothing reliable about whether 6,000-token clause chunks fit.
- B. Vector dimension sets the size of the output embedding, not how much text the model can read. Text past the maximum input length is still cut off before the vector is computed, so a higher-dimensional model loses the same clause content.
- C. Correct. An embedding model reads only up to its documented maximum input length. With chunks of up to 6,000 tokens, the model's limit has to be above that size, or the end of long clauses is truncated and missing from the vector.
- D. A general benchmark score does not show that the model can take a 6,000-token chunk. Benchmark inputs are often much shorter, and context length is still a fixed limit for every embedding model, so it must be checked against the chunk size.
Sources9
Sources
(10)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/evaluate-assess-performanceOfficial docs
“Below is a summary of the metrics that Databricks recommends for measuring the quality, cost, and latency of your RAG application.”
↩︎ What the metrics in an experiment measure“Cost and latency metrics can be computed deterministically based on the application's outputs.”
↩︎ What the metrics in an experiment measure“Other LLM judges, such as groundedness, do not require human-labeled ground truth to assess their app outputs.”
↩︎ Exam trap 1“Some LLM judges, such as answer correctness, compare the human-labeled ground truth vs. the app outputs.”
↩︎ Prediction - 2.
“Is the content free from harmful, offensive, or toxic material?”
↩︎ What the metrics in an experiment measure - 3.https://docs.databricks.com/aws/en/mlflow/trackingOfficial docs
“In an experiment, you can compare and filter runs to understand how your model performs and how its performance depends on the parameter settings”
↩︎ What the metrics in an experiment measure - 4.
“Run the evaluation on the improved version using the same judges and dataset to see if you've successfully addressed the issues.”
↩︎ Comparing candidates with only the model changed“Look for specific examples where the evaluation metrics regressed so you can focus on those.”
↩︎ Comparing candidates with only the model changed“Skip the agent metrics (latency, token counts) for quality comparison”
↩︎ Requirements as pass/fail gates, then one deciding metric“Run the evaluation on the improved version using the same judges and dataset to see if you've successfully addressed the issues.”
↩︎ Key concept“Skip the agent metrics (latency, token counts) for quality comparison”
↩︎ Exam trap 2 - 5.
“To change the sort order of runs shown in the charts, select the parameter to sort by from the Sort dropdown menu.”
↩︎ Requirements as pass/fail gates, then one deciding metric“A parallel coordinates plot is useful in understanding the effect of parameter settings on model performance”
↩︎ Filtering, charting and ranking runs and Logged Models - 6.https://docs.databricks.com/aws/en/mlflow/runsOfficial docs
“Using MIN or MAX lets you search for runs based on the minimum or maximum metric values, respectively.”
↩︎ Filtering, charting and ranking runs and Logged Models“By default, metric values are filtered based on the last logged value.”
↩︎ Exam trap 3“By default, metric values are filtered based on the last logged value.”
↩︎ Checkpoint - 7.
“You can filter metrics based on dataset-specific performance, and only models with matching metric values on the given datasets are returned.”
↩︎ Filtering, charting and ranking runs and Logged Models“Get all Logged Models greater than a specific metric value on a dataset, then order by that metric value”
↩︎ Checkpoint“You can filter metrics based on dataset-specific performance, and only models with matching metric values on the given datasets are returned.”
↩︎ Checkpoint - 8.
“provides visualizations to help you compare models and select the model versions to register to Unity Catalog for possible deployment”
↩︎ Filtering, charting and ranking runs and Logged Models“The approver for the job can then review this page to assess whether to approve the model version for deployment.”
↩︎ Filtering, charting and ranking runs and Logged Models - 9.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/quality-data-pipeline-ragOfficial docs
“For example, bge-large-en-v1.5 has a maximum token limit of 512.”
↩︎ Context length as a gate when choosing an embedding model“Experiment with different off-the-shelf embedding models, even those that may be lower-ranked on standard leaderboards like MTEB.”
↩︎ Context length as a gate when choosing an embedding model“If you pass chunks that exceed this limit, they will be truncated, potentially losing important information.”
↩︎ Exam trap 4
Also cited
“MLflow scores your traces with scorers: LLM judges and code-based checks that attach a quality assessment to each trace.”
↩︎ Checkpoint“then move the same scorers into a repeatable mlflow.genai.evaluate() loop as your app matures.”
↩︎ Checkpoint