Skip to content

[StirrupAgent] Add structured rubric scoring mode - #1222

Closed
Kh4L wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
Kh4L:gdpval-structured-rubric-mode
Closed

Kh4L wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
Kh4L:gdpval-structured-rubric-mode

Conversation

@Kh4L

@Kh4L Kh4L commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in structured rubric scoring backend on the GDPVal resources server, alongside the existing binary (default) backend. score_with_rubric_structured already lived in scoring.py but wasn't reachable from a config; this PR wires the dispatch.

Why

The current binary rubric path has two failure modes on rubrics with many criteria and per-criterion point weights:

  1. Reward magnitude is wrong when the rubric carries integer point weights (rubric_json[i].score / rubric_json[i].weight). The binary judge emits score: 0|1 per criterion and averages, treating +5 and +1 criteria the same.
  2. Output truncation. Multi-criterion rubrics with detailed JSON rationale strings push the judge response past max_tokens, producing partial JSON and the regex-fallback partial-score path. Observed up to 25% invalid_judge_response rate on heavy rubrics.

The structured path replaces the JSON-with-rationale output with a tagged CRITERION_NUMBER[N]: GRADE[X] out of MAX_POSSIBLE_POINTS[Y] format and FINAL_SCORE[…] / MAX_POSSIBLE_SCORE[…] at the end. Reward = FINAL_SCORE / MAX_POSSIBLE_SCORE, multi-trial averaged.

On a 10-task pipecleaning run on a heavy-rubric dataset:

Mode mean/reward invalid_judge_response
binary (default) 0.652 25%
structured 0.733 0%

Reward distribution went from clustered around 0.6 (regex fallback noise) to a clean 0.47–1.00 spread, with the harder tasks correctly scoring lower.

What changed

  • GDPValResourcesServerConfig: new rubric_scoring_mode: Literal[\"binary\", \"structured\"] = \"binary\" (default keeps existing behavior). rubric_structured_num_trials (default 2) and rubric_structured_formatting_retries (default 3) tune the structured path.
  • GDPValResourcesServer._verify_rubric: dispatches to score_with_rubric_structured when rubric_scoring_mode == \"structured\". Existing score_with_rubric / score_with_rubric_visual paths are unchanged for the default binary mode.
  • score_with_rubric_structured: max_possible now reads either score or weight per criterion (different upstream rubric formats use different field names), so multiple sources can mix in the same training run without per-source pre-processing.

Compatibility

  • rubric_scoring_mode defaults to binary. Existing benchmark configs (benchmarks/gdpval/config.yaml, etc.) get exactly the same behavior they have today — no opt-out needed.
  • For datasets with no per-criterion weights, the structured path falls back to MAX_POSSIBLE_POINTS=1 per criterion, so reward is equivalent to binary in that case.

Test plan

  • 10-task pipecleaning run on a weighted-rubric dataset (binary 0.65 / 25% invalid → structured 0.73 / 0% invalid).
  • CI green.

@copy-pr-bot

copy-pr-bot Bot commented May 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Kh4L Kh4L changed the title [GDPVal] Add structured rubric scoring mode [StirrupAgent] Add structured rubric scoring mode May 2, 2026

@agronskiy agronskiy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

agronskiy pushed a commit that referenced this pull request May 4, 2026
## Summary

Adds a config flag `persist_raw_judge_responses: bool = False` on
`GDPValResourcesServerConfig`. When True, the raw judge completion text
from every trial is preserved on `verify_response.judge_response`:

- **Comparison mode** — under
`judge_response.per_ref_repeat[i].raw_responses: list[str]` (one per
trial, ordered by trial index; trial `i` was swapped iff `i % 2 != 0`).
- **Rubric modes** (binary / visual / structured) — under top-level
`judge_response.raw_responses: list[str]`.

Off by default. Raw responses are 10–50 KB × `num_trials` ×
`num_ref_repeats` × `num_tasks`, so always-on would meaningfully bloat
rollout JSONLs and W&B uploads. Turn on for debug runs to post-mortem
judge verdicts (e.g. understanding why a comparison-mode run lost 87% of
pairwise comparisons).

## Why

When a comparison-mode or rubric run produces unexpected scores, the
only persisted signal today is parsed counts/numbers — the judge's
actual rationale, criterion-by-criterion grades, and verdict text are
fetched and discarded. With this flag, those raw strings survive into
the rollout JSONL so post-mortem analysis is possible without
re-running.

## Dependency

The structured-rubric scorer modified here is added by #1222. Until
#1222 lands, this PR's diff includes its commit; after #1222 merges, a
rebase against main auto-drops the duplicate (patch-id match).

## Test plan

- [x] Unit tests added: `test_persist_raw_judge_responses_comparison`,
`test_persist_raw_judge_responses_rubric` — verify both modes pass the
flag through to the underlying scorers and that returned raw text
appears in the response.
- [ ] Smoke run on a small AfterQuery sample with the flag on, inspect
resulting JSONL for `raw_responses` field shape (in flight on HSG).

## Replaces #1224

Supersedes draft #1224 which carried 9 commits / 826 lines from a stale
Kh4L:dev stack (5 already-merged-to-main with different SHAs). Closing
that one.

---------

Signed-off-by: Serge Panev <[email protected]>
Signed-off-by: Alex Gronskiy <[email protected]>
@Kh4L Kh4L closed this May 4, 2026
@Kh4L

Kh4L commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

The changes were merged in #1225

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.

2 participants