Repository navigation
feat(fsdp): read a shard's store slices back from the output store before training on it - #361
Merged
Merged
Conversation
zhihengy
force-pushed
the
output-store/03-trainer-read
branch
from
November 6, 2026 22:12
b172433 to
e3c939e
Compare
This was referenced Nov 6, 2026
Merged
zhihengy
force-pushed
the
output-store/03-trainer-read
branch
3 times, most recently
from
November 10, 2026 13:28
6e25186 to
f5a594e
Compare
zhihengy
force-pushed
the
output-store/03-trainer-read
branch
from
November 10, 2026 13:35
f5a594e to
80be9ae
Compare
3 of 4 tasks
Rockdu
force-pushed
the
output-store/03-trainer-read
branch
from
November 11, 2026 06:02
80be9ae to
03d8658
Compare
…fore training on it
Rockdu
force-pushed
the
output-store/03-trainer-read
branch
from
November 11, 2026 06:05
03d8658 to
407d2a5
Compare
This was referenced Nov 11, 2026
Merged
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.
ci-sglang-pr: #48959
Third of three, on #360. With this the switch works end to end: the engines store, the rollout side carries slices, the trainer reads.
Summary
A train pair of a store run holds
StoreSlices where the inline path holds tensors:latent,next_latentorx0, the debug step tensors, and theCondKwargsleaves of itsdenoising_env. Each train worker, right after it fetches its shard, reads every stored object the shard's slices name once (OutputStore.read_manywith theTensorStash) and replaces each slice with its rows, in place: the dicts, lists and dataclasses that the pairs of one sample share are replaced once._train_coreand the losses then see the tensors they always saw, in the producer's dtype.Changes
materialize_store_slices(miles/utils/output_store.py): collect the slices under the pairs (dicts, lists, dataclasses), one read per object with the fields it needs, then the rows of each slice (rows, then a pending selection).FSDPTrainRayActor.initconnects a reader with the switch;trainmaterializes the shard before_train_corewhenargs.use_output_storeis set, so nothing changes without it.Tests
tests/fast/utils/test_output_store_materialize.py: the same samples once with tensors and once with slices of one stored object, throughflow_grpo.expand_samples_to_train_pairs; after materialization every pair field istorch.equalto the inline pair's (latents in bf16, debug step, cond leaves, shared pooled), the object was read once with exactly the fields the shard needs, and a shard without slices reads nothing.tests/fast/backends,tests/fast/rollout,tests/fast/utils: 523 passed, 3 skipped (the two fake actors oftest_ema_optimizerandtest_async_trainingnow carry the switch in their args).