Repository navigation
fix(eval): surface judge reasoning in rubric_scores - #8314
Open
krisztianfekete wants to merge 1 commit into
Open
krisztianfekete wants to merge 1 commit into
krisztianfekete wants to merge 1 commit into
Conversation
krisztianfekete
force-pushed
the
fix/eval-judge-reasoning-rubric-scores
branch
from
November 26, 2026 13:55
4ff36ff to
7aa8287
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
final_response_match_v2andhallucinations_v1parse the judge's reasoning and then drop it, so a failed eval returns only a score (rubric_scoresisNone/[]). Therubric_based_*metrics, and since #7366 the Vertex-backed metrics, already return their reasoning inPerInvocationResult.rubric_scores.Solution:
Return the reasoning in the existing
RubricScoretype, as the other judges do. Scores, statuses and aggregation are unchanged.final_response_match_v2: oneRubricScore(rubric_id="is_the_agent_response_valid", rationale=<reasoning>, score=<label score>). The new_parse_reasoningmatches the field directly instead of parsing the whole answer as JSON, because judge output often has code fences, trailing commas or a list-wrapped value. If the label can't be parsed, the reasoning is still returned, with no score. The majority vote already returns a whole winning sample, so the reasoning always agrees with the reported verdict.hallucinations_v1: oneRubricScoreper sentence. Itsrubric_idis the sentence, its score is 1.0 or 0.0 by label, and its rationale is"<label>: <rationale>". I put the label first because the score alone doesn't say whether a sentence wasunsupportedorcontradictory. An invocation's result collects these from every scored response, in order. A response that can't be scored adds none._evaluate_nl_responsenow returns a third value,list[RubricScore]. Existing tests that mock it now return[]as the third value.rubric_scoresrow indocs/guides/evaluation/evaluator/index.md.adk eval --print_detailed_resultsalready printsrubric_idand rationale for each per-invocationRubricScore, so no CLI change is needed.Testing Plan
Unit Tests:
New tests:
test_final_response_match_v2.py:_parse_reasoningacross judge output shapes (fenced JSON, list value, escaped characters, raw newline, missing/empty); reasoning kept when the label can't be parsed; and an end-to-endevaluate_invocationstest with 3 samples (1 valid, 2 invalid). It checks that the returned reasoning comes from the winning invalid sample.test_hallucinations_v1.py: per-sentence rationales throughevaluate_invocationswith a scripted judge; no rubric scores for an unscored response; scored responses' rubric scores kept in order when another response in the invocation can't be scored.The new behavior tests fail on
mainand pass with this change.Manual End-to-End (E2E) Tests:
Ran the reproduction script from #8184. It registers a scripted judge through
LLMRegistry, so it needs no network or credentials.Before (
main):After:
Checklist
Additional context
hallucinations_v1code to addRubricScore(rubric_id="error")for responses that can't be scored. The two changes are complementary: this PR covers responses that were scored, fix(eval): retry unscored hallucinations_v1 judge outcomes #8122 covers those that weren't. Whichever merges second needs a small mechanical rebase:_evaluate_nl_responsenow returns a third value, so fix(eval): retry unscored hallucinations_v1 judge outcomes #8122's retry loop and its test mocks need to handle it.rubric_idvalues were chosen so--print_detailed_resultsoutput reads well, since it prints therubric_idas the label when there's no rubric text. The Vertex facade does the same, using the rubric description as the id.