Skip to content

feat(nemotron-omni): add Megatron Nano image GRPO support - #3290

Merged
yfw merged 38 commits into
mainfrom
aroshanghias/nemotron-omni-main-migration
Aug 5, 2026
Merged

feat(nemotron-omni): add Megatron Nano image GRPO support#3290
yfw merged 38 commits into
mainfrom
aroshanghias/nemotron-omni-main-migration

Conversation

@aroshanghias-nvd

@aroshanghias-nvd aroshanghias-nvd commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add Megatron-based Nemotron Nano Omni image-GRPO support using NeMo-RL's existing sequence-packing data path and the dedicated MBridge NemotronOmniModel.

Fresh review requested: The branch is now synchronized with current main and uses the reviewed data-boundary packing design. The earlier model-owned-packing implementation is obsolete; please review this series from the beginning.

Cross-repository dependency: NVIDIA-NeMo/Megatron-Bridge#4885 has merged. The required Nemotron Omni support is included in the MBridge pin inherited from NeMo-RL main (573e088c); this PR does not change the submodule pin.

The ownership boundary is:

  • NeMo-RL groups and packs the processor-expanded token sequences using its existing Megatron data pipeline and constructs PackedSeqParams.
  • NeMo-RL passes the full packed THD row and multimodal inputs to MBridge.
  • MBridge NemotronOmniModel creates and inserts media embeddings, then selects the context-parallel portion of the merged embedding sequence.
  • Packing does not run inside model forward, and this path does not use the historical Nemotron Omni LLaVAModel collapse/expand behavior.

The PR includes:

  • capability-based dispatch for models that consume caller-packed full THD input and slice context-parallel inputs after embedding insertion;
  • a clear error for legacy LLaVA-layout Nemotron Omni checkpoints;
  • dynamic-resolution and historical tiled-image metadata handling;
  • generation compatibility for raw policy logprobs, context-length capping, and RADIO LayerScale initialization;
  • maintained single-node Clevr and four-node MMPR Nano image-GRPO recipes.

The branch is synchronized with NeMo-RL main's vLLM 0.25.1 dependency. This PR does not change external vLLM source or the vLLM dependency pin; its compatibility behavior is implemented in NeMo-RL's existing integration and runtime-patch layer.

Issues

No public issue.

Usage

The maintained recipes added by this PR are:

  • examples/configs/recipes/vlm/vlm_grpo-nemotron-omni-30ba3b-clevr-1n8g-megatron-tp8ep8.v1.yaml
  • examples/configs/recipes/vlm/vlm_grpo-nemotron-omni-30ba3b-mmpr-4n8g-megatron-tp8ep16.v1.yaml

Validation

  • A production-shaped four-node Nano image-GRPO parity run with vLLM 0.25.1 exercised generation, rewards, raw policy logprobs, training, repeated vLLM refit, and checkpointing through step 23. The PR #3290 validation run tracks the production packing-refactor reference closely, without the prior TMPE spikes.
  • The matched A/B used validation-only per-call deterministic seeding instrumentation; that instrumentation is not included in this PR.
  • The focused distributed Megatron suite passed: CP2 checkpoint, TP/SP, TP2+CP2, padded multi-row attention, and PP2 (5 passed).
  • Focused vLLM integration tests passed (8 passed).
  • uv lock --check and git diff --check passed.
  • Protected NeMo-RL CI is required before merge.

Scope and follow-up

This PR covers the Nano image/text path. Caller-packed context parallelism with MTP is deliberately unsupported until the separate Super/MTP integration adds and validates the required MTP-mask alignment. Audio and video support is layered on the MBridge foundation separately.

Before this PR is ready for review

  • Read and followed the contributor guidelines.
  • Added the necessary unit and functional tests.
  • Ran focused local and distributed validation.
  • Updated docs/guides/nemotron-3-nano-omni.md with the Megatron architecture, supported scope, checkpoint compatibility, recipes, and usage.

@aroshanghias-nvd
aroshanghias-nvd requested review from a team as code owners July 20, 2026 11:32
@copy-pr-bot

copy-pr-bot Bot commented Jul 20, 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.

@github-actions

Copy link
Copy Markdown

✅ Submodule Fast-Forward Check Results

Check based on commit: df0db31 (PR #3227 from aroshanghias/nemotron-omni-main-migration)

✅ Submodules that are properly updated:

Megatron-Bridge: ✅ PR branch is ahead of main branch (fast-forward)

All submodule changes look good! ✨

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jul 20, 2026
@aroshanghias-nvd aroshanghias-nvd added the CI:L1 Run doctests, unit tests, and functional tests label Jul 20, 2026
@aroshanghias-nvd
aroshanghias-nvd requested a review from yfw July 20, 2026 11:33
Comment thread nemo_rl/data/multimodal_utils.py
Comment thread nemo_rl/models/generation/vllm/vllm_worker.py Outdated
Comment thread nemo_rl/data/processors.py
Comment thread tests/unit/data/test_multimodal_dict.py
Comment thread tests/unit/models/generation/test_vllm_backend.py Outdated
Comment thread nemo_rl/data/multimodal_utils.py
Comment thread uv.lock
Comment thread nemo_rl/models/generation/vllm/vllm_backend.py Outdated
Comment thread nemo_rl/models/megatron/setup.py Outdated
Comment thread nemo_rl/models/megatron/setup.py Outdated
Comment thread nemo_rl/data/multimodal_utils.py
Comment thread nemo_rl/models/generation/vllm/vllm_backend.py Outdated
Comment thread nemo_rl/models/generation/vllm/vllm_worker.py
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
Signed-off-by: Ali Roshan Ghias <aroshanghias@nvidia.com>
@yfw yfw added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L1 Run doctests, unit tests, and functional tests labels Aug 4, 2026
@yfw

yfw commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/ok to test a7e52a3

Comment thread nemo_rl/models/generation/vllm/vllm_worker.py
Comment thread nemo_rl/data/processors.py
Comment thread nemo_rl/models/megatron/setup.py
…model

Addresses code-review findings on the Nemotron Omni PR:

- Restore `logprobs_mode: processed_logprobs` in the root exemplars
  (grpo/ppo/distillation) and matching reference_configs. Commit bb89288
  removed it from the configs and made the code optional, which silently
  deferred the default to vLLM 0.25.1's `raw_logprobs` for every recipe that
  does not set the key.
- Reject mixed-resolution batches on the AutoModel path in
  `filter_multimodal_kwargs_for_model`: it drops `imgs_sizes` and cannot crop
  the `pad_to_max_shape` padding, so mixed-resolution inputs would feed padded
  pixels to the vision encoder and mismatch the placeholder count. Fail loud
  instead of corrupting silently, with unit tests covering the mixed-resolution
  (raises) and uniform-resolution (allowed) cases.
- Run ruff-format on the affected files.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yfw
yfw force-pushed the aroshanghias/nemotron-omni-main-migration branch from 79a4797 to 822d7b1 Compare August 5, 2026 00:14
@yfw

yfw commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test 822d7b1

yfw
yfw previously approved these changes Aug 5, 2026

@yfw yfw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved @aroshanghias-nvd 's changes up until my last commit

Comment thread nemo_rl/models/automodel/data.py
rohitrango
rohitrango previously approved these changes Aug 5, 2026
…lies to

Per review feedback, reference the concrete model
(nvidia/Nemotron-3-Nano-Omni-30B-A3B-Reasoning-BF16) whose HF forward accepts
pixel_values but not imgs_sizes, so it is clear which model the guard is for.

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yfw
yfw dismissed stale reviews from rohitrango and themself via b8d7523 August 5, 2026 02:24
@yfw

yfw commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test b8d7523

@yfw

yfw commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test c65b1f0

Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
@yfw

yfw commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test aff74f9

@yfw
yfw enabled auto-merge (squash) August 5, 2026 05:10
@yfw

yfw commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test a9a9a87

@yfw
yfw merged commit a704801 into main Aug 5, 2026
142 of 145 checks passed
@yfw
yfw deleted the aroshanghias/nemotron-omni-main-migration branch August 5, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants