Repository navigation
fix(vlm): align training media with rollout placeholders - #4188
Merged
yfw merged 5 commits intoSep 18, 2026
Merged
Conversation
This was referenced Sep 17, 2026
ehosseiniasl
force-pushed
the
ehsan/super35-video-media-alignment
branch
from
September 17, 2026 23:52
38854a9 to
06249b6
Compare
Base automatically changed from
ehsan/super35-video-data-support
to
super-v3.5-posttraining
September 18, 2026 07:04
ehosseiniasl
force-pushed
the
ehsan/super35-video-media-alignment
branch
from
September 18, 2026 16:28
06249b6 to
a37eb43
Compare
…er runs Async GRPO VLM training crashed mid-run with "Expanded-sequence media alignment failed: found 32160 valid placeholders for 40800 projected features". The generation engine sizes image tiles per request (shrinking them as prompts approach max_model_len); the training-side attach path re-processed the original images under the processor's static config budget, so budget-bound rows (e.g. 16 frames at 2400x1080 in a near-32k prompt) produced more projected vision features than the rollout's placeholder tokens, and the model forward raised on every rank. Derive the truth from the rollout itself instead of mirroring the engine's budget arithmetic: - multimodal_utils: parse per-image <img><image>*N</img> placeholder runs out of the rollout token ids; verify the processor's native output against them and, on mismatch, re-process each image pinned to the exact run length (budget pin via the image processor's max_model_len clamp, with a deterministic exact-grid resize fallback). Raise rather than attach misaligned media. - nemo_gym actor: pass each turn's placeholder runs into the attach; with deduplicate_multimodal_data on, keep the omission only when the statically-budgeted pre-attached tensors provably match the rollout's first-turn runs (predicted via the processor's own grid math), else attach rollout-matched tensors actor-side. - rollouts: the driver-side static reattach never overwrites media the actor already attached; video rows are unaffected (their tensors attach at datum time and their turns carry no extracted images). Verified offline against the checkpoint processor (exact-count repair across a 7-size x 7-budget sweep; the crash row now yields exactly matching feature counts; non-binding rows byte-match the previous fast path) and in production: the failing run resumed through the previously fatal batch and trained to completion with no alignment errors. Signed-off-by: Pulkit Kumar <[email protected]> Signed-off-by: ehosseiniasl <[email protected]>
…s relocated - Replace the key-presence reattach guard with an explicit provenance marker (ROLLOUT_MATCHED_MEDIA_KEY): the attach sets it only on turns it actually REPAIRED to the rollout's placeholder runs, and the driver-side static reattach skips (and consumes) exactly those turns. Unmarked values — including placeholder or stale payloads — are replaced as before, restoring the documented behavior of test_reattach_original_multimodal_payloads_is_media_only_and_turn_aligned, and unrepaired turns keep the shared-tensor restore across a prompt group's repeated rows. - Move the Nemotron-specific parity logic (placeholder-run parsing, static budget prediction, exact-count re-processing and grid math) out of multimodal_utils into the existing Nemotron helper module (nemo_rl/environments/nemotron_utils.py). The generic attach keeps only the verification contract and delegates the repair via a local import; processors without the placeholder grammar degrade gracefully as before. - Add a regression test: a marked turn keeps its rollout-matched tensors and the marker is consumed, while unmarked representations are still restored from the static source. Signed-off-by: Pulkit Kumar <[email protected]> Signed-off-by: ehosseiniasl <[email protected]>
…ambiguity A placeholder-run length does not uniquely identify the rollout engine's preprocessing grid (several grids share one product), so the closest-aspect fallback could pass count validation while training against different pixels and spatial feature ordering than generated the rollout. Remove the grid inference: when re-running the processor under the rollout's own budget does not reproduce the count, raise RolloutGeometryUnderdetermined. The Gym actor converts that into a per-sample fail-soft instead of a run failure: strip all media from the sample (partial media would leave the model with fewer projected features than placeholder tokens; the per-row media validity mask then treats its placeholder ids as ordinary tokens), mark every user turn rollout-matched so the driver-side static reattach does not restore misaligned tensors, and flag the sample for loss masking.
…log views NemoGym returns input_message_log as a slice of message_log, so both views alias the same message dictionaries. Reattachment popped the marker while processing the first view and then overwrote the rollout-matched media when it met the same dictionary, markerless, via the second view. Thread one processed-id set through the reattach call sites (including the prompt log and completion logs in the rollout manager, which can alias the same turns) so each unique message is handled exactly once. Regression test places the exact same marked object in both views.
…attach Video rows attach statically-preprocessed tensors (one <img><image>*k</img> run per tubelet) to vLLM-authored rollout tokens. When vLLM's own expansion disagrees (different per-frame grid or tubelet count), training crashed deep in Megatron with an unattributable 'Expanded-sequence media alignment failed'. Compare the placeholder-run structure of the rollout tokens against the static source tokens before the attach and raise a diagnostic that names the mismatch: run counts, per-run lengths, first mismatching run, num_frames and frame size. Plumbed the tokenizer through attach_static_multimodal_payload's two live call paths (RolloutWorker.run_rollout, run_async_nemo_gym_rollout); verification is a no-op for image-only turns or when no tokenizer is passed. Signed-off-by: ehosseiniasl <[email protected]>
ehosseiniasl
force-pushed
the
ehsan/super35-video-media-alignment
branch
from
September 18, 2026 16:44
a37eb43 to
49669fa
Compare
yfw
approved these changes
Sep 18, 2026
arendu
added a commit
that referenced
this pull request
Oct 7, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127)
arendu
added a commit
that referenced
this pull request
Oct 7, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127)
arendu
added a commit
that referenced
this pull request
Oct 7, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127) Signed-off-by: adithyare <[email protected]>
arendu
added a commit
that referenced
this pull request
Oct 7, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127) Signed-off-by: adithyare <[email protected]>
arendu
added a commit
that referenced
this pull request
Oct 7, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127) Signed-off-by: adithyare <[email protected]>
aroshanghias-nvd
pushed a commit
that referenced
this pull request
Oct 17, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127) Signed-off-by: adithyare <[email protected]> (cherry picked from commit 13d0a9d)
aroshanghias-nvd
pushed a commit
that referenced
this pull request
Oct 22, 2026
Port of the backend-independent parts of super-v3.5-posttraining 2ad27a6 (#4187), 501709c (#4189) and a6951c0 (#4199): - Register NemotronH_Omni_Reasoning_V3Processor and NemotronH_Super_Omni_Reasoning_V3Processor as placeholder-style image processors and as Nemotron video processors. - Mixed Gym manifests: only rows that actually carry video media (cached frames or native video parts) take the static-video path; still image rows in the same manifest fall through to the regular Gym placeholder instead of raising. The placeholder token_ids are int64 so mixed batches collate. - data.image_max_num_tiles: logical tile cap kept on the row for Megatron postprocessing and forwarded to vLLM as mm_processor_kwargs.max_num_tiles through the existing _inject_vllm_mm_processor_kwargs helper. - configure_generation_config respects an explicit vllm_cfg.load_format (VLM training needs "auto": the frozen vision tower is never refitted). - _apply_mtp_config: mtp_num_layers=0 also strips mtp_hybrid_override_pattern, mtp_use_repeated_layer and the "/M" MTP suffix of hybrid layer patterns so HybridProvider.finalize() does not re-add an MTP section. - resolve_vllm_video_config rejects the legacy vllm_cfg.video_loader key. - Gym image extraction treats only inline data:image URLs in tool outputs as images and skips unresolvable sources instead of crashing postprocessing. Not ported: f871add (#4188, rollout/train media re-processing at rollout placeholder budgets) and the NanoVLV2 fixed-tile imgs_sizes guard. Main addresses rollout/train media alignment through vLLM media capture (nemo_rl/data/captured_media.py, _capture_request_media) and has restructured the imgs_sizes backfill, so those changes do not apply as written; see the PR description. Co-Authored-By: Claude Fable 5.1 <[email protected]> (cherry picked from commit 1312127) Signed-off-by: adithyare <[email protected]> (cherry picked from commit 13d0a9d)
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.
Scope of this PR
Rollout/media alignment only:
The two later Pulkit correctness follow-ups are included:
632e2f2and84fe6df. Their behavior activates only on problematic image-tiling paths; normal SA-V video and CapRL rows are unchanged.Remaining review stack
Please review and merge in that order. This PR deliberately excludes dataset ingestion, Gym changes, and experiment configuration.