fix(sft): scope deterministic training randomness - #102
Merged
Conversation
zhihengy
force-pushed
the
fix/sft-rng-scoping
branch
from
August 7, 2026 11:43
98a0003 to
4fd5362
Compare
zhihengy
force-pushed
the
fix/sft-rng-scoping
branch
3 times, most recently
from
August 7, 2026 20:02
a53e706 to
26f52a0
Compare
Keep expert selection rank-aligned while giving each logical DP replica an independent sample stream, and constrain single-expert Wan runs to their timestep range. Co-authored-by: Cursor <cursoragent@cursor.com>
zhihengy
force-pushed
the
fix/sft-rng-scoping
branch
from
August 7, 2026 20:11
26f52a0 to
026a87d
Compare
Rockdu
reviewed
Aug 7, 2026
pair_lo // micro_bs only identifies a micro-batch while every micro-batch starts at a multiple of micro_bs; under dynamic micro-batch sizes it would silently collide and hand two micro-batches identical noise. Seed with the enumerated (optim_step_idx, microbatch_idx) instead, offsetting the old-log-prob recompute loop by one step so both passes keep drawing the same noise/timesteps for the same micro-batch. Co-authored-by: Cursor <cursoragent@cursor.com>
…tch_id The loss hub only needs an opaque RNG-stream identity, so fold (optim_step_idx, microbatch_idx) into a single ordinal inside the actor via cumulative per-step counts, which stays unique under dynamic micro-batch sizes and keeps recompute/train passes aligned. Co-authored-by: Cursor <cursoragent@cursor.com>
A plain counter enumerates micro-batches in schedule order; the recompute loop starts past window 0's micro-batches so both passes give the same micro-batch the same id. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Aug 8, 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.
Summary
Test plan
pytest -q tests/fast/backends/fsdp_utils/test_loss_hub_sft.py