Typed criterion verdicts on grading results#487
Open
solvemproblr wants to merge 2 commits into
Open
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
b466085 to
7b940cc
Compare
7b940cc to
165a89d
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.
Problem
Grading results lost most of their structure on the way to the trace:
LLMJudgeGrader's per-criterion verdicts lived inSubScore.metadata(excluded from serialization), so the trace viewer showed rubric results as an untyped JSON blob at best.combine_any/combine_allcollapsed their inputs into a single subscore, stashing input names and metadata in ametadatadict and flattening criteria into one list — the grading history was unrecoverable.SubScore.metadatadidn't serialize,combine()copied it intoEvaluationResult.infokeyed by subscore name — a second untyped side-channel.Solution
Make
SubScorea tree node and type the rubric verdicts:CriterionResult— one checked requirement withpassed,weight,reason. Lives onSubScore.criteria, so verdicts ride with the grader that produced them.SubScore.children+SubScore.aggregation—combine_any/combine_allnow return a node withaggregation: "any" | "all"and their inputs preserved verbatim aschildren(names deduped per sibling group). Combinators nest, so arbitrary grading trees serialize whole. A validator rejects aggregation without children and warns when the value disagrees withmax/minof the children.SubScore.metadataserializes — theEvaluationResult.infocopy and the combinator metadata blobs are gone; each node carries its own details.Grader.compute_scorereturnsfloat | SubScore— replaces the(float, metadata_dict)tuple and the magicmetadata["criteria"]key.grade()stampsname/weight/_parametersonto the result;LLMJudgeGraderandBashGraderbuild theirSubScoredirectly.Outcome
EvaluationResult.subscoresis now a recursive structure carrying every grader run, its criteria, its metadata, and how values were combined.Note
Medium Risk
Public grader API changes (tuple returns and
EvaluationResult.infometadata side-channel removed) may break custom graders or trace consumers; scope is evaluation/serialization only, not auth or data paths.Overview
Grading outputs are now a serializable tree instead of flattened metadata blobs, so traces can show rubric verdicts and how subscores were combined.
CriterionResultis exported and attached onSubScore.criteria.LLMJudgeGraderemits one per rubric line (withpassed,weight,reason) instead of stuffing verdicts into excludedmetadata.SubScoregainschildrenandaggregation("any"/"all").combine_any/combine_allkeep their inputs as child nodes (with deduped names) rather than collapsing intometadatadicts. A validator requireschildrenwhenaggregationis set and warns ifvaluedisagrees with min/max of children.combineno longer copies per-subscore metadata intoEvaluationResult.info; metadata stays on each subscore and serializes with the breakdown (previouslymetadatawas excluded from dumps).Grader.compute_scorenow returnsfloat | SubScore(the(float, metadata_dict)tuple is removed).grade()wraps floats or stampsname/weight/_parametersonto a returnedSubScore.BashGraderfollows the sameSubScore-first shape.Docs in
graders.mdxdocumentCriterionResultand the tree fields.Reviewed by Cursor Bugbot for commit 165a89d. Bugbot is set up for automated code reviews on this repo. Configure here.