feat: support overridable default grader models #6678
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.57) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #6678"
general
weight: 0.35
tonydzi
Problem or current behavior
Evaluation authors need to provide a default grader while allowing runners to replace it with another model or a panel. Today, preserving both the fallback and supporting a panel of grader models passed via
model_rolesrequires a wrapper around the built-in scorer:The shorter alternatives have different behavior:
model="openai/gpt-4.1"overrides the runner's grader role.get_model(role="grader", default=...)selects only the first model of a bound panel, bypassing the built-in scorer's panel reduction.Task(model_roles={"grader": "openai/gpt-4.1"})constructs the default provider when the task is constructed. A runner intending to use another provider can encounter a missing OpenAI/Anthropic SDK or credential error before its override is applied.This follows the downstream problem documented in inspect_evals #2867: resolving the grader role before a built-in scorer collapses a bound panel.
Result or new behavior
The same default grader can be declared directly:
Both
model_graded_qa()andmodel_graded_fact()resolve this default at scoring time, only when the role is unbound. A runner can supply a single grader or a complete panel without installing or configuring the unused default provider. The scorer retains its existing reducer and resolves the role again when reused in another evaluation context.For a default with generation settings, a base URL or provider arguments,
defaultalso acceptsModelConfig:Those settings apply to the fallback only. Runner-supplied graders keep their own settings. An unavailable default provider raises its normal error when that default is needed.
Both built-in scorers use the standard
@scorerdecorator. Dictionary role specifications are normalized for logging during registry argument capture, so they useModelRole's credential filtering without changing the factory's runtime arguments. Conversion recognizes resolvedModelRoleannotations, optionally combined withstrorNone; unrelated dictionaries and string annotations keep their existing behavior.Compatibility and migration
No migration required. Existing
model=precedence, role bindings, panel reducers and behavior without a default remain unchanged.get_model()and task-level role binding are unchanged.The new field is stored in scorer options so saved logs can reconstruct the grader. Existing roles without defaults retain their serialized shape; reconstructing scorers that use the new field requires a version supporting it. Configured defaults filter API keys,
aws_*arguments and iterators using the existing model-log policy. Runtime credentials remain available to the provider, while rescoring obtains credentials from its runtime environment. Built-in scorer dictionary specifications receive the same filtering during registry argument capture asModelRoleobjects.Draft API choice:
required=Truecannot be combined with a default, preservingModelRole.required's documented requirement for a role binding.get_model()currently permits that combination, so matching its convention is an alternative for review. Defaults accept model names orModelConfig; constructed models and default panels are outside this change's scope.Validation
The regression test simulates an unavailable OpenAI SDK. Eager task-role defaults raise the dependency error; both built-in scorers with deferred defaults still grade using scalar or panel overrides, and raise only when the OpenAI default is needed. Tests also exercise saved-log rescoring, configuration isolation and credential filtering through keyword, positional and reconstructed scorer inputs.
uv run --no-sync make checkpasses.uv run --no-sync pytest tests/util/test_registry.py tests/scorer tests/model/test_model_roles.py tests/_eval/test_score.py -q --tb=short --color=no: 1,137 passed, 312 gated cases skipped. The added registry cases check argument preservation, unrelated dictionary unions and file-defined factories with postponed annotations.PYTEST_ADDOPTS='-n 8 --tb=short --color=no --maxfail=1' uv run --no-sync make test) stopped with 23,186 passed, 12,593 skipped and two terminal-display failures:tests/sentinel/test_sentinel_human.py::test_no_call_can_hide_or_pass_for_anotherandtests/test_eval.py::test_display_type_change_inside_screen_keeps_terminal_cleanup[plain]. Both reproduce on a clean checkout of upstream base8012060c0with the same environment. The baseline probes failed all three selected sentinel variants and the display-cleanup case. The local full suite is not reported as passing.Slow tests
uv run --no-sync pytest tests/scorer/test_model_graded.py --runtrio -q --tb=short --color=no: 18 passed, 282 skipped because this invocation selects only Trio variants.Agent review
Authored with Codex. Two fresh-context reviews by separate Codex agents (GPT-6 family; exact variant unavailable), each followed by verification in the reviewer's existing context.
@scorerdecorators. It found three compatibility regressions in the initial annotation handling: file-defined factories absent fromsys.modules, unrelated postponed annotations, and unions accepting ordinary dictionaries. Removing string-annotation resolution and restricting conversion to unambiguous role types addressed all three, with regression coverage. Follow-up review found no remaining issues.