Skip to content

Fix genai.evaluate() dropping dataset expectations and tags with scorers=[]#23957

Merged
B-Step62 merged 3 commits into
mlflow:masterfrom
Incheonkirin:fix/genai-eval-expectations-no-scorers
Jun 16, 2026
Merged

Fix genai.evaluate() dropping dataset expectations and tags with scorers=[]#23957
B-Step62 merged 3 commits into
mlflow:masterfrom
Incheonkirin:fix/genai-eval-expectations-no-scorers

Conversation

@Incheonkirin

@Incheonkirin Incheonkirin commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Related Issues/PRs

Closes #23746

What changes are proposed in this pull request?

mlflow.genai.evaluate(..., scorers=[]) stopped logging the dataset's expectations (and tags) onto the generated traces — a regression from #20940. In _run_pipeline, the no-single-turn-scorer case short-circuited into EvalResult(assessments=[]) instead of going through _run_score, which is what persists dataset expectations (_get_new_expectations_log_assessments) and applies eval_item.tags via set_trace_tag.

This removes that special-case branch so every eval item goes through _run_score. Scoring is a no-op when there are no single-turn scorers, but expectations and tags are persisted again. total_tasks is also corrected so the progress bar counts the items that now go through the score pool.

Credit to @maxime2476 for independently reproducing and confirming the root cause; per the maintainer's request this is the single consolidated PR.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Added regression tests in tests/genai/evaluate/test_evaluation.py that call evaluate(scorers=[]) and assert, via search_traces, that the dataset expectations land as Expectation assessments and the dataset tags land on the traces. Both fail on the pre-fix harness and pass with the fix.

Does this PR require documentation update?

  • No.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Does this PR require updating the MLflow Skills repository?

  • No.
  • Yes. Please link the corresponding PR or explain how you plan to update it.

Release Notes

Is this a user-facing change?

  • No.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

Fixed mlflow.genai.evaluate() so dataset expectations and tags are again logged onto the generated traces when called with scorers=[] (regression since 3.11).

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Is this PR a critical bugfix or security fix that should go into the next patch release?

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Minor releases are expected to contain larger changes, such as new features and improvements. Non-critical bug fixes and doc updates can be included as well. By default, your PR should target the next minor release.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Patch releases are typically only performed when there has been a major regression or bug in the latest release. For the sake of stability, your PR should not be included in a patch release unless it is a critical fix, or if the risk level of your PR is exceedingly low.
  • This PR is critical and needs to be in the next patch release
  • This PR can wait for the next minor release

PR #20940 added a short-circuit in _run_pipeline that skips the score pool
when there are no single-turn scorers, returning EvalResult(assessments=[])
directly. This bypassed _run_score, which besides scoring also logs the
dataset expectations as Expectation assessments and applies eval_item.tags
to the trace - so with scorers=[] both expectations and dataset tags were
silently dropped (regression from 3.11.1).

Remove the short-circuit and always route completed predict items through
_run_score. Scoring itself is already a no-op for empty scorers
(_compute_eval_scores returns early), and _get_scorer_rate_config falls
back to the predict rate when num_scorers is zero, so the score pool path
is safe in this case. Since every item now produces a score-pool task,
count all eval items in the progress bar total (previously 0 when no
scorers were given).

Signed-off-by: Mingi Jeong <[email protected]>
…y (#23746)

When scorers=[], dataset expectations must still be persisted to the trace
as Expectation assessments, and the dataset tags column must still be
applied to the traces. Add regression tests that fail on the pre-fix
harness (which set assessments=[] and skipped both) and pass with the fix.

Signed-off-by: Mingi Jeong <[email protected]>
Copilot AI review requested due to automatic review settings June 13, 2026 02:13
@github-actions

Copy link
Copy Markdown
Contributor
Install mlflow from this PR

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/23957/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/23957/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/23957/merge

PR author's recent activity

In the last 14 days, @Incheonkirin opened 17 PRs across 11 repos (showing top 10):

Repository Open Closed Merged Total
huggingface/sentence-transformers 0 0 4 4
mlflow/mlflow 2 0 0 2
vllm-project/vllm 2 0 0 2
bentoml/BentoML 2 0 0 2
apache/lucene 1 0 0 1
huggingface/transformers 0 0 1 1
elastic/elasticsearch 1 0 0 1
huggingface/datasets 0 1 0 1
explosion/spaCy 1 0 0 1
run-llama/llama_index 0 0 1 1

@github-actions github-actions Bot added community Community/external contribution size/M labels Jun 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@Incheonkirin Thank you for the contribution! Could you fix the following issue(s)? Otherwise, this PR may be automatically closed.

❌ Invalid PR template

The PR description is missing required sections. Please use the PR template.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds regression coverage and fixes a pipeline short-circuit so that mlflow.genai.evaluate(..., scorers=[]) still persists dataset expectations and dataset tags on traces (regression #23746).

Changes:

  • Add tests asserting dataset expectations are logged as Expectation assessments even when scorers=[].
  • Add a test asserting dataset tags are persisted to traces when scorers=[].
  • Remove the “no single-turn scorers” short-circuit so _run_score still runs (no-op scoring, but logs expectations/tags), and update progress total tasks accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/genai/evaluate/test_evaluation.py Adds regression tests verifying expectations and tags are persisted when scorers=[].
mlflow/genai/evaluation/harness.py Always queues _run_score per item to ensure expectations/tags are logged even without scorers; adjusts progress accounting.

Comment thread tests/genai/evaluate/test_evaluation.py
Comment thread mlflow/genai/evaluation/harness.py
@github-actions github-actions Bot added area/evaluation MLflow Evaluation area/tracing MLflow Tracing and its integrations rn/bug-fix Mention under Bug Fixes in Changelogs. labels Jun 13, 2026
@Incheonkirin Incheonkirin reopened this Jun 13, 2026

@B-Step62 B-Step62 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Documentation preview for 3cdba82 is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

@B-Step62
B-Step62 added this pull request to the merge queue Jun 16, 2026
Merged via the queue into mlflow:master with commit b635b74 Jun 16, 2026
52 checks passed
@Incheonkirin

Copy link
Copy Markdown
Contributor Author

Thanks @B-Step62! Appreciate you taking the time to get this one in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/evaluation MLflow Evaluation area/tracing MLflow Tracing and its integrations community Community/external contribution rn/bug-fix Mention under Bug Fixes in Changelogs. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] mlflow.genai.evaluate() with scorers=[] no longer logs expectations as trace assessments

3 participants