Skip to content

fix(metadata): read behavior protocol from the response - #222

Merged
KartikP merged 4 commits into
unified-model-interface-v2from
fix/score-protocol-from-response
Nov 9, 2026
Merged

KartikP merged 4 commits into
unified-model-interface-v2from
fix/score-protocol-from-response

Conversation

@KartikP

@KartikP KartikP commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

The behavioral protocol stamp read the private _use_generation_for_task flag. A subject that is not a BrainScoreModel but answers by generation was stamped behavior:readout (Contract Rule 2.2).

Changes:

  • New record_measures() context collects attrs['measure'] of each behavioral response at the point where a session accepts it (respond/emit of BufferedSession and the three perception sessions). Events no session accepted are not recorded. A nested record passes its measures to the outer record; a failed inner record passes nothing.
  • infer_score_protocol and stamp_score_metadata take the record. The protocol and a new optional attrs['measure'] score field come from it. Likelihood answers are stamped behavior:likelihood. With no record the old default stamp is kept.

The score() callers in vision, language and unified open the record in follow-up PRs, which pin this commit.

Evidence: tests/test_score_metadata.py (+30 cases: direct sessions, typed response tasks, mixed collections, nested and failed records, unaccepted events).

The behavioral protocol stamp read the private _use_generation_for_task
flag, so a subject that is not a BrainScoreModel but answers by
generation was stamped behavior:readout (Contract Rule 2.2).

record_measures() now collects attrs['measure'] of each behavioral
response core hands to a benchmark (legacy facade, behavioral_response,
BrainScoreModel.process). The protocol and a new optional
attrs['measure'] score field come from that record. Likelihood answers
are stamped behavior:likelihood, not readout. With no record the old
default stamp is kept.
Note the measure of each behavior StreamEvent when it is created, so
direct sessions, typed response tasks and mixed collections are all
recorded before any session concatenates payloads. The facade and
behavioral_response notes are now redundant and removed. A nested
record passes its measures to the outer record. Measures made in a
worker thread or process are not recorded; no behavioral path does
that today.
The StreamEvent constructor hook also noted events no session accepted
(decoded run records, fixtures, copies) and missed events made before
the run and sent during it. note_response now runs in respond/emit of
BufferedSession and the three perception sessions. A failed inner
record passes nothing to the outer record.
@KartikP
KartikP force-pushed the fix/score-protocol-from-response branch from beafe4b to 34bf12c Compare November 9, 2026 18:57
@KartikP
KartikP merged commit fdeb451 into unified-model-interface-v2 Nov 9, 2026
8 checks passed
KartikP added a commit to brain-score/vision that referenced this pull request Nov 10, 2026
`score()` read the behavior protocol from the subject's private state,
so a subject that is not a BrainScoreModel but answers by generation was
stamped behavior:readout (Contract Rule 2.2).

Changes:
- `score()` opens core's `record_measures()` around the benchmark run
and passes the record to `infer_score_protocol` and
`stamp_score_metadata`. The protocol and the optional `attrs['measure']`
come from the responses the subject returned.
- A core without `record_measures` raises an ImportError that names the
required revision.
- `requirements-v2.txt` pins core to fdeb451 (brain-score/core#222,
which adds `record_measures`; it also contains #221).

Evidence: new tests in tests/test_preflight.py send a real behavior
StreamEvent into a BufferedSession and check the stamp. Core #222 passed
its full CI, including the vision, language and unified offline suites.
KartikP added a commit to brain-score/language that referenced this pull request Nov 10, 2026
`score()` read the behavior protocol from the subject's private state,
so a subject that is not a BrainScoreModel but answers by generation was
stamped behavior:readout (Contract Rule 2.2).

Changes:
- `score()` opens core's `record_measures()` around the benchmark run
and passes the record to `infer_score_protocol` and
`stamp_score_metadata`. The protocol and the optional `attrs['measure']`
come from the responses the subject returned.
- A core without `record_measures` raises an ImportError that names the
required revision.
- `requirements-v2.txt` pins core to fdeb451 (brain-score/core#222,
which adds `record_measures`; it also contains #221).

Evidence: new tests in tests/test_preflight.py send a real behavior
StreamEvent into a BufferedSession and check the stamp. Core #222 passed
its full CI, including the vision, language and unified offline suites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant