Repository navigation
Conversation
…'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]>
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]>
yaoyu-33
left a comment
There was a problem hiding this comment.
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": |
There was a problem hiding this comment.
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?
…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]>
|
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? |
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
yaoyu-33
left a comment
There was a problem hiding this comment.
LGTM. The component lock checks against current main with uv 0.13.4, and all 82 rubric server tests passed.
|
/ok to test 19de48c |
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]>
Signed-off-by: svcnemo-autobot <[email protected]>
|
/ok to test a071ed8 |
|
This landed in main as part of #6315, closing. |
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.
task_data.py): criteria withrequirementandweight_pointsthat add up to 100 (partial creditallowed), and optional contradictions with
penalty_pointsandscore_cap_points. Other keys (credit guidance,acceptable variants, evidence, an answer policy) reach the judge unchanged.
rubric.py): a system message and one user message with the grading instructions and a JSON objectholding 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.
rubric's penalties and caps, total = points - penalties, capped and clamped to [0, 100]); the reward is total / 100.
judge_model_server(
openai_modelwithjudge_base_url/judge_api_key/judge_model_name), called throughcall_judgewithresponse_formatset per request, as invideo_caption. A rejected judgment, a timeout and a 408/429/5xx reply areretried up to
judge_max_attempts; then Gym's judge failsafe masks the row and keeps the answer for judge-onlyrecovery. Other 4xx replies are not retried.
graded;empty_answer(0, orempty_answer_rewardin training);execution_failure(a single-turn toolcall or a failed agent run, 0);
infrastructure_failure(masked). An empty response stays at exactly 0, asverify_agent_responserequires forexecution_failure_reward_zero.mean/rubric_scoreandmean/reward, plusfull_score_rate,at_least_0.8_rateand outcome counts.configs/video_qa_rubric.yaml: single-turn (simple_agent, one model call,single_agent_turn_legacy) with thejudge model server. The same server grades
setting: agenticrows when an agent harness is bound to it.task.prepare_single_turnbuilds rows;data/example.jsonlhas five invented questions and rubrics on video_mcqa'ssynthetic clips. README covers the row format, grading, judge setup and the NeMo RL configuration.
final_answer_text(the answer after any reasoning block) becomes public so both serversread final answers the same way; its behavior is unchanged.
Why
Video RL needs open-ended questions next to the multiple-choice ones
video_mcqacovers (#6071). No server in maingrades this rubric format:
healthbench_rubricasks one met/not-met question per criterion,multichallengeusesyes/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 tovideo_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 ownvenv, as
gym env test --resources-server video_qa_rubricruns 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, rowschema, examples and config wiring.
final_answer_text, the same way:video_mcqa257 passed and 118 subtests,videomme_v2136,
videomme_v11,lvbench1; each one's example data validated.vllm_modelandopenai_modelagainst a loopback stub (no model), with therenamed 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.
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 --checkfor the component: pass (itslock and pyproject equal video_mcqa's apart from the project name).
gym env resolveandgym env validateofconfigs/video_qa_rubric.yaml: no invalid or unchecked server config.Rollouts
data/example_rollouts.jsonl: one rollout per example row fromnvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16(BF16, one GPU) served by vLLM
0.32.0rc1.dev190+g3f1bcfd82with the model card's video settings and the model'sdefault sampling, through the stock
vllm_modeland the committed config. To fit one GPU, the same served model wasalso the judge through the config's
openai_modeljudge server (max_completion_tokens16,384); the README says atraining 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.
mean/rubric_score0.72,full_score_rate0.6. All 11 model requests returned 200 (5 policy, 5 judge, 1 directjudge 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_textis renamed to the publicfinal_answer_textwith no other change.Generated with Claude Code