What you will be able to do
- Tell apart the evaluation phase (pre-release, curated dataset, labels available) and the monitoring phase (post-deployment, sampled live traces, no labels), and say which one a given scenario calls for
- Pick judges that each phase can run, based on whether they need ground truth
- Explain how the same MLflow scorers carry over from offline evaluation to production monitoring, and when they do not
- Set sampling rates and filters for monitoring scorers to balance coverage and cost
Key concept
Evaluation phase vs monitoring phase — Evaluation scores an app version before release, against a curated dataset that can carry ground-truth expectations. Monitoring scores a sample of live production traces after deployment, where there are no labels. Both phases use the same scorers, so quality is measured the same way before and after release.
1.Two phases that answer one quality question
Evaluation and monitoring both ask whether a Gen AI app gives answers that are correct, grounded and safe. They ask it at different times, on different data. Evaluation happens before release. You run an app version against a fixed, curated dataset and compare the result with the previous version. Monitoring happens after deployment. Scorers run continuously on real user traffic that nobody picked in advance. The scoring machinery is mostly the same in both phases, so the real choice is about timing and data: do you have a known set of test cases and a change you haven't shipped yet, or a live app and traffic you can't predict?
The evaluation phase is built around a dataset. That means a curated set of queries, ideally with expected outputs, that represents how the app is meant to be used and includes hard and varied cases. The mlflow.genai.evaluate() harness runs the app on every record and applies scorers. It is the tool for checks that must finish before something ships: validating a prompt or model change across app versions, nightly or weekly regression runs, and gating a release or PR. Because every version is scored against the same records, the runs can be compared directly. A drop in one judge's pass rate after a prompt edit is a regression you catch before any user sees it.
The monitoring phase starts once the app is live. In production you need to score far more requests than any curated set holds, and you need to know how each response was produced. If a bad answer came from the retrieval step and not from a hallucination, the trace has to show it. So monitoring depends on production tracing: the app must log inputs, outputs and intermediate steps such as document retrieval. Agent Monitoring: scheduled scorers on production traces then runs scorers on a sample of those traces and attaches the results as feedback, and dashboards show quality trends over time.
| Aspect | Evaluation phase | Monitoring phase |
|---|---|---|
| When it runs | During development: before a release, on a PR, nightly or weekly | After deployment, continuously in the background |
| Data scored | A curated evaluation dataset of representative, challenging inputs | A sample of live production traces |
| Ground truth | Records can carry optional expectations | Live traces arrive with inputs and outputs only |
| What triggers it | A prompt, model or logic change to validate | Incoming traffic, at a configured sample_rate |
| Typical question | Did this version regress against the last one? | Is quality drifting, or are safety violations appearing now? |
Monitoring can't stand in for evaluation when the goal is to stop a regression before release. Monitoring only sees traffic that has already reached the changed version, so by the time it flags a problem, users have already hit it. Two other substitutes fail for different reasons. A version history of prompts records what changed but doesn't score anything. Watching endpoint latency measures speed, which is a separate requirement from response quality. Only scoring outputs against a dataset tells you whether the new version is better or worse.
results = mlflow.genai.evaluate(
data=[
{"inputs": {"question": "What is MLflow?"}},
{"inputs": {"question": "How do I get started?"}}
],
predict_fn=my_chatbot_app,
scorers=[RelevanceToQuery(), Safety()]
)Checkpoint 1 of 8· Check yourself
A team has edited the system prompt of its deployed RAG assistant. They want to find out whether the edit lowers answer quality before any user gets the new version. What should they do?
Regressions are caught before release in the evaluation phase: each version is scored against the same curated dataset, so you can compare runs directly. Monitoring only scores traffic that has already reached the changed version. A prompt version history scores nothing, and latency measures speed, not answer quality.
“Before a release or PR to prevent quality regressions”Source: docs.databricks.com
Checkpoint 2 of 8· Exam question
A team building a customer support RAG agent on Databricks has just finished revising a prompt template. Before shipping the change to production, they want to systematically compare the new version's response quality against a curated set of question-answer pairs and flag regressions relative to the prior version. Which approach best fits this need?
Correct answer: A — Run offline evaluation with an evaluation dataset and scorers/LLM judges in MLflow, comparing runs to detect regressions before deployment
- A. Offline evaluation against a curated evaluation dataset, scored with MLflow scorers and LLM judges, is the correct way to compare app versions before release. It lets the team run both versions against the same fixed inputs and directly compare metrics to catch regressions pre-deployment.
- B. Scheduled scorers on sampled live traffic are the mechanism for production monitoring after launch, not for pre-release version comparison. Using this approach here would mean shipping the unvalidated change before any regression check occurs.
- C. The Prompt Registry tracks prompt versions and lineage but does not itself score response quality or detect regressions. Version history alone cannot tell the team whether the new prompt performs worse on the benchmark questions.
- D. Deploying first and watching inference table latency addresses operational performance, not response quality against known question-answer pairs. This skips the pre-deployment quality comparison the team explicitly wants before shipping.
2.Ground truth decides which judges each phase can run
Labels are the clearest practical difference between the two phases. In an evaluation dataset, each record has required inputs and an optional expectations field, which holds ground truth for scorers. Expectations get there on purpose: someone curates traces into a dataset and enriches them with expected outputs, often labels from domain experts. A production trace has none of this when it arrives. It records what the user asked and what the app did, not what the right answer was.
Built-in judges split cleanly on this point, and the split tells you where each one can run. Reference-free judges need only the inputs and outputs, so they work on a curated dataset and on unlabeled production traffic alike. Judges that need ground truth also take expectations, so they belong to the evaluation phase, where a labeled benchmark exists. The full taxonomy is covered in judges that require ground truth. What matters here is the consequence for each phase.
| Judge | Requires ground truth | What it evaluates | Runs on unlabeled live traffic? |
|---|---|---|---|
| RelevanceToQuery | No | Is the response directly relevant to the user's request? | Yes |
| RetrievalRelevance | No | Is the retrieved context directly relevant to the user's request? | Yes |
| Safety | No | Is the content free from harmful, offensive, or toxic material? | Yes |
| RetrievalGroundedness | No | Is the response grounded in the context, or is the agent hallucinating? | Yes |
| Correctness | Yes | Is the response correct as compared to the provided ground truth? | No: needs expectations |
| RetrievalSufficiency | Yes | Does the context provide all the information needed for a response that includes the ground truth facts? | No: needs expectations |
Take a small internal benchmark of question and expected-answer pairs for a RAG agent. If the question is whether the retrieved passages actually contain the facts the expected answer needs, the judge has to read the label, and RetrievalSufficiency does exactly that. RetrievalRelevance sounds similar but answers a weaker question: whether the context is on topic for the query. A passage can be relevant and still leave out the fact the answer depends on. Safety checks for harmful content and says nothing about coverage. A judge built for tool calls looks at the wrong part of the trace. The benchmark's labels make this an evaluation-phase task.
Checkpoint 3 of 8· Check yourself
Your deployed RAG assistant logs each request's query, retrieved documents and response as a trace. No one adds expected answers to these traces. Which set of built-in judges can a monitoring job run on these traces as they arrive?
Live traces carry inputs and outputs but no expectations, so only reference-free judges can score them. Correctness and RetrievalSufficiency need ground truth, which has to be added on purpose when traces are curated into a labeled dataset. A low sample rate doesn't change that.
“Enrich your traces with expected outputs or quality indicators to enable ground truth comparison.”Source: docs.databricks.com
Checkpoint 4 of 8· Exam question
An engineer wants to evaluate whether a RAG agent's retrieved context actually contains the facts needed to produce a labeled expected answer, using a small internal benchmark of question/expected-answer pairs. Which type of judge is appropriate, and why?
Correct answer: A — A judge requiring ground truth, such as retrieval sufficiency, because it compares retrieved context against the labeled answer to check fact coverage
- A. A retrieval sufficiency judge is a ground-truth-dependent judge that checks whether retrieved context contains the facts necessary to support the labeled expected answer, which is exactly what the benchmark with expected answers enables. This directly matches the stated goal of checking fact coverage against labels.
- B. A relevance-to-query judge is reference-free and assesses topical alignment between retrieved passages and the question, but it does not check whether the context contains the specific facts needed for a labeled expected answer. It would not use the benchmark's expected answers at all.
- C. A safety judge is reference-free and checks for harmful or inappropriate content, which is unrelated to whether retrieved context supports a labeled expected answer. It does not measure fact coverage.
- D. Tool call correctness is a ground-truth-dependent judge, but it validates agent tool invocations against expected tool outcomes, not whether retrieved context contains needed facts. It targets a different part of the agent's behavior than retrieval quality.
3.The same scorers connect the two phases
A scorer is written once and used in both phases. The interface is the same either way: a scorer receives a Trace from either evaluate() or the monitoring service, pulls out the fields it needs, makes its assessment, and returns Feedback that gets attached to the trace. Because the input is always a trace, a judge you tuned on the evaluation dataset can be registered against the experiment and left to run on production traffic. Quality before release and quality after release are then measured the same way.
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Register a built-in scorer against your experiment, then start monitoring
safety = Safety().register(name="safety")
safety = safety.start(sampling_config=ScorerSamplingConfig(sample_rate=1.0))Scorers carry over most reliably when evaluation runs the real app. In direct evaluation, MLflow calls your app through predict_fn (or a serving endpoint wrapped with to_predict_fn) and captures traces. Those traces have the same shape as the ones production logs. If you used your production app as the predict_fn during development, your scorers are likely already compatible with monitoring.
Answer-sheet evaluation is where reuse can fail. In that mode you hand evaluate() pre-computed outputs or existing traces from batch jobs, external systems or history, and it builds or scores traces without calling your app. If those traces look different from what production logs, a scorer that parses fields from the trace may not find them in production. Then you need to rewrite the scorer before it can monitor anything.
Checkpoint 5 of 8· Check yourself
Which development-time evaluation setup makes it most likely that your custom scorers, which parse fields from the trace, can be registered for production monitoring without being rewritten?
In direct evaluation, MLflow calls the real app, so the traces it captures are identical to production traces and scorers that parse them carry over. Answer-sheet traces can differ in shape from production traces, so scorers may need rewriting. Adding expectations doesn't help, because live traces carry no ground truth.
“this mode enables you to reuse the scorers defined for offline evaluation in production monitoring since the resulting traces will be identical.”Source: docs.databricks.com
4.Monitoring live traffic: sampling, filters and closing the loop
An evaluation dataset has a fixed size. Production traffic doesn't, so monitoring trades coverage against cost through a sample rate for each scorer. This is what keeps monitoring cheap: you track quality trends from a fraction of requests without scoring every one, and you can still score every request for the checks that can't miss anything.
| Scorer kind | sample_rate | Reason |
|---|---|---|
| Critical checks (safety, security) | 1.0 | Every trace is scored, so violations show up close to real time |
| Expensive scorers (complex LLM judges) | 0.05–0.2 | Enough to show the quality trend at a fraction of the compute cost |
| Iterative improvement during development | 0.3–0.5 | Moderate coverage while you iterate |
Sampling decides how many traces a scorer sees. filter_string decides which ones, using the same syntax as mlflow.search_traces(). There are a few limits to plan around. At most 20 scorers can be attached to an experiment for monitoring at once. The first results take 15–20 minutes to appear after you schedule scorers. Monitoring only sees apps that log traces with MLflow Tracing.
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Only evaluate traces that completed successfully
safety_judge = Safety().register(name="safety")
safety_judge = safety_judge.start(
sampling_config=ScorerSamplingConfig(
sample_rate=1.0,
filter_string="attributes.status = 'OK'"
),
)Monitoring also feeds the next round of evaluation. Improving an agent is a loop: you find an issue, curate a dataset, write a scorer, fix the agent, re-run evaluation, then monitor production so the issue doesn't come back. Monitoring then surfaces the next issue. Production traces that scored poorly can be pulled with search_traces() and merged into the evaluation dataset. Once domain experts add expectations, they become labeled cases that every future version is tested against before release. Synthetic data generated from your documents can also seed an evaluation set, but it fills that dataset. It doesn't replace scoring real traffic.
traces = mlflow.search_traces(
filter_string="attributes.status = 'OK' AND tags.environment = 'production'",
order_by=["attributes.timestamp_ms DESC"],
max_results=10
)
print(f"Found {len(traces)} successful traces")
# 3. Add the traces to the evaluation dataset
eval_dataset = eval_dataset.merge_records(traces)Checkpoint 6 of 8· Fill the gap
This monitoring scorer should only score production traces that finished successfully. Which ScorerSamplingConfig parameter completes the setup?
from mlflow.genai.scorers import Safety, ScorerSamplingConfig
# Only evaluate traces that completed successfully
safety_judge = Safety().register(name="safety")
safety_judge = safety_judge.start(
sampling_config=ScorerSamplingConfig(
sample_rate=1.0,
? ="attributes.status = 'OK'"
),
)sample_rate sets how many traces a scorer sees, and filter_string sets which traces it sees. filter_string uses the same filter syntax as mlflow.search_traces().
Source: docs.databricks.comCheckpoint 7 of 8· Check yourself
Monitoring shows that a group of production traces scored poorly on RetrievalGroundedness. How do these failures become test cases that every future version must pass before release?
Monitoring feeds the next round of evaluation. Traces that scored poorly are merged into the evaluation dataset and labeled, so each version is tested against them before release. Monitoring only scores traffic that has already been deployed, synthetic data adds to a dataset but doesn't replace real traffic, and live traces carry no ground truth for Correctness to use.
“Build evaluation and golden datasets from representative production failures.”Source: docs.databricks.com
Checkpoint 8 of 8· Exam question
A GenAI agent has been serving live customer traffic for three months. The team wants an ongoing, low-overhead way to track response quality trends without evaluating every single request, and to get near-real-time visibility into safety violations. What should they configure?
Correct answer: A — Scheduled scorers sample production traces logged via MLflow Tracing, using high sampling for safety checks and lower sampling for costlier judges
- A. This is correct: production monitoring registers scorers that run on a sampled portion of traces captured through MLflow Tracing, with sampling rates tuned per scorer so cheap or critical checks (like safety) can run at high coverage while expensive judges run at lower coverage. This gives ongoing quality visibility without scoring every request.
- B. A quarterly manual run against a static pre-launch dataset is characteristic of offline evaluation, not continuous production monitoring, and would leave long gaps where live quality drift or safety issues go undetected. It does not provide the near-real-time visibility the team needs.
- C. Conversation simulation generates synthetic test dialogues for development-time evaluation; it does not observe or score real production traffic. It cannot substitute for analyzing actual live traces.
- D. A ground-truth-dependent correctness judge needs labeled expected answers, which are not available for arbitrary live customer requests. Requiring labels for every production request is impractical and is not how continuous monitoring is set up.
Sources
(9)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Validating prompt or model changes across app versions”
↩︎ Two phases that answer one quality question“Optional ground truth for scorers”
↩︎ Ground truth decides which judges each phase can run“this mode enables you to reuse the scorers defined for offline evaluation in production monitoring since the resulting traces will be identical.”
↩︎ The same scorers connect the two phases“Before a release or PR to prevent quality regressions”
↩︎ Exam trap 1“If you use an answer sheet with different traces than your production environment, you may need to re-write your scorer functions”
↩︎ Exam trap 3“Before a release or PR to prevent quality regressions”
↩︎ Checkpoint - 2.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/fundamentals-evaluation-monitoring-ragOfficial docs
“you need a curated set of evaluation queries (and ideally outputs) that are representative of the application's intended use.”
↩︎ Two phases that answer one quality question“Once in production, you need to evaluate a significantly higher quantity of requests/responses and how each response was generated.”
↩︎ Two phases that answer one quality question“Technically, evaluation happens during development and monitoring happens once the application is deployed to production, but the fundamental components are similar.”
↩︎ Key concept - 3.
“Production monitoring continuously runs MLflow scorers on a sample of your live production traces and attaches the results as feedback”
↩︎ Two phases that answer one quality question“the same scorers you built during evaluation now watch production.”
↩︎ The same scorers connect the two phases - 4.
“Evaluation measures whether your agent is actually good”
↩︎ Two phases that answer one quality question - 5.
“Enrich your traces with expected outputs or quality indicators to enable ground truth comparison.”
↩︎ Ground truth decides which judges each phase can run“Synthetic data. Databricks can automatically generate a representative evaluation set from your documents”
↩︎ Monitoring live traffic: sampling, filters and closing the loop - 6.
“Does the context provide all necessary information to generate a response that includes the ground truth facts?”
↩︎ Ground truth decides which judges each phase can run“Is the retrieved context directly relevant to the user's request?”
↩︎ Ground truth decides which judges each phase can run“Is the response correct as compared to the provided ground truth?”
↩︎ Exam trap 2“Is the response correct as compared to the provided ground truth?”
↩︎ Prediction - 7.
“You can use the same scorer for evaluation in development and monitoring in production to keep evaluation consistent throughout the application lifecycle.”
↩︎ The same scorers connect the two phases“A scorer receives a Trace from either evaluate() or the monitoring service.”
↩︎ The same scorers connect the two phases - 8.
“If you used your production app as the predict_fn in mlflow.genai.evaluate() during development, your scorers are likely already compatible.”
↩︎ The same scorers connect the two phases“Configurable sampling rates so you can control the tradeoff between coverage and computational cost.”
↩︎ Monitoring live traffic: sampling, filters and closing the loop“At any given time, at most 20 scorers can be associated with an experiment for continuous quality monitoring.”
↩︎ Monitoring live traffic: sampling, filters and closing the loop“After scheduling scorers, allow 15-20 minutes for initial processing.”
↩︎ Monitoring live traffic: sampling, filters and closing the loop“Instrumented production application: Your agent must log traces using MLflow Tracing.”
↩︎ Monitoring live traffic: sampling, filters and closing the loop“For expensive scorers, such as complex LLM judges, use lower sample rates (0.05-0.2).”
↩︎ Exam trap 4“For critical scorers such as safety and security checks, use sample_rate=1.0.”
↩︎ Prediction - 9.
“Monitor production. Run your scorers against live traffic so the issue doesn't recur — which surfaces the next one to fix.”
↩︎ Monitoring live traffic: sampling, filters and closing the loop“Build evaluation and golden datasets from representative production failures.”
↩︎ Checkpoint