Repository navigation
refactor(rollout): read the output store one field per sample and step - #370
Merged
Merged
Conversation
3 of 4 tasks
Rockdu
marked this pull request as ready for review
November 11, 2026 01:39
This was referenced Nov 11, 2026
Rockdu
force-pushed
the
rockdu/output-store-per-step
branch
2 times, most recently
from
November 11, 2026 06:05
750b590 to
780ff6b
Compare
Rockdu
force-pushed
the
rockdu/output-store-per-step
branch
from
November 11, 2026 06:06
780ff6b to
dc598ec
Compare
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: #49693
Stacked on #361 (the output-store stack #359 -> #360 -> #361); the diff here is the two commits above it. Needs sgl-project/sglang#49693, which stores latents and debug tensors as one output-store field per step (on top of sgl-project/sglang#48959). The two land together: with
--use-output-store, this reader expects the per-step format.What
{"__store__": ...}markers into a list of placeholders, one per step.StoreSlicebecomesStoredTensor(ref, field): one whole stored field. Itsrows,select,shape,__getitem__,_row_indexand the_rowsreplay in materialize are deleted.materialize_store_slicesis renamedmaterialize_stored_tensors.flow_grpopicks steps element-wise through the existingpositionmap, so a tensor (inline) and a list of placeholders (store) take the same path.nftuseslen()._own_row), so a train pair owns exactly its step's storage.Why
With one field per step, a trainer shard reads only the steps it trains on, and a placeholder never needs a row index. Debug tensors are where the bytes go: with wan22's debug mode (T=10, one trained step), a shard used to read ten steps of each debug tensor per sample to use one.
The clone fixes a transport blowup on the inline path that also exists on main: the old code copied the trained steps with advanced indexing and gave each pair a view into that copy, and pickling a view writes its whole storage. Through Ray's serialization, one sample with all 10 steps trained shipped 200 step tensors for the 20 it uses; with the clone it ships 20.
Validation
tests/fast/utils tests/fast/rollout: 308 passed. The 9 errors intest_async_training.py(AF_UNIX socket path too long on macOS) and the failure intest_metric_buffer_dist.pyhappen on feat(fsdp): read a shard's store slices back from the output store before training on it #361's head too. The six touched test files: 24 passed. Each changed test fails on feat(fsdp): read a shard's store slices back from the output store before training on it #361's code.flow_grpo/nftand this branch's, on the same msgpack-decoded sglang responses. An sd3_ocr-like trajectory (10 steps all trained), a wan22-like window (1 step, debug on) and a non-contiguous window gave 309 pair tensors bitwise equal in value and dtype; nft'sx0is equal.Files
miles/utils/output_store.py:StoredTensor,materialize_stored_tensors.miles/utils/diffusion_rollout_response.py: a marker list becomes a list ofStoredTensor.miles/ray/data_conversion_hub/flow_grpo.py: element-wise step pick,_own_row.miles/ray/data_conversion_hub/nft.py:len()on the latents.miles/backends/fsdp_utils/actor.py: renamed call.tests/fast/...: per-step fields read, marker lists, element-wise compares, storage ownership.Checklist
pre-commitpasses on the changed files