[DEV] fix(multimodal_dev): derive mock samples from the sample index - #6287
Open
xuwchen wants to merge 1 commit into
Open
[DEV] fix(multimodal_dev): derive mock samples from the sample index#6287xuwchen wants to merge 1 commit into
xuwchen wants to merge 1 commit into
Conversation
xuwchen
force-pushed
the
multimodal-dev-mock-index-determinism
branch
5 times, most recently
from
August 6, 2026 09:10
5051f25 to
4c07f79
Compare
The dataset drew from ambient CPU RNG and ignored idx. Ranks share the CPU seed unless data_parallel_random_init is set, so every rank of a data-parallel group drew the same stream and the distinct samples in a global batch collapsed to the per-rank microbatch count — a number that changes with the parallel layout, so two configurations being compared saw different data. Each sample is now derived from (seed, split, idx). The split name keeps the train/valid/test datasets apart: sharing one stream would make them emit identical samples, trading duplication across ranks for duplication across splits. The provider passes args.seed through, which the ambient-RNG version got for free. The parts are hashed with blake2b rather than added. Addition overlaps by construction: idx=1 under seed S is idx=0 under seed S+1, and each split would replay the previous one shifted by one index. Since idx now determines content, out-of-range indices raise IndexError instead of silently hashing to a plausible sample from outside the dataset. Signed-off-by: xuwenc <xuwenc@nvidia.com>
xuwchen
force-pushed
the
multimodal-dev-mock-index-determinism
branch
from
August 6, 2026 12:54
4c07f79 to
716a9e7
Compare
xuwchen
marked this pull request as ready for review
August 6, 2026 13:29
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?
MockQwen35VLDataset.__getitem__ignoredidxand sampled from the ambient CPU RNG. Withdata_parallel_random_initdisabled, corresponding data ranks start from the same CPU RNG state, so sample identity depended on local draw order rather than the sampler index. When two layouts used different full data-distribution degrees, a nominal global batch contained different sample sets and different numbers of distinct samples, invalidating loss and gradient A/B comparisons.Sample generation is now keyed by
(seed, split, idx), with--seedand the split propagated by the dataset provider. A BLAKE2b-derived seed initializes a private generator for token and pixel generation, making sample identity independent of rank, worker, access order, and ambient RNG, while split-specific keys keep train, validation, and test samples disjoint. Out-of-range indices and an undersizedimage_seq_lengthnow raise early instead of failing silently later.Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.