Skip to content

feat(video): add Gym support for sync and async GRPO - #3500

Closed
ehosseiniasl wants to merge 3 commits into
mainfrom
ehsan/video-rl-gym-async-grpo
Closed

feat(video): add Gym support for sync and async GRPO#3500
ehosseiniasl wants to merge 3 commits into
mainfrom
ehsan/video-rl-gym-async-grpo

Conversation

@ehosseiniasl

@ehosseiniasl ehosseiniasl commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Add end-to-end video support for NeMo Gym GRPO with synchronous and asynchronous Megatron training.

  • Carry video inputs through datasets, Gym rollouts, trajectory collection, batching, generation, and policy training.
  • Preserve video metadata and cached frame tensors across distributed worker boundaries.
  • Add Nemotron Omni dynamic-resolution video preprocessing with temporal tubelets and expanded visual placeholders.
  • Use MBridges canonical NemotronOmniModelProvider instead of the historical LLaVA model path.
  • Apply NeMo RL-owned runtime compatibility patches to stock vLLM 0.25.1, removing the custom-vLLM-fork dependency.
  • Keep rollout and policy preprocessing aligned for frame sampling, resizing, temporal patching, token IDs, and log probabilities.
  • Support video rollouts in synchronous and asynchronous GRPO.
  • Preserve video data across async replay-buffer, refit, and checkpoint-resume paths.
  • Fix fresh async runs waiting unnecessarily for a complete lookahead batch before starting training.
  • Add cached-video dataset preparation, sync/async recipes, and reproducible 2-node and 16-node launchers.
  • Keep GRPO training unlimited with raw TMPE reporting.

Motivation

Video GRPO requires the rollout and policy paths to consume the same frames, multimodal token layout, and token IDs. Differences in video preprocessing or tokenization can produce incorrect
policy log probabilities and elevated TMPE.

The implementation keeps video media and preprocessing metadata intact throughout Gym, vLLM, distributed trajectory handling, and Megatron training. It also supports asynchronous generation,
in-flight weight refits, and replay-buffer checkpoint recovery without losing multimodal data.

Validation

Focused tests

  • Passed 52 focused video, Gym, vLLM, multimodal batching, and async tests against stock vLLM 0.25.1.
  • Passed async startup-barrier and recipe-configuration tests.
  • Passed Ruff and git diff --check.

2-node synchronous GRPO

16-node asynchronous GRPO

  • Job: 5822801
  • Verified through 15 optimizer/refit cycles.
  • Raw TMPE remained approximately 1.013-1.017.
  • Rewards were nonzero and ranged from approximately 0.219-0.406 across the inspected steps.
  • In-flight refits successfully advanced generation weight versions.
  • All inspected samples remained unmasked.
  • W&B: https://wandb.ai/adlr/Nemotron-omni-RL-debug/runs/19jwwuw1

Both runs used:

  • grpo.max_num_steps=-1
  • grpo.seq_logprob_error_threshold=null
  • Stock vLLM 0.25.1
  • Cached 32-frame video input
  • Canonical MBridge Nemotron Omni expanded-sequence training

Dependency stack

Merge order:

  1. feat(video): enable canonical Nemotron Omni training for V2 MoE checkpoints Megatron-Bridge#5304feat(video): enable canonical Nemotron Omni training for V2 MoE checkpoints
  2. feat(video): support video inputs in vLLM responses Gym#2324feat(video): support video inputs in vLLM responses

@ehosseiniasl
ehosseiniasl requested review from a team as code owners August 5, 2026 14:32
@copy-pr-bot

copy-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ehosseiniasl ehosseiniasl self-assigned this Aug 5, 2026
@ehosseiniasl
ehosseiniasl force-pushed the ehsan/video-rl-gym-async-grpo branch from 1f2e5cd to 283241a Compare August 5, 2026 16:54
@rohitrango
rohitrango force-pushed the rohit/gymv-mm-integration-v2 branch from d60004f to d3e02b4 Compare August 5, 2026 16:55
@rohitrango
rohitrango requested review from a team as code owners August 5, 2026 16:55
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Aug 5, 2026
@ehosseiniasl
ehosseiniasl force-pushed the ehsan/video-rl-gym-async-grpo branch from 283241a to 655081f Compare August 5, 2026 17:36
@ehosseiniasl ehosseiniasl changed the title feat(grpo): add video Gym support for sync and async training feat(video): add Gym support for sync and async GRPO Aug 5, 2026
@ehosseiniasl
ehosseiniasl force-pushed the ehsan/video-rl-gym-async-grpo branch from 655081f to ae0a56f Compare August 6, 2026 04:25
Base automatically changed from rohit/gymv-mm-integration-v2 to main August 7, 2026 03:51
@ehosseiniasl
ehosseiniasl force-pushed the ehsan/video-rl-gym-async-grpo branch from ae0a56f to 29eb7c0 Compare August 7, 2026 14:51
@ehosseiniasl
ehosseiniasl force-pushed the ehsan/video-rl-gym-async-grpo branch from 29eb7c0 to 998cdf8 Compare August 11, 2026 21:51
@cspades

cspades commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@ehosseiniasl Do you have an ETA for when this PR will be merged?

@cspades

cspades commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@rohitrango Could you maybe answer?

@rohitrango rohitrango closed this Aug 18, 2026
ananthsub pushed a commit to NVIDIA-NeMo/Gym that referenced this pull request Aug 19, 2026
## Summary

Add video-input support to the NeMo Gym Responses API and vLLM model
backend for multimodal RL training.

  - Accept `input_video` and `video_url` content parts.
- Convert Responses API video inputs into vLLM-compatible chat content.
  - Reject video parts that do not contain a valid URL.
- Prefer prompt and generation token IDs returned by the generation
request.
- Preserve multimodal processor arguments when falling back to the
tokenize endpoint.
- Validate that generation token IDs and log probabilities have matching
lengths.
- Propagate token IDs, log probabilities, and optional training metadata
through Gym responses.
- Ensure component processes load their owning Gym checkout instead of a
stale container installation.

  ## Motivation

Video GRPO requires Gym to preserve video content and the exact prompt
and generation tokenization used by vLLM.

Using token IDs produced by a separate or differently configured
tokenization request can cause rollout and policy log probabilities to
reference different token sequences, resulting in
  incorrect training data and elevated TMPE.

  ## Validation

  - Added coverage for `input_video` and `video_url` conversion.
  - Added coverage for missing video URLs.
  - Added coverage for native vLLM prompt and generation token IDs.
- Added coverage for the tokenize fallback and multimodal processor
arguments.
  - Added coverage for token-ID and log-probability propagation.
- Added coverage ensuring component processes prefer the owning Gym
checkout.
- Exercised through downstream synchronous and asynchronous NeMo RL
video GRPO training.

  ## Dependencies

  None.

  ## Related integrations

- NVIDIA-NeMo/Megatron-Bridge#5304 `feat(video): enable canonical
Nemotron Omni training for V2 MoE checkpoints`
- NVIDIA-NeMo/RL#3500 `feat(video): add Gym support for sync and async
GRPO`

---------

Signed-off-by: Ehsan Hosseini Asl <ehsan.hosseiniasl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants