feat(scorers): align remote delegated scorer signatures with native comparators - #590
Open
saurabh-net wants to merge 10 commits into
Open
feat(scorers): align remote delegated scorer signatures with native comparators#590saurabh-net wants to merge 10 commits into
saurabh-net wants to merge 10 commits into
Conversation
saurabh-net
requested review from
IsmailMehdi,
helloeve and
prernakakkar-google
as code owners
September 4, 2026 11:25
…omparators Align the remote delegated scorer wire protocol and Python proxy with EvalBench's native in-process Comparator signature: - Input parity: Pass full evaluation context (prompt, golden/generated outputs, eval results, database, scenario ID) via ScoringContext on ScoringRequest. - Output parity: Return a flat repeated MetricScore list on ScoringResponse, allowing remote scorers to return either a single metric (score, logs) or multiple metrics [(metric_name, score, logs), ...]. - Add comprehensive unit tests for single-score, multi-score, and timeout handling.
saurabh-net
force-pushed
the
feat/delegated-scoring-context
branch
from
September 4, 2026 11:27
541090e to
675963d
Compare
…core vs MultiScore
…ated runtime type test
Collaborator
|
/gcbrun |
prernakakkar-google
approved these changes
Sep 7, 2026
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.
Context & Problem
This PR refactors delegated remote scoring proxying to ensure strict protocol parity with EvalBench's native
Comparator.compare(...)signature:Protocol Symmetry with
Comparator.compare()return type:Native comparators return either a single score tuple
(score, logs)or a list of sub-metric tuples[(metric_name, score, logs), ...]. We represent this in Protobuf using a cleanoneof result:Direct Parameter Passing in
ScoringContext:Parameters are mapped directly to
ScoringContextfields (nl_prompt,golden_query,query_type,golden_result,golden_eval_results,golden_error,generated_query,generated_result,eval_results,generated_error,database). Parameter names inRemoteScorerProxy.compareare aligned with theComparatorbase class (golden_query,generated_query), with backward-compatible keyword fallbacks forgolden_sql/generated_sql,golden_execution_result/generated_execution_result, andgolden_eval_result/generated_eval_result.Important Note on Runtime Types in EvalBench Runners:
While
Comparator.comparehints string types, EvalBench runners do not strictly enforce strings at runtime across all evaluation modes.Specifically, in agent evaluations (
evalbench/work/agentscorework.pyandtrajectorymatcher.py):generated_resultis passed as a raw Pythonlist(accumulated tool call records:['tool_a', ...]).eval_resultsis passed as a raw Pythondict(self.eval_output).generated_erroris passed asNone.Because Google Protobuf string fields require
strorbytesand raise aTypeErrorif passed alist,dict, orNone,RemoteScorerProxydefensively converts non-string inputs using a dedicated module-level_to_strhelper (JSON-serializing lists and dicts, and mappingNoneto"") before packing them intoScoringContext. Remote scorers can parse these fields back withjson.loads()when evaluating structured tool trajectories or turn outputs.Changes
evalbench/evalproto/eval_agent.proto: AddedSingleScore,MetricScore,MultiScore, andoneof resultinsideScoringResponse. UpdatedScoringContextwith direct parameter fields.evalbench/scorers/remote_scorer.py: Aligned parameter names withComparatorbase class, added keyword aliases, unpackedSingleScoreandMultiScore, and extracted defensive string coercion into a module-level_to_strhelper.evalbench/test/agent_grpc_proxy_test.py: Added tests forSingleScore,MultiScore, timeout, direct_to_strhelper unit tests, and end-to-end verification of non-string runtime type coercion (test_remote_scorer_runtime_type_coercion).evalbench/test/agent_grpc_proxy_integration_test.py: Verified multi-turn and concurrent sessions with delegated scoring.Verification
pytest evalbench/test/agent_grpc_proxy_test.py evalbench/test/agent_grpc_proxy_integration_test.py(10 passed in 9.2s).pycodestyleclean (0 errors).