Repository navigation
fix(videomme_v2): let the questions of one group keep their own levels - #6290
Merged
athitten merged 1 commit intoNov 19, 2026
Merged
Conversation
The Video-MME-v2 annotation gives every question its own level; the first three questions of a logic group can have a level other than the group's last question. The official scorer counts per-level accuracy by each question's own level and scores a group under the level of its last question. validate_metric_cohort no longer requires every task level to equal its group's level. When a cohort lists task_levels, each group's level must be the level of its last question, /L<n>/raw_acc counts questions by their task level, /L<n>/nonlinear_score counts groups by the group level, and the verifier checks a result's level against its task level, so rows that carry their own question level are scored instead of refused. A cohort without task_levels behaves as before: each question takes its group's level. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
cg1177
added a commit
to cg1177/Gym
that referenced
this pull request
Nov 17, 2026
…eo-frames Brings in NVIDIA-NeMo#6290: the questions of one Video-MME v2 group keep their own levels, which the cohort of the agentic Video-MME v2 benchmark lists. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
cg1177
added a commit
to cg1177/Gym
that referenced
this pull request
Nov 17, 2026
…uthors' annotations benchmarks/videomme_v2_agentic and benchmarks/videomme_v1_agentic run the agentic configs of the videomme_v2 and videomme_v1 resources servers with judge-read answers. prepare.py downloads the authors' annotation at a pinned revision and checks its SHA-256 (VIDEOMME_V2_PARQUET / VIDEOMME_V1_PARQUET name a local copy), then binds each question to its video by the SHA-256 that the source directory's FILES.sha256 lists, reading no video; the resources server checks that hash in the sandbox. Rows ask in the benchmark's letter wording after a line that names the video in the sandbox, and a judge model (gpt-6.1-sol at max reasoning effort by default) reads the chosen option. Video-MME v2 rows keep each question's own level and the cohort groups the four questions of each video under the level of the fourth, which the videomme_v2 server accepts with the per-question levels merged from NVIDIA-NeMo#6290. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 17, 2026
yaoyu-33
approved these changes
Nov 19, 2026
yaoyu-33
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Per-question accuracy uses each question’s level, and the nonlinear group score uses the last question’s level, matching the upstream scorer.
Contributor
|
/ok to test 31eed13 |
athitten
enabled auto-merge
November 19, 2026 22:39
Contributor
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/44633263262 |
yaoyu-33
added a commit
to cg1177/Gym
that referenced
this pull request
Nov 21, 2026
…video QA on stock opencode_agent, with Video-MME v2 / Video-MME agentic benchmarks (NVIDIA-NeMo#6315) * refactor(video): import nemo_gym names from their public packages The four video servers and their tests imported the pre-0.8 module paths (nemo_gym.base_resources_server, config_types, global_config, openai_utils, server_utils), which still import with a deprecation warning. They now import each name from its package's public API, as scripts/migrate_imports.py writes it; `migrate_imports.py --check` reports nothing for these folders. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video): optional judge-model answer extraction for Video-MME v2, Video-MME and LVBench Add answer_policy llm_extraction_v1 to the shared video MCQA scoring. A judge model (any OpenAI-compatible chat model behind a Gym model server, called through call_judge on /v1/chat/completions) reads which option a final answer gives; the verifier scores that option against the gold label. The judge sees the prompt's text (no media) and the final answer (no reasoning), never the gold label. - A "none" reading is the new outcome no_choice (a measured zero); an empty final answer stays no_answer and is not sent. - A failed judge call or a reply that names no option raises a judge failure: Gym's judge failsafe masks the row and keeps it with its answer in the failures file, so the frozen cohort counts the task as missing until it is judged again. - The judged grading, verify response included, runs in observe_llm_judge_grading, so Gym binds the graded response and reward to the judge's reply. - The cohort declares the policy; a server whose cohort uses it refuses to start without judge_model_server. The rule policies stay the default and never call a judge. - prepare_single_turn and prepare.py take a prompt style: boxed (default) or the benchmark's bare-letter prompt (videomme_v2, videomme_v1, lvbench). - New configs <benchmark>_single_turn_llm_extraction.yaml for the three benchmarks: the single-turn config plus an openai_model judge (judge_base_url, judge_api_key, judge_model_name). Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video): sandbox image with frame-sampling video tools for OpenCode Adds resources_servers/video_mcqa/sandbox_image: a Dockerfile and the video tools it installs in /opt/video-mcqa. - video_tools.mjs: an OpenCode 1.17.11 plugin with watch_video and view_image. It runs `python3 -I -m video_tools.cli` once per call and returns the images as tool attachments. It also caps the tool images that one episode sends (400 MiB of base64 by default): from the result that would pass the cap on, results show a notice in place of their images, the same in every request. The tools take plain JSON Schema arguments, so the plugin imports only Node's standard library. - video_tools: watch_video samples the center of each of num_frames equal bins of [start, end), takes the latest source frame not after each sampling time, resizes by area to the requested long edge rounded down to the model's grid (patch_size / downsample_ratio, 28 px by default) and returns JPEG frames (quality 95, 4:4:4) with "This is a video:" and one "Frame i sampled at t seconds:" line per frame. Per-frame and per-call pixel caps refuse a request instead of shrinking it. view_image returns an image file unchanged. - Dockerfile: OpenCode 1.17.11 and its plugin dependencies with the pins of visual_coding_opencode, the static FFmpeg 7.0.2 build pinned by SHA-256, Python 3.13 with NumPy 2.4.6, Pillow 12.3.0 and Pydantic 2.13.5. Tests cover the sampling, rounding, limits and text, the decode (seek against the sequential reference), the program's JSON replies, and the plugin under Node with a stand-in program. video_mcqa's environment gains NumPy and Pillow for these tests, and Gym's sandbox extra for the lending that follows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video): agentic Video-MME v2, Video-MME and LVBench on stock opencode_agent Adds an agentic config to each of the three benchmarks. The stock opencode_agent runs each question through a single_agent_turn_legacy Environment Server, in a sandbox that the benchmark's resources server lends the episode, as visual_coding_opencode does. The sandbox image is video_mcqa/sandbox_image, and OpenCode loads its video tools plugin from there. video_mcqa/sandbox.py lends the sandbox for the video_mcqa and videomme_v2 servers (the videomme_v1 and lvbench servers inherit it). At each seed it: - refuses (422) a row whose video_binding.source is not a regular file under the configured video_roots; - starts the sandbox with the video tools' configuration (tools.json, from the server's video_tools settings) and two checksum lists; - uploads the video with nemo_gym.sandbox.upload_path; - runs one command in the sandbox: the image's video tools must have this repository's SHA-256 and the video the row's SHA-256 (422 otherwise), then the video becomes read-only and the tools check their configuration and FFmpeg. A command result with an error_type or the -1 sentinel, and any other failure, stops the sandbox and raises, so the Environment Server runs the episode again. The episode's close stops the sandbox. Grading never reads the sandbox. The verifiers read the stock agent's outcome: in the agentic setting a failed or incomplete response that reaches verify is an execution_failure scored 0, from the response's own status, so a replayed row scores the same. This replaces the video_execution_failure metadata key, which only the removed opencode_video_agent set. Single-turn scoring is unchanged. prepare.py names the video at --sandbox-root/sandbox_path (default /testbed) in agentic prompts. The three servers gain agentic example rows and cohorts, and their environments Gym's sandbox extra. READMEs describe the image, the tools, seeding, the single-upload size limit of the providers and the thinking switch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * docs(video): agentic example rollouts with Nemotron 3 Nano Omni One rollout per agentic example row of the VideoMME-v2, VideoMME-v1 and LVBench servers, from nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16 on one GPU (vLLM 0.32.0rc1.dev190) through the stock opencode_agent, with OpenSandbox sandboxes from the video MCQA sandbox image. The shared README gives the serving flags, the commands and the outcomes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(videomme_v2): let the questions of one group keep their own levels The Video-MME-v2 annotation gives every question its own level; the first three questions of a logic group can have a level other than the group's last question. The official scorer counts per-level accuracy by each question's own level and scores a group under the level of its last question. validate_metric_cohort no longer requires every task level to equal its group's level. When a cohort lists task_levels, each group's level must be the level of its last question, /L<n>/raw_acc counts questions by their task level, /L<n>/nonlinear_score counts groups by the group level, and the verifier checks a result's level against its task level, so rows that carry their own question level are scored instead of refused. A cohort without task_levels behaves as before: each question takes its group's level. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video): let the sandbox tools read OpenCode's temporary files; drawtext, ripgrep and ImageMagick in the image - view_image and watch_video also read regular files under video_tools.scratch_roots, by default /tmp/opencode: OpenCode's bash tool keeps temporary files there, such as frames or contact sheets the model made, and the tools refused them. A relative path still starts at the workspace, a symlink that leads out of these directories is refused, and the text names such a file by its absolute path. The tool descriptions are unchanged. - The image's FFmpeg 7.0.2 is now the static build of mwader/static-ffmpeg, pinned by image digest and by the binaries' SHA-256. watch_video gets the same frames as with the previous 7.0.2 build (identical JPEG bytes on 50 requests over 7 videos); the new build also has libharfbuzz and fontconfig, so the model's drawtext works, with fontconfig and DejaVu for its default font. - ImageMagick for the model's montage and convert, with the URW fonts its labels default to, one thread (MAGICK_THREAD_LIMIT=1). - ripgrep stays (OpenCode's grep and glob run it offline). The build checks drawtext, ripgrep and montage. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * revert(video): the video tools and sandbox image before the scratch-file change This reverts commit cc13a8f: view_image and watch_video read files under the workspace only, not OpenCode's /tmp/opencode; the image's FFmpeg 7.0.2 is the johnvansickle.com static build again, without drawtext; and the image has no ImageMagick. The tree is again the one of 2f336e9. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(openqa-rubric): open-ended video QA graded against each question'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]> * feat(video): judge-read answers for the agentic configs <benchmark>_agentic_llm_extraction.yaml, listed after <benchmark>_agentic.yaml, gives the agentic resources server the judge model of llm_extraction_v1. The judge server listens on 127.0.0.1: the lent sandbox may reach every port of the policy model server's host and must not reach a judge. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video): agentic rows with the benchmarks' own letter prompts prepare_agentic and prepare.py --prompt now write an agentic row in a benchmark's own letter wording: a first line that names the video in the sandbox (Video: /testbed/videos/<file>), then the single-turn letter prompt. Read its answers with llm_extraction_v1. The boxed prompt stays the default. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(openqa-rubric): example rollouts with Nemotron 3 Nano Omni 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]> * feat(video): agentic Video-MME v2 and Video-MME benchmarks from the authors' annotations benchmarks/videomme_v2_agentic and benchmarks/videomme_v1_agentic run the agentic configs of the videomme_v2 and videomme_v1 resources servers with judge-read answers. prepare.py downloads the authors' annotation at a pinned revision and checks its SHA-256 (VIDEOMME_V2_PARQUET / VIDEOMME_V1_PARQUET name a local copy), then binds each question to its video by the SHA-256 that the source directory's FILES.sha256 lists, reading no video; the resources server checks that hash in the sandbox. Rows ask in the benchmark's letter wording after a line that names the video in the sandbox, and a judge model (gpt-6.1-sol at max reasoning effort by default) reads the chosen option. Video-MME v2 rows keep each question's own level and the cohort groups the four questions of each video under the level of the fourth, which the videomme_v2 server accepts with the per-question levels merged from NVIDIA-NeMo#6290. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(openqa-rubric): which video URLs and vLLM judges work 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]> * refactor(video-qa-rubric): rename openqa_rubric to video_qa_rubric 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]> * test(video-qa-rubric): import DatasetConfig from nemo_gym.config 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]> * fix(video-qa-rubric): read failed agent runs from the response status, as video_mcqa does video_qa_rubric decided an agent run had failed from the video_execution_failure response metadata key, which only the removed opencode_video_agent set; this branch removed the key from video_mcqa, so video_qa_rubric could not even be imported here. It now uses video_mcqa's response_failure, like the Video-MME v2 server: in the agentic setting a failed or incomplete response that reaches verify is an execution_failure scored 0, read from the response's own status, so a replayed row scores the same. In the single-turn setting a failed model call stays a masked infrastructure_failure and a tool call an execution_failure; only the failure reasons now use video_mcqa's wording. The failed-run test covers failed and incomplete runs, and a new test checks that a failed model call is masked only in the single-turn setting. The README's outcome table says the same. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video_mcqa): the judge reads each row's question; question sets, frame rows, empty-answer reward Make video_mcqa the shared base that the video multiple-choice benchmarks and other question sets fill with data and configuration. - Each row's verifier_metadata keeps the question as asked: question (its text) and options (the option texts in label order). VerifierMetadata and the task-data schemas require both, and prepare_single_turn, prepare_agentic and prepare.py write them. A row without them is refused: rows prepared before this change are prepared again, and nothing falls back to the request. - The llm_extraction_v1 judge builds its prompt from those two fields and the final answer only. It no longer reads the text of the model's request (scoring.prompt_text is gone), so the video, its frames and anything else in the prompt never reach it. videomme_v2 uses the same judge path. - A cohort may be a question set instead of a benchmark (question_set.py, QuestionSetCohort): two to 26 options, task IDs outside the benchmarks' scopes, no level or group, accuracy under the set's name. A training set runs on the shared verifier this way. The VideoMME-v1 and LVBench servers refuse such a cohort. - prepare_single_turn(..., frames=[(label, image_url), ...]) and task.video_parts send a video as labelled frames (input_image parts) instead of one input_video part. - empty_answer_reward (unset by default, which scores 0): the reward of an attempt that produced output but no final answer, for example a training penalty. Accuracy still counts the attempt as no_answer. - The shared rows take any number of options; VideoMME-v1 and LVBench check their four choices in their own task_data.py. - configs/video_mcqa_single_turn_llm_extraction.yaml: the shared verifier with the answer judge. The committed example rows and rollouts gain the two fields; nothing else in them changes. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(video): the agentic example rows keep each question's text and options NVIDIA-NeMo#6238 makes every video_mcqa row keep the question as asked (question, and options in label order) in verifier_metadata. The agentic Video-MME v2, Video-MME and LVBench examples gain the two fields, rebuilt with prepare_agentic from the same questions; nothing else in the rows or in the recorded rollouts changes. The benchmark wrappers write them through prepare_agentic. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video-qa-rubric): agentic open-ended video questions with OpenCode and the video tools configs/video_qa_rubric_agentic.yaml runs video_qa_rubric's open-ended questions agentically, with the agent, sandbox image, video tools and sandbox settings of the agentic Video-MME v2, Video-MME and LVBench configs: the stock opencode_agent through a single_agent_turn_legacy Environment Server, a sandbox per episode that holds the row's video, and the rubric judge on 127.0.0.1 (the sandbox may reach every port of the policy model's host). - The resources server and its config take video_mcqa's VideoSandboxServer bases: with sandbox_provider set, each agentic episode's seed lends a sandbox with the row's video, checked by SHA-256; without it nothing changes. The sandbox extra joins the server's dependencies (uv.lock regenerated). - task.prepare_agentic(task_id, question, rubric, video_path=...) builds an agentic row's user turn (the question and the video's path in the sandbox, never the rubric); the row adds video_binding, which the task-data schema now declares. - data/example_agentic.jsonl: the five example questions and rubrics, each clip bound by path instead of inlined. - Tests: rows, bindings, the committed examples, the config against the agentic Video-MME v2 config, and the lent sandbox on the local provider. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * build(video-mcqa): sandbox image on the node:22 image the training data was generated in The agentic video training data was generated in the full node:22 Debian bookworm image (node@sha256:363e1587..., node 22.23.3) with the tools added at run time. The sandbox image now uses that image too, pinned by digest (the node:22.23.3-bookworm tag has been rebuilt since), so that evaluation and RL run in the same system: its shell, ImageMagick, git, compilers and other programs. The former final stage becomes the `tools` stage, unchanged apart from its base, which is now pinned by digest so that Python's files stay the same; the last stage copies its /usr/local (Python 3.13 with NumPy, Pillow and Pydantic, FFmpeg 7.0.2), /opt/opencode, /opt/video-mcqa and /usr/bin/rg into the node image as root-owned files, sets the same thread limits and locale, and makes /testbed and /testbed/work. The video tools, OpenCode and their pins are unchanged. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video-mcqa): agentic OpenCode keeps its own tools and runs sh, as in the training data The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric now run OpenCode's tools as the rollouts our agentic video training data came from did, so the model sees the same tools at evaluation and in RL: - No `tools` overrides: OpenCode offers its own tools, webfetch and task included, besides watch_video and view_image. webfetch fails in a sandbox that reaches only the model server, as it did then. OpenCode 1.17.11 offers websearch only with a search provider enabled, so it is not offered, as then. - The lent sandbox sets SHELL=/bin/sh (`sandbox_config.env`). OpenCode's shell tool runs commands with the shell SHELL names, bash when it is unset, and names that shell in the tool's description ("Shell: sh"). With these configs, the tools in the first request of an OpenCode 1.17.11 run in the sandbox image have the names, descriptions and parameters of the tool block of the training trajectories. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video-mcqa): agentic OpenCode ends a run on a third identical tool call, as in the training data The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric set OpenCode's doom_loop permission to ask, OpenCode's default and the setting of the rollouts our agentic video training data came from, instead of allow. OpenCode 1.17.11 asks for doom_loop when the last three parts of one model response are calls of the same tool with identical input. `opencode run` rejects every request that would ask, and this rejection ends the run without an answer, as it did when the training data was generated. With allow, the third call ran and the model went on. The same call repeated across separate responses does not reach that check, with either setting. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): the sandbox tools read OpenCode's temporary files; drawtext, montage and annotate work in the image - view_image and watch_video also read regular files under video_tools.scratch_roots, by default /tmp/opencode: OpenCode's bash tool keeps temporary files there, such as frames or contact sheets the model made, and the tools refused them. A relative path still starts at the workspace, a symlink that leads out of these directories is refused, and the text names such a file by its absolute path. The tool descriptions are unchanged. - FFmpeg 7.0.2 is now the static build of mwader/static-ffmpeg, pinned by image digest and by the binaries' SHA-256. watch_video gets the same frames as with the johnvansickle.com 7.0.2 build (identical JPEG bytes on 50 requests); the new build also has libharfbuzz and fontconfig, so the model's drawtext works, with the image's DejaVu font. - The image gets the URW fonts that ImageMagick's labels and annotations default to (Helvetica). Without them, montage and convert -annotate abort in the node:22 image. - The build checks drawtext, ripgrep, montage with a label and convert -annotate. The tool code is that of cc13a8f, which c44e06a reverted; the node:22 image already has ImageMagick, fontconfig and DejaVu. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): agentic OpenCode no longer offers webfetch The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric turn off OpenCode's webfetch tool (`tools: {webfetch: false}`), so the model is not offered it. The lent sandbox reaches only the policy model server, so every webfetch call failed with a transport error, as in the rollouts our agentic video training data came from. The other tools stay as in that training data: bash (on sh), edit, glob, grep, read, skill, task, todowrite and write, with watch_video and view_image. doom_loop stays at ask and compaction off. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video-mcqa): watch_video's text for frames attached after the tool results For an OpenAI-compatible provider, OpenCode sends the images of all the tool results of one response after those results, in one user message ("Attached media from tool result:"), in call order. watch_video's text was written for images placed right after their labels: "This is a video:" and one "Frame i sampled at t seconds:" line per frame, each ending in a colon that the model sees nothing after. watch_video's text now says what was sampled (the frame count, the number of distinct frames when the video holds some, the video, the window, the spacing, the frame size and the visual tokens), that the frames are attached after the tool results in this order, and each frame's sampling time: Sampled 42 frames of videos/a.mp4 from 120.00 s to 240.00 s, one every 2.86 s, at 616×336 (11088 visual tokens). The 42 frames are attached after the tool results, in this order: Frame 1: 121.43 s Frame 2: 124.29 s ... The lines about source PTS and the largest gap between distinct source frames are dropped. watch_video's description adds that the images of several tool calls in one response follow in call order. The frame rules and the frames are unchanged; view_image is unchanged. The text and the description come from the image's video tools, so the sandbox image needs a rebuild: the seed check refuses an image whose tools differ. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): saved rule-scored results without the question; a non-string judge choice Aggregating results saved before rows carried the question and its options raised TypeError: VerifierMetadata required both. They are optional again, given together or not at all. The rule policies and aggregation never read them, so such boxed_only_v1 results aggregate and replay as before. Under llm_extraction_v1 the judge reads them, so that policy refuses a row without them before any judge call. A judge reply {"choice": null} was read as the string "None" and scored as no_choice, a measured zero. A choice that is not a string is now an unusable reply: Gym's judge failsafe masks the row for rejudging. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-qa-rubric): grade the last assistant message; empty_answer_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]> * feat(video-mcqa): cap the tool images an episode sends by count too Every request sends the episode's earlier tool images again. The plugin capped them by max_tool_media_bytes (400 MiB of base64) only, so small frames could pass that and still exceed the model server's image limit per request: two watch_video results of 150 small frames make a request with 300 images, over the 256 that the README's vLLM example allowed. max_tool_media_images (ToolSettings, default 8192) caps their number the same way: from the tool result whose images would pass either limit on, each result shows the notice in place of its images, the same in every request, and earlier results keep theirs. The README's vLLM example now takes 8192 images per request, and the README says to change the two together. The plugin and video_tools/contract.py are files of the sandbox image, so the image needs a rebuild: the seed check refuses an image whose tools differ. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): read a relative cohort_manifest from the Gym root The agentic Video-MME benchmarks (benchmarks/videomme_v1_agentic, benchmarks/videomme_v2_agentic) default the cohort manifest to their prepared file, benchmarks/<name>/data/<name>_cohort.json, a path from the Gym root. Gym starts each resources server in its own directory, and the servers read the path as given, so a run with the benchmarks' default stopped at server start with FileNotFoundError. Runs that passed an absolute path were not affected. The video_mcqa server (videomme_v1, lvbench, question sets) and the videomme_v2 server now resolve the path with _resolve_under_cwd_or_install, as tavily_search and hle_web_tools resolve their files: an absolute path is used as given, and a relative one is looked up under NEMO_GYM_EXTRA_ROOTS, the working directory, then the Gym root. The sandbox image's files do not change, so an image built from the previous commit still passes the seed check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * build(video-qa-rubric): refresh component lock against main Signed-off-by: yaoyu-33 <[email protected]> * build(video-mcqa): refresh the video servers' component locks against main Relocked with uv 0.13.4 on top of main's upgraded locks (NVIDIA-NeMo#6528): lvbench, video_mcqa, videomme_v1, videomme_v2 and video_qa_rubric. Each lock only gains the packages of this branch's dependencies (nemo-gym's sandbox extra, and pillow 12.3.0 in video_mcqa); python-dateutil is 2.9.0.post0 again, as in main's other locks with the sandbox extra. Signed-off-by: Guo Chen <[email protected]> * test(video-mcqa): pass the stop limit through the fixture that counts stops main's NVIDIA-NeMo#6410 gives AsyncSandbox.stop a timeout_s keyword, and lending now passes it. The `stopped` fixture (also used by video_qa_rubric's agentic tests) wraps the real stop, so it takes and forwards the keyword, as main's other session tests do since NVIDIA-NeMo#6410. Signed-off-by: Guo Chen <[email protected]> * test(video-mcqa): run the agentic Video-MME prepare tests with the video_mcqa server tests The tests import both benchmarks' prepare.py and, through them, the video_mcqa and videomme_v2 server modules, so in the core suite they added those modules to the core coverage measurement. The video_mcqa server tests, which cover those modules, now run them. The tests are unchanged. Signed-off-by: Guo Chen <[email protected]> --------- Signed-off-by: Guo Chen <[email protected]> Signed-off-by: yaoyu-33 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: yaoyu-33 <[email protected]>
ehosseiniasl
pushed a commit
to ehosseiniasl/Gym
that referenced
this pull request
Nov 21, 2026
…swer level grading and video media preloaded in the sandbox image (NVIDIA-NeMo#6460) * refactor(video): import nemo_gym names from their public packages The four video servers and their tests imported the pre-0.8 module paths (nemo_gym.base_resources_server, config_types, global_config, openai_utils, server_utils), which still import with a deprecation warning. They now import each name from its package's public API, as scripts/migrate_imports.py writes it; `migrate_imports.py --check` reports nothing for these folders. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video): optional judge-model answer extraction for Video-MME v2, Video-MME and LVBench Add answer_policy llm_extraction_v1 to the shared video MCQA scoring. A judge model (any OpenAI-compatible chat model behind a Gym model server, called through call_judge on /v1/chat/completions) reads which option a final answer gives; the verifier scores that option against the gold label. The judge sees the prompt's text (no media) and the final answer (no reasoning), never the gold label. - A "none" reading is the new outcome no_choice (a measured zero); an empty final answer stays no_answer and is not sent. - A failed judge call or a reply that names no option raises a judge failure: Gym's judge failsafe masks the row and keeps it with its answer in the failures file, so the frozen cohort counts the task as missing until it is judged again. - The judged grading, verify response included, runs in observe_llm_judge_grading, so Gym binds the graded response and reward to the judge's reply. - The cohort declares the policy; a server whose cohort uses it refuses to start without judge_model_server. The rule policies stay the default and never call a judge. - prepare_single_turn and prepare.py take a prompt style: boxed (default) or the benchmark's bare-letter prompt (videomme_v2, videomme_v1, lvbench). - New configs <benchmark>_single_turn_llm_extraction.yaml for the three benchmarks: the single-turn config plus an openai_model judge (judge_base_url, judge_api_key, judge_model_name). Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video): sandbox image with frame-sampling video tools for OpenCode Adds resources_servers/video_mcqa/sandbox_image: a Dockerfile and the video tools it installs in /opt/video-mcqa. - video_tools.mjs: an OpenCode 1.17.11 plugin with watch_video and view_image. It runs `python3 -I -m video_tools.cli` once per call and returns the images as tool attachments. It also caps the tool images that one episode sends (400 MiB of base64 by default): from the result that would pass the cap on, results show a notice in place of their images, the same in every request. The tools take plain JSON Schema arguments, so the plugin imports only Node's standard library. - video_tools: watch_video samples the center of each of num_frames equal bins of [start, end), takes the latest source frame not after each sampling time, resizes by area to the requested long edge rounded down to the model's grid (patch_size / downsample_ratio, 28 px by default) and returns JPEG frames (quality 95, 4:4:4) with "This is a video:" and one "Frame i sampled at t seconds:" line per frame. Per-frame and per-call pixel caps refuse a request instead of shrinking it. view_image returns an image file unchanged. - Dockerfile: OpenCode 1.17.11 and its plugin dependencies with the pins of visual_coding_opencode, the static FFmpeg 7.0.2 build pinned by SHA-256, Python 3.13 with NumPy 2.4.6, Pillow 12.3.0 and Pydantic 2.13.5. Tests cover the sampling, rounding, limits and text, the decode (seek against the sequential reference), the program's JSON replies, and the plugin under Node with a stand-in program. video_mcqa's environment gains NumPy and Pillow for these tests, and Gym's sandbox extra for the lending that follows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video): agentic Video-MME v2, Video-MME and LVBench on stock opencode_agent Adds an agentic config to each of the three benchmarks. The stock opencode_agent runs each question through a single_agent_turn_legacy Environment Server, in a sandbox that the benchmark's resources server lends the episode, as visual_coding_opencode does. The sandbox image is video_mcqa/sandbox_image, and OpenCode loads its video tools plugin from there. video_mcqa/sandbox.py lends the sandbox for the video_mcqa and videomme_v2 servers (the videomme_v1 and lvbench servers inherit it). At each seed it: - refuses (422) a row whose video_binding.source is not a regular file under the configured video_roots; - starts the sandbox with the video tools' configuration (tools.json, from the server's video_tools settings) and two checksum lists; - uploads the video with nemo_gym.sandbox.upload_path; - runs one command in the sandbox: the image's video tools must have this repository's SHA-256 and the video the row's SHA-256 (422 otherwise), then the video becomes read-only and the tools check their configuration and FFmpeg. A command result with an error_type or the -1 sentinel, and any other failure, stops the sandbox and raises, so the Environment Server runs the episode again. The episode's close stops the sandbox. Grading never reads the sandbox. The verifiers read the stock agent's outcome: in the agentic setting a failed or incomplete response that reaches verify is an execution_failure scored 0, from the response's own status, so a replayed row scores the same. This replaces the video_execution_failure metadata key, which only the removed opencode_video_agent set. Single-turn scoring is unchanged. prepare.py names the video at --sandbox-root/sandbox_path (default /testbed) in agentic prompts. The three servers gain agentic example rows and cohorts, and their environments Gym's sandbox extra. READMEs describe the image, the tools, seeding, the single-upload size limit of the providers and the thinking switch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * docs(video): agentic example rollouts with Nemotron 3 Nano Omni One rollout per agentic example row of the VideoMME-v2, VideoMME-v1 and LVBench servers, from nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16 on one GPU (vLLM 0.32.0rc1.dev190) through the stock opencode_agent, with OpenSandbox sandboxes from the video MCQA sandbox image. The shared README gives the serving flags, the commands and the outcomes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(videomme_v2): let the questions of one group keep their own levels The Video-MME-v2 annotation gives every question its own level; the first three questions of a logic group can have a level other than the group's last question. The official scorer counts per-level accuracy by each question's own level and scores a group under the level of its last question. validate_metric_cohort no longer requires every task level to equal its group's level. When a cohort lists task_levels, each group's level must be the level of its last question, /L<n>/raw_acc counts questions by their task level, /L<n>/nonlinear_score counts groups by the group level, and the verifier checks a result's level against its task level, so rows that carry their own question level are scored instead of refused. A cohort without task_levels behaves as before: each question takes its group's level. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video): let the sandbox tools read OpenCode's temporary files; drawtext, ripgrep and ImageMagick in the image - view_image and watch_video also read regular files under video_tools.scratch_roots, by default /tmp/opencode: OpenCode's bash tool keeps temporary files there, such as frames or contact sheets the model made, and the tools refused them. A relative path still starts at the workspace, a symlink that leads out of these directories is refused, and the text names such a file by its absolute path. The tool descriptions are unchanged. - The image's FFmpeg 7.0.2 is now the static build of mwader/static-ffmpeg, pinned by image digest and by the binaries' SHA-256. watch_video gets the same frames as with the previous 7.0.2 build (identical JPEG bytes on 50 requests over 7 videos); the new build also has libharfbuzz and fontconfig, so the model's drawtext works, with fontconfig and DejaVu for its default font. - ImageMagick for the model's montage and convert, with the URW fonts its labels default to, one thread (MAGICK_THREAD_LIMIT=1). - ripgrep stays (OpenCode's grep and glob run it offline). The build checks drawtext, ripgrep and montage. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * revert(video): the video tools and sandbox image before the scratch-file change This reverts commit cc13a8f: view_image and watch_video read files under the workspace only, not OpenCode's /tmp/opencode; the image's FFmpeg 7.0.2 is the johnvansickle.com static build again, without drawtext; and the image has no ImageMagick. The tree is again the one of 2f336e9. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(openqa-rubric): open-ended video QA graded against each question'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]> * feat(video): judge-read answers for the agentic configs <benchmark>_agentic_llm_extraction.yaml, listed after <benchmark>_agentic.yaml, gives the agentic resources server the judge model of llm_extraction_v1. The judge server listens on 127.0.0.1: the lent sandbox may reach every port of the policy model server's host and must not reach a judge. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video): agentic rows with the benchmarks' own letter prompts prepare_agentic and prepare.py --prompt now write an agentic row in a benchmark's own letter wording: a first line that names the video in the sandbox (Video: /testbed/videos/<file>), then the single-turn letter prompt. Read its answers with llm_extraction_v1. The boxed prompt stays the default. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(openqa-rubric): example rollouts with Nemotron 3 Nano Omni 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]> * feat(video): agentic Video-MME v2 and Video-MME benchmarks from the authors' annotations benchmarks/videomme_v2_agentic and benchmarks/videomme_v1_agentic run the agentic configs of the videomme_v2 and videomme_v1 resources servers with judge-read answers. prepare.py downloads the authors' annotation at a pinned revision and checks its SHA-256 (VIDEOMME_V2_PARQUET / VIDEOMME_V1_PARQUET name a local copy), then binds each question to its video by the SHA-256 that the source directory's FILES.sha256 lists, reading no video; the resources server checks that hash in the sandbox. Rows ask in the benchmark's letter wording after a line that names the video in the sandbox, and a judge model (gpt-6.1-sol at max reasoning effort by default) reads the chosen option. Video-MME v2 rows keep each question's own level and the cohort groups the four questions of each video under the level of the fourth, which the videomme_v2 server accepts with the per-question levels merged from NVIDIA-NeMo#6290. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(openqa-rubric): which video URLs and vLLM judges work 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]> * refactor(video-qa-rubric): rename openqa_rubric to video_qa_rubric 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]> * test(video-qa-rubric): import DatasetConfig from nemo_gym.config 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]> * fix(video-qa-rubric): read failed agent runs from the response status, as video_mcqa does video_qa_rubric decided an agent run had failed from the video_execution_failure response metadata key, which only the removed opencode_video_agent set; this branch removed the key from video_mcqa, so video_qa_rubric could not even be imported here. It now uses video_mcqa's response_failure, like the Video-MME v2 server: in the agentic setting a failed or incomplete response that reaches verify is an execution_failure scored 0, read from the response's own status, so a replayed row scores the same. In the single-turn setting a failed model call stays a masked infrastructure_failure and a tool call an execution_failure; only the failure reasons now use video_mcqa's wording. The failed-run test covers failed and incomplete runs, and a new test checks that a failed model call is masked only in the single-turn setting. The README's outcome table says the same. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video_mcqa): the judge reads each row's question; question sets, frame rows, empty-answer reward Make video_mcqa the shared base that the video multiple-choice benchmarks and other question sets fill with data and configuration. - Each row's verifier_metadata keeps the question as asked: question (its text) and options (the option texts in label order). VerifierMetadata and the task-data schemas require both, and prepare_single_turn, prepare_agentic and prepare.py write them. A row without them is refused: rows prepared before this change are prepared again, and nothing falls back to the request. - The llm_extraction_v1 judge builds its prompt from those two fields and the final answer only. It no longer reads the text of the model's request (scoring.prompt_text is gone), so the video, its frames and anything else in the prompt never reach it. videomme_v2 uses the same judge path. - A cohort may be a question set instead of a benchmark (question_set.py, QuestionSetCohort): two to 26 options, task IDs outside the benchmarks' scopes, no level or group, accuracy under the set's name. A training set runs on the shared verifier this way. The VideoMME-v1 and LVBench servers refuse such a cohort. - prepare_single_turn(..., frames=[(label, image_url), ...]) and task.video_parts send a video as labelled frames (input_image parts) instead of one input_video part. - empty_answer_reward (unset by default, which scores 0): the reward of an attempt that produced output but no final answer, for example a training penalty. Accuracy still counts the attempt as no_answer. - The shared rows take any number of options; VideoMME-v1 and LVBench check their four choices in their own task_data.py. - configs/video_mcqa_single_turn_llm_extraction.yaml: the shared verifier with the answer judge. The committed example rows and rollouts gain the two fields; nothing else in them changes. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(video): the agentic example rows keep each question's text and options NVIDIA-NeMo#6238 makes every video_mcqa row keep the question as asked (question, and options in label order) in verifier_metadata. The agentic Video-MME v2, Video-MME and LVBench examples gain the two fields, rebuilt with prepare_agentic from the same questions; nothing else in the rows or in the recorded rollouts changes. The benchmark wrappers write them through prepare_agentic. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video-qa-rubric): agentic open-ended video questions with OpenCode and the video tools configs/video_qa_rubric_agentic.yaml runs video_qa_rubric's open-ended questions agentically, with the agent, sandbox image, video tools and sandbox settings of the agentic Video-MME v2, Video-MME and LVBench configs: the stock opencode_agent through a single_agent_turn_legacy Environment Server, a sandbox per episode that holds the row's video, and the rubric judge on 127.0.0.1 (the sandbox may reach every port of the policy model's host). - The resources server and its config take video_mcqa's VideoSandboxServer bases: with sandbox_provider set, each agentic episode's seed lends a sandbox with the row's video, checked by SHA-256; without it nothing changes. The sandbox extra joins the server's dependencies (uv.lock regenerated). - task.prepare_agentic(task_id, question, rubric, video_path=...) builds an agentic row's user turn (the question and the video's path in the sandbox, never the rubric); the row adds video_binding, which the task-data schema now declares. - data/example_agentic.jsonl: the five example questions and rubrics, each clip bound by path instead of inlined. - Tests: rows, bindings, the committed examples, the config against the agentic Video-MME v2 config, and the lent sandbox on the local provider. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * build(video-mcqa): sandbox image on the node:22 image the training data was generated in The agentic video training data was generated in the full node:22 Debian bookworm image (node@sha256:363e1587..., node 22.23.3) with the tools added at run time. The sandbox image now uses that image too, pinned by digest (the node:22.23.3-bookworm tag has been rebuilt since), so that evaluation and RL run in the same system: its shell, ImageMagick, git, compilers and other programs. The former final stage becomes the `tools` stage, unchanged apart from its base, which is now pinned by digest so that Python's files stay the same; the last stage copies its /usr/local (Python 3.13 with NumPy, Pillow and Pydantic, FFmpeg 7.0.2), /opt/opencode, /opt/video-mcqa and /usr/bin/rg into the node image as root-owned files, sets the same thread limits and locale, and makes /testbed and /testbed/work. The video tools, OpenCode and their pins are unchanged. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video-mcqa): agentic OpenCode keeps its own tools and runs sh, as in the training data The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric now run OpenCode's tools as the rollouts our agentic video training data came from did, so the model sees the same tools at evaluation and in RL: - No `tools` overrides: OpenCode offers its own tools, webfetch and task included, besides watch_video and view_image. webfetch fails in a sandbox that reaches only the model server, as it did then. OpenCode 1.17.11 offers websearch only with a search provider enabled, so it is not offered, as then. - The lent sandbox sets SHELL=/bin/sh (`sandbox_config.env`). OpenCode's shell tool runs commands with the shell SHELL names, bash when it is unset, and names that shell in the tool's description ("Shell: sh"). With these configs, the tools in the first request of an OpenCode 1.17.11 run in the sandbox image have the names, descriptions and parameters of the tool block of the training trajectories. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(video-mcqa): agentic OpenCode ends a run on a third identical tool call, as in the training data The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric set OpenCode's doom_loop permission to ask, OpenCode's default and the setting of the rollouts our agentic video training data came from, instead of allow. OpenCode 1.17.11 asks for doom_loop when the last three parts of one model response are calls of the same tool with identical input. `opencode run` rejects every request that would ask, and this rejection ends the run without an answer, as it did when the training data was generated. With allow, the third call ran and the model went on. The same call repeated across separate responses does not reach that check, with either setting. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): the sandbox tools read OpenCode's temporary files; drawtext, montage and annotate work in the image - view_image and watch_video also read regular files under video_tools.scratch_roots, by default /tmp/opencode: OpenCode's bash tool keeps temporary files there, such as frames or contact sheets the model made, and the tools refused them. A relative path still starts at the workspace, a symlink that leads out of these directories is refused, and the text names such a file by its absolute path. The tool descriptions are unchanged. - FFmpeg 7.0.2 is now the static build of mwader/static-ffmpeg, pinned by image digest and by the binaries' SHA-256. watch_video gets the same frames as with the johnvansickle.com 7.0.2 build (identical JPEG bytes on 50 requests); the new build also has libharfbuzz and fontconfig, so the model's drawtext works, with the image's DejaVu font. - The image gets the URW fonts that ImageMagick's labels and annotations default to (Helvetica). Without them, montage and convert -annotate abort in the node:22 image. - The build checks drawtext, ripgrep, montage with a label and convert -annotate. The tool code is that of cc13a8f, which c44e06a reverted; the node:22 image already has ImageMagick, fontconfig and DejaVu. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): agentic OpenCode no longer offers webfetch The agentic configs of videomme_v2, videomme_v1, lvbench and video_qa_rubric turn off OpenCode's webfetch tool (`tools: {webfetch: false}`), so the model is not offered it. The lent sandbox reaches only the policy model server, so every webfetch call failed with a transport error, as in the rollouts our agentic video training data came from. The other tools stay as in that training data: bash (on sh), edit, glob, grep, read, skill, task, todowrite and write, with watch_video and view_image. doom_loop stays at ask and compaction off. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * feat(video-qa-rubric): reference-answer level grading, per-subset scores, and video media preloaded in the sandbox image video_qa_rubric: each row's verifier_metadata.grading names its protocol. Rows without it keep the weighted-points rubric, its request model and its checks unchanged. A reference_levels row carries a reference answer and a rubric of any JSON object; the judge reads them with the question and the final answer through the server's reference_levels settings (a question set's own system prompt and user template, and its top level) and must reply with exactly {"score", "reason"}; the reward is the level over the top level. A server without these settings refuses such rows. Rows that name a subset also get each subset's mean rubric score and the mean over the subsets in the metrics. The row builders take the text after the video, the protocol, the reference answer and the subset, and an agentic row's whole text for videos the image already holds. video_mcqa: an agentic row can name media that its sandbox image already holds (preloaded_media: the image's name in the server's sandbox_preloaded_images, the image's catalog and its SHA-256, and host files to copy in). The seed starts the sandbox from that image, uploads nothing, and checks in the sandbox the video tools, the catalog's SHA-256 and the size of every file it lists, moves the catalog out of the model's media root and makes the copied files read-only. Each image lends its own sandboxes; rows with an uploaded video are unchanged. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(benchmarks): MM-Lifelong v1.1 single-turn and agentic as video_qa_rubric question sets mm_lifelong_v1_1: the 1,023 questions of day_test, week_test and month_val with frozen rubrics. prepare.py reads the annotations at a pinned revision of the Hugging Face dataset (downloading what is missing) and checks them against the release's checksums, whose own SHA-256 is pinned; the model sees each split as one MP4 of 256 frames at the centres of equal bins, taken from the release's frame cache that the user downloads (each shard read is checked), with the question as it is. grading.yaml is the dataset's grader on video_qa_rubric's reference_levels protocol: its prompt and template, the reference answer, 0-5 levels, one completion; each split is a subset, so the metrics give the split scores and their mean. mm_lifelong_v1_1_agentic: the same questions answered by OpenCode with the video tools in a sandbox whose image holds the split's original videos (preloaded media). The videos are not redistributed: sandbox_image/build.py checks the user's copy against the sizes and SHA-256 the Hub keeps, writes the image's catalog and the dataset runner's catalog that the model reads, and builds one image per split on the video tools' image. Rows ask with the runner's description of the inputs and its time-coordinates note. The grader prompt and the runner's note are MIT-licensed text of the dataset; the notice is in third-party-notices.md and ATTRIBUTIONS.md. Signed-off-by: Guo Chen <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(video-mcqa): watch_video's text for frames attached after the tool results For an OpenAI-compatible provider, OpenCode sends the images of all the tool results of one response after those results, in one user message ("Attached media from tool result:"), in call order. watch_video's text was written for images placed right after their labels: "This is a video:" and one "Frame i sampled at t seconds:" line per frame, each ending in a colon that the model sees nothing after. watch_video's text now says what was sampled (the frame count, the number of distinct frames when the video holds some, the video, the window, the spacing, the frame size and the visual tokens), that the frames are attached after the tool results in this order, and each frame's sampling time: Sampled 42 frames of videos/a.mp4 from 120.00 s to 240.00 s, one every 2.86 s, at 616×336 (11088 visual tokens). The 42 frames are attached after the tool results, in this order: Frame 1: 121.43 s Frame 2: 124.29 s ... The lines about source PTS and the largest gap between distinct source frames are dropped. watch_video's description adds that the images of several tool calls in one response follow in call order. The frame rules and the frames are unchanged; view_image is unchanged. The text and the description come from the image's video tools, so the sandbox image needs a rebuild: the seed check refuses an image whose tools differ. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): saved rule-scored results without the question; a non-string judge choice Aggregating results saved before rows carried the question and its options raised TypeError: VerifierMetadata required both. They are optional again, given together or not at all. The rule policies and aggregation never read them, so such boxed_only_v1 results aggregate and replay as before. Under llm_extraction_v1 the judge reads them, so that policy refuses a row without them before any judge call. A judge reply {"choice": null} was read as the string "None" and scored as no_choice, a measured zero. A choice that is not a string is now an unusable reply: Gym's judge failsafe masks the row for rejudging. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-qa-rubric): grade the last assistant message; empty_answer_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]> * feat(video-mcqa): cap the tool images an episode sends by count too Every request sends the episode's earlier tool images again. The plugin capped them by max_tool_media_bytes (400 MiB of base64) only, so small frames could pass that and still exceed the model server's image limit per request: two watch_video results of 150 small frames make a request with 300 images, over the 256 that the README's vLLM example allowed. max_tool_media_images (ToolSettings, default 8192) caps their number the same way: from the tool result whose images would pass either limit on, each result shows the notice in place of its images, the same in every request, and earlier results keep theirs. The README's vLLM example now takes 8192 images per request, and the README says to change the two together. The plugin and video_tools/contract.py are files of the sandbox image, so the image needs a rebuild: the seed check refuses an image whose tools differ. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(mm-lifelong-v1-1): the image gets only the release's videos; overall score wording build.py built the image from the local videos/<domain>/ folder itself, so each week day folder went in whole, with any local file that the verified catalog does not list (a partial download, notes). The build now reads a temporary folder in the output directory that holds only the catalog's files, as hard links to the local copy (copies when the output directory is on another file system), with the source folders' times. The script lists the other local files and leaves them out. Without such files the image is the same as before: from invented week and month videos, the old and the new script give the same layers on one builder, and on fresh builds the same entries apart from the parent folders' build times, which also differ between two fresh builds of the old script. mm_lifelong_v1_1/config.yaml said the dataset's overall score is the mean of the split scores. It pools all 1,023 questions (mean/rubric_score); the mean of the three split scores is a separate metric. Comment only. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * fix(video-mcqa): read a relative cohort_manifest from the Gym root The agentic Video-MME benchmarks (benchmarks/videomme_v1_agentic, benchmarks/videomme_v2_agentic) default the cohort manifest to their prepared file, benchmarks/<name>/data/<name>_cohort.json, a path from the Gym root. Gym starts each resources server in its own directory, and the servers read the path as given, so a run with the benchmarks' default stopped at server start with FileNotFoundError. Runs that passed an absolute path were not affected. The video_mcqa server (videomme_v1, lvbench, question sets) and the videomme_v2 server now resolve the path with _resolve_under_cwd_or_install, as tavily_search and hle_web_tools resolve their files: an absolute path is used as given, and a relative one is looked up under NEMO_GYM_EXTRA_ROOTS, the working directory, then the Gym root. The sandbox image's files do not change, so an image built from the previous commit still passes the seed check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Guo Chen <[email protected]> * build(video-qa-rubric): refresh component lock against main Signed-off-by: yaoyu-33 <[email protected]> * build(video-mcqa): refresh the video servers' component locks against main Relocked with uv 0.13.4 on top of main's upgraded locks (NVIDIA-NeMo#6528): lvbench, video_mcqa, videomme_v1, videomme_v2 and video_qa_rubric. Each lock only gains the packages of this branch's dependencies (nemo-gym's sandbox extra, and pillow 12.3.0 in video_mcqa); python-dateutil is 2.9.0.post0 again, as in main's other locks with the sandbox extra. Signed-off-by: Guo Chen <[email protected]> * test(video-mcqa): pass the stop limit through the fixture that counts stops main's NVIDIA-NeMo#6410 gives AsyncSandbox.stop a timeout_s keyword, and lending now passes it. The `stopped` fixture (also used by video_qa_rubric's agentic tests) wraps the real stop, so it takes and forwards the keyword, as main's other session tests do since NVIDIA-NeMo#6410. Signed-off-by: Guo Chen <[email protected]> * test(video-mcqa): run the agentic Video-MME prepare tests with the video_mcqa server tests The tests import both benchmarks' prepare.py and, through them, the video_mcqa and videomme_v2 server modules, so in the core suite they added those modules to the core coverage measurement. The video_mcqa server tests, which cover those modules, now run them. The tests are unchanged. Signed-off-by: Guo Chen <[email protected]> * test(video-qa-rubric): run the MM-Lifelong v1.1 tests with the video_qa_rubric server tests The tests import the benchmarks' prepare.py and the video_qa_rubric server modules, so in the core suite they added those modules to the core coverage measurement. The video_qa_rubric server tests, which cover those modules, now run them. The tests are unchanged; they keep their repository root at parents[3]. Signed-off-by: Guo Chen <[email protected]> --------- Signed-off-by: Guo Chen <[email protected]> Signed-off-by: yaoyu-33 <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: yaoyu-33 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Lets the four questions of a Video-MME-v2 group keep their own levels, as the official annotation and the official scorer do. On main,
videomme_v2(#6071) gives every question its group's level and rejects anything else, so the official question set cannot be scored completely.Why. Since the official annotation update of 2026-05-18 (
98048fc, "add task types of Q1-Q3 of logic groups"; the authors' README news of 2026-05-22), every Video-MME-v2 question carries its ownlevel. In the current annotation (6e4bebb0, the latest revision):[1, 1, 1, 3],[1, 3, 3, 3]or[1, 2, 2, 2]for questions 1-4;The official script (the revision this server's README already cites) uses both:
get_final_ratingscores each group under the level of its last question (L335, L347), andget_final_acccomputes per-level accuracy by each question's own level (L372-L373).On main,
validate_metric_cohortrequires every entry oftask_levelsto equal its group's level and returns the group levels. With the official data:groupsand each question'stask_levelsis rejected at start-up (Task and group levels disagree);groupsonly, the verifier rejects each result whose row carries a question level other than its group's (Result level differs from its frozen cohort): 359 of 3,200 rows in 169 groups, which then stay missing, so the run can never be complete;/L1/raw_acc,/L2/raw_accand/L3/raw_accthen count 812/992/1,396 questions (each group's level) instead of 1,053/1,049/1,098.Change.
metrics.validate_metric_cohortno longer requires a task level to equal its group's level. When the cohort liststask_levels, each group's level must be the level of its last question (A group's level must be the level of its last question), and the function returns the task levels:/L<n>/raw_acccounts questions by their own level and/L<n>/nonlinear_scorecounts groups by the group level, as the official script does. The verifier already compares a result'slevelwith this mapping, so rows that carry their own question level are scored. Withouttask_levelsnothing changes: each question takes its group's level.task_levels.No issue: a focused fix to #6071, found when running the full official question set through this server.
Validation
All on the final commit
31eed13823772e0f64aa12a224a7dee3a230dae6(one commit on main0bce4e7e5):New tests:
tests/test_metrics.py::test_questions_keep_their_levels_and_groups_score_at_the_last_questions_level(per-level raw accuracy by each question's level, the group score under the group level, a group level other than its last question's rejected) andtests/test_grouped_app.py::test_questions_of_one_group_keep_their_own_levels(a mixed-level logic group throughverifyandaggregate_metrics; a result carrying the group's level for a lower-level question is rejected). Both fail on main and pass here.test_known_levels_must_match_group_levelsis renamedtest_known_levels_are_returned(same assertion; the old name states the rule this PR removes).Tests of the four video servers from the root venv (
pytest resources_servers/{videomme_v2/tests,video_mcqa/tests,videomme_v1,lvbench}): 397 passed (118 subtests).gym env test --resources-server <server> +should_validate_data=true:videomme_v2138 passed,video_mcqa257 passed (118 subtests),videomme_v11,lvbench1; the data of all four validated.scripts/ci/core_unit_tests.sh(unsharded): 22,656 passed, 104 skipped, 0 failed (343 subtests).pre-commit run --all-files: pass. CI's secrets-detector command (detect-secrets-hook1.5.0 with.github/workflows/config/.secrets.baseline) on the 4 changed files: exit 0. No dependency or lock changes.Official cohort structure: the question IDs, levels, group types and group structures of the official annotation (
6e4bebb0, 3,200 questions; no question text, answers or video) written as a schema-2 cohort (each group at the level of its last question), loaded by the realVideoMMEV2ResourcesServerstart-up, and every row's metadata passed through the verifier's own check:groups+ each question'stask_levelsgroups-only cohort, the only cohort of the official data main loads)/raw_acc/nonlinear_scoreAgainst the official functions: three random answer patterns (each answer correct with p = 0.5) over the same 3,200 questions, scored by this server's aggregation and by the official script's own
get_final_accandget_final_rating(taken from the script unchanged and run on the official annotation): overall raw accuracy, overall nonlinear score and the L1/L2/L3 raw accuracy and nonlinear score are identical (largest absolute difference 0.0). With main'sgroups-only cohort the nonlinear scores also match, but per-level raw accuracy differs by up to 1.13 points.Rollouts
N/A: the model request and the answer grading are unchanged; the change only decides which cohorts load, which result levels the verifier accepts, and how measured results are grouped by level. Those paths were run on the full official cohort structure above.
Compatibility and benchmark impact
/L<n>/raw_accfollows the official per-level accuracy.groups-only cohort still gives each question its group's level, and the verifier still rejects a result whose level differs; cohorts of the official data listtask_levels(README).Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).