Skip to content

feat(video-qa-rubric): open-ended video QA graded against each question's rubric - #6314

Closed
cg1177 wants to merge 10 commits into
NVIDIA-NeMo:mainfrom
cg1177:guoc/video-qa-rubric
Closed

cg1177 wants to merge 10 commits into
NVIDIA-NeMo:mainfrom
cg1177:guoc/video-qa-rubric

Conversation

@cg1177

@cg1177 cg1177 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What

A new resources server, resources_servers/video_qa_rubric, for RL training on open-ended questions about a video.
The policy sees the video and the question and writes a free-text answer; a judge model grades the final answer
against the question's own weighted-points rubric, and the reward is the rubric score from 0 to 1.

  • Rubric format (task_data.py): criteria with requirement and weight_points that add up to 100 (partial credit
    allowed), and optional contradictions with penalty_points and score_cap_points. Other keys (credit guidance,
    acceptable variants, evidence, an answer policy) reach the judge unchanged.
  • Judge request (rubric.py): a system message and one user message with the grading instructions and a JSON object
    holding the question, the rubric and the final answer. The judge never sees the video, the policy's reasoning or a
    reference answer. Its reply follows a strict JSON schema: points per criterion, applied contradictions, total.
  • The server accepts a judgment only when its arithmetic holds (every criterion once, points within the weights, the
    rubric's penalties and caps, total = points - penalties, capped and clamped to [0, 100]); the reward is total / 100.
  • Judge = any OpenAI-compatible chat model with JSON-schema structured output, behind judge_model_server
    (openai_model with judge_base_url / judge_api_key / judge_model_name), called through call_judge with
    response_format set per request, as in video_caption. A rejected judgment, a timeout and a 408/429/5xx reply are
    retried up to judge_max_attempts; then Gym's judge failsafe masks the row and keeps the answer for judge-only
    recovery. Other 4xx replies are not retried.
  • Outcomes: graded; empty_answer (0, or empty_answer_reward in training); execution_failure (a single-turn tool
    call or a failed agent run, 0); infrastructure_failure (masked). An empty response stays at exactly 0, as
    verify_agent_response requires for execution_failure_reward_zero.
  • Metrics: Gym's mean/rubric_score and mean/reward, plus full_score_rate, at_least_0.8_rate and outcome counts.
  • configs/video_qa_rubric.yaml: single-turn (simple_agent, one model call, single_agent_turn_legacy) with the
    judge model server. The same server grades setting: agentic rows when an agent harness is bound to it.
  • task.prepare_single_turn builds rows; data/example.jsonl has five invented questions and rubrics on video_mcqa's
    synthetic clips. README covers the row format, grading, judge setup and the NeMo RL configuration.
  • Shared code: video_mcqa's final_answer_text (the answer after any reasoning block) becomes public so both servers
    read final answers the same way; its behavior is unchanged.

Why

Video RL needs open-ended questions next to the multiple-choice ones video_mcqa covers (#6071). No server in main
grades this rubric format: healthbench_rubric asks one met/not-met question per criterion, multichallenge uses
yes/no rubric questions, and FrontierScience research mode reads one total. No issue: this adds a new environment.

Validation

The branch's first three commits use the working name openqa_rubric; the fourth renames it to video_qa_rubric
(names only; what the judge receives does not change) and the fifth moves one test import to its current path. At the
head (b8f229e99bb2eb008132db7a2c514ed341fa642c):

  • ng_test +entrypoint=resources_servers/video_qa_rubric +should_validate_data=true (the server's tests in its own
    venv, as gym env test --resources-server video_qa_rubric runs them, and its example data validated): 76 passed.
    The tests use a scripted judge behind a mocked server client and the real call_judge: request contents,
    arithmetic accept/reject, retries and their limits, the failsafe route, grading observation binding,
    empty/execution/infrastructure outcomes, replay of a failed agent run through verify_agent_response, metrics, row
    schema, examples and config wiring.
  • The servers that share final_answer_text, the same way: video_mcqa 257 passed and 118 subtests, videomme_v2
    136, videomme_v1 1, lvbench 1; each one's example data validated.
  • Local pipeline smoke with stock vllm_model and openai_model against a loopback stub (no model), with the
    renamed config and agent: five rows with full credit, half credit, a rejected-then-accepted judgment, an empty
    answer, and a judge failure masked into the failures file and judged again by Gym; the 10 judge requests carried
    only the system and user messages and the strict schema.
  • Core unit tests (scripts/ci/core_unit_tests.sh, unsharded): 22,963 passed, 108 skipped, 343 subtests, 0 failed.
  • pre-commit run --all-files: pass, no changes. scripts/component_locks.py: 320 projects, 0 failed.
    scripts/migrate_imports.py --check resources_servers/video_qa_rubric: clean. CI's secrets-detector command
    (detect-secrets with the CI baseline) on the 19 changed files: pass. uv lock --check for the component: pass (its
    lock and pyproject equal video_mcqa's apart from the project name). gym env resolve and gym env validate of
    configs/video_qa_rubric.yaml: no invalid or unchecked server config.

Rollouts

data/example_rollouts.jsonl: one rollout per example row from nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16
(BF16, one GPU) served by vLLM 0.32.0rc1.dev190+g3f1bcfd82 with the model card's video settings and the model's
default sampling, through the stock vllm_model and the committed config. To fit one GPU, the same served model was
also the judge through the config's openai_model judge server (max_completion_tokens 16,384); the README says a
training run should use a separate judge. The rollouts were recorded before the rename, which changed only the task
IDs and the agent and environment names in the file.

Row Final answer (shortened) Outcome Reward
square "An orange rectangle ... moves from the left to the right." graded: direction 60/60, square 0/40 0.6
background "The background is a solid blue color, and a yellow diamond moves from the left side to the right side." graded 1.0
dots "There is 1 red dot in the video." graded 1.0
bar "The green bar moves downwards." graded; the first judgment failed the arithmetic check, the second passed 1.0
counter none: 16,384 output tokens of reasoning empty_answer, no judge call 0.0

mean/rubric_score 0.72, full_score_rate 0.6. All 11 model requests returned 200 (5 policy, 5 judge, 1 direct
judge request with the same messages and schema, which returned valid strict JSON in 3.2 s). What the judge receives
(the system and user messages and the schema, never the video or the policy's reasoning) is checked by the unit tests
and by the request log of the local stub smoke.

Compatibility

New server; video_mcqa's private _final_text is renamed to the public final_answer_text with no other change.

Generated with Claude Code

cg1177 and others added 5 commits November 17, 2026 18:47
…'s rubric

A resources server for open-ended questions about a video, for RL training. The policy sees the video and the
question; a judge model grades the final answer against the question's weighted-points rubric (criteria worth
weight_points that add up to 100, and contradictions with a penalty and a score cap). The judge gets the question,
the rubric and the final answer (no video, reasoning or reference answer) and returns a strict-JSON judgment; the
server accepts it only when its points, applied contradictions and total add up, and the reward is the score / 100.

The judge is any OpenAI-compatible chat model with JSON-schema structured output behind a judge ModelServerRef
(judge_base_url, judge_api_key, judge_model_name), called through call_judge. A rejected judgment, a timeout and a
408/429/5xx reply are tried again up to judge_max_attempts; when every attempt fails, Gym's judge failsafe masks the
row and keeps the answer for judge-only recovery. A failed model call is a masked infrastructure failure; a
single-turn tool call or a failed agent run is an execution failure worth 0. empty_answer_reward (training only)
sets the reward of an attempt that produced output but no final answer; an empty response stays 0, as Gym's agents
require for execution_failure_reward_zero.

Single-turn config (simple_agent, single_agent_turn_legacy) with five invented example rows on video_mcqa's
synthetic clips, task_data schema, prepare_single_turn, README with the RL setup, tests with a scripted judge, and
the component lock. video_mcqa's final_answer_text (the answer after any reasoning block) is now public so this
server shares it.

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
One rollout per example row from nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16 on one GPU (vLLM
0.32.0rc1.dev190+g3f1bcfd82, the model card's video settings, default sampling), the same served model also judging
for this example only. Three answers earn full points, one earns 60 of 100 (the direction but not the square), and on
the counter the model runs out of output tokens (empty_answer, 0); the bar's first judgment was rejected by the
arithmetic check and the second accepted. example_metrics.json from gym dataset collate (example_validation). The
README records the commands. A failed judge attempt is now logged with its reason, never the answer.

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The policy's model server reads the video URL: http(s) and data URLs, or a file:// URL the server may read (vLLM's
--allowed-local-media-path). A vLLM-served judge works through the config's openai_model server, as in the example
rollouts.

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server grades open-ended questions about a video and builds on
video_mcqa (its row types, final-answer reading and example clips), so
its name now says so. Renamed: the folder resources_servers/
video_qa_rubric and configs/video_qa_rubric.yaml with the keys
video_qa_rubric, video_qa_rubric_judge, video_qa_rubric_single_turn and
video_qa_rubric_single_turn_environment; the VideoQARubric* classes;
the project gym-resources-servers-video-qa-rubric (uv.lock differs only
in that name); the failure kinds video_qa_rubric:*; the example task
IDs video_qa_rubric:example-N; the rows in README.md and the
environment list.

The example rollouts carry the renamed task IDs, agent and environment
names; the model's input and output, the judgments and the rewards are
unchanged. What the judge receives is unchanged too: the system and
user messages and the structured output's schema and its name.

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nemo_gym.config_types is the path from before 0.8.0; it still imports,
with a deprecation warning, until 0.10.0. Server tests import public
names from the package's public API, as scripts/migrate_imports.py
writes them (its --check is now clean for this server).

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 17, 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.

@cg1177 cg1177 changed the title Guoc/video qa rubric feat(video-qa-rubric): open-ended video QA graded against each question's rubric Nov 17, 2026
@cg1177

cg1177 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@yfw @yaoyu-33 could you take a look when you get a chance? This adds the open-ended video QA grader for our video RL data, next to video_mcqa from #6071. It also needs an /ok to test to start CI. Thanks!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer labels Nov 17, 2026
cg1177 added a commit to cg1177/Gym that referenced this pull request Nov 18, 2026
Brings in NVIDIA-NeMo#6314's head, which only merged main into it.

Signed-off-by: Guo Chen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 18, 2026

@yaoyu-33 yaoyu-33 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.

One reward case to fix in the opt-in training path.

for item in reversed(response.output):
if item.type == "message" and getattr(item, "role", None) == "assistant":
return final_answer_text("".join(part.text for part in item.content if part.type == "output_text"))
if last_item_only and item.type != "reasoning":

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.

With empty_answer_reward=-0.5, I got graded, 1.0 for [assistant_message, reasoning] because this loop graded the earlier message. In strict mode, could we check the final item directly so ending on reasoning gets the configured reward?

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 19, 2026
…reward only rewards no answer

With empty_answer_reward set, the answer also had to be the last thing the
model produced, and that rule missed a response ending on reasoning after
the answer: [answer, reasoning] graded the answer instead of giving the
configured reward. The rule is gone: the final answer is always the text
of the last assistant message after its reasoning, whatever comes after
it, as in video_mcqa. empty_answer_reward stays, as video_mcqa's option:
the reward of an attempt that produced output but no final answer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Guo Chen <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:high Autobot PR risk: high label Nov 19, 2026
@cg1177

cg1177 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, thanks. I took strict mode out in 10fbeaa: the final answer is always the last assistant message after its reasoning, whatever comes after it (same as video_mcqa), so [answer, reasoning] gets graded on the answer by design. empty_answer_reward stays, but now it only sets the reward when there is no final answer at all. Could you /ok to test 10fbeaa?

yaoyu-33
yaoyu-33 previously approved these changes Nov 20, 2026

@yaoyu-33 yaoyu-33 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. The component lock checks against current main with uv 0.13.4, and all 82 rubric server tests passed.

@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Nov 20, 2026
@cg1177

cg1177 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 19de48c

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 20, 2026 23:20
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 20, 2026 23:20
@github-actions

Copy link
Copy Markdown
Contributor

copy-pr-bot Bot pushed a commit that referenced this pull request Nov 21, 2026
Takes #6314's current head (its main merge and component lock refresh).
video_qa_rubric/uv.lock takes #6314's refreshed lock here; this branch
adds the sandbox extra to that server, so a later commit relocks it.

Signed-off-by: Guo Chen <[email protected]>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test a071ed8

@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:low Autobot PR risk: low and removed risk:high Autobot PR risk: high labels Nov 21, 2026
@cg1177

cg1177 commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

This landed in main as part of #6315, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work ready-to-merge PR is approved, current, and waiting for final CI or merge risk:low Autobot PR risk: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants