action dataloader: episode-shuffle stream (fix DROID grad-norm instability)#37
Open
fwd4 wants to merge 1 commit into
Open
action dataloader: episode-shuffle stream (fix DROID grad-norm instability)#37fwd4 wants to merge 1 commit into
fwd4 wants to merge 1 commit into
Conversation
The DROID action dataset is map-style and (unlike the iterable vision SFTDataset) does not self-shuffle, and RankPartitionedDataLoader wrapped it in a DataLoader with no shuffle -> SequentialSampler. Every rank then iterated the same consecutive, overlapping windows, so the all-reduced global batch was ~1 episode -> high gradient variance and an unstable, slow-settling grad-norm. Fix: ActionIterableShuffleDataset (iterable_shuffle=True) streams rank x worker-sharded, episode-order-shuffled, sequential-within-episode -- decorrelated batches with sequential reads (I/O locality + copy-on-write preserved; a plain RandomSampler instead does random-access I/O -> ~11min/iter + OOM). Mirrors i4's ActionUnifiedIterableDataset worker assignment. Adds DROIDLeRobotDataset.get_shuffle_blocks() for the per-episode/ segment index blocks the iterable streams. No DataLoader change needed -- IterableDataset is handled natively (sampler=None). Validated (256-rank-equivalent, 8192 global): grad-norm settles 27.8->2.9->1.7, tracking the internal reference (43->4.7->1.9) vs the no-shuffle run stuck at ~21; per-component action loss converges to ~0.0055 (matches internal ~0.005 vs the broken run's noisy 0.03-0.07). Signed-off-by: Hao Liang <haolia@nvidia.com>
f786168 to
8eec346
Compare
Collaborator
|
LGTM |
lfengad
approved these changes
Jun 12, 2026
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.
Problem
The DROID action SFT dataloader trained with an unstable, slow-settling grad-norm (and a noisy action-loss plateau) vs the internal reference. Root cause: the DROID action dataset is map-style and — unlike the iterable vision
SFTDataset, which self-shuffles — does not shuffle, andRankPartitionedDataLoaderwraps it in aDataLoaderwith noshuffle, i.e. aSequentialSampler. Every rank then iterates the same consecutive, overlapping windows, so the all-reduced global batch is effectively ~1 episode → high gradient variance.(Forward + gradients were verified numerically equivalent to the internal model on identical input, so this was a data-path issue, not the model/loss/optimizer.)
Fix
ActionIterableShuffleDataset(iterable_shuffle=True): anIterableDatasetview of the map-style dataset that streams rank × worker-sharded, episode-order-shuffled, sequential-within-episode — decorrelated batches with sequential reads (preserves I/O locality + copy-on-write; a plainshuffle=True/RandomSamplerinstead does random-access I/O → ~11 min/iter and OOM from broken COW). Mirrors the internal iterable dataset's per-worker episode assignment.DROIDLeRobotDataset.get_shuffle_blocks()(per-episode/segment flat-index blocks the iterable streams).DataLoader/sampler change needed —IterableDatasetis handled natively (sampler=None).Validation (8192 global batch)
Per-component action loss converges to ~0.0055 (matches internal ~0.005; the no-shuffle run plateaued noisily at 0.03–0.07). Builds on #24 (recipe + FusedAdam optimizer).
🤖 Generated with Claude Code