Skip to content

refactor(rollout): read the output store one field per sample and step - #370

Merged
Rockdu merged 2 commits into
mainfrom
rockdu/output-store-per-step
Nov 11, 2026
Merged

Rockdu merged 2 commits into
mainfrom
rockdu/output-store-per-step

Conversation

@Rockdu

@Rockdu Rockdu commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • The rollout parser turns a list of {"__store__": ...} markers into a list of placeholders, one per step.
  • StoreSlice becomes StoredTensor(ref, field): one whole stored field. Its rows, select, shape, __getitem__, _row_index and the _rows replay in materialize are deleted. materialize_store_slices is renamed materialize_stored_tensors.
  • flow_grpo picks steps element-wise through the existing position map, so a tensor (inline) and a list of placeholders (store) take the same path. nft uses len().
  • On the inline path each per-step tensor is cloned (_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

Files

  • miles/utils/output_store.py: StoredTensor, materialize_stored_tensors.
  • miles/utils/diffusion_rollout_response.py: a marker list becomes a list of StoredTensor.
  • 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-commit passes on the changed files
  • Added/updated tests for new behaviour
  • Fast tests above are green (pre-existing macOS failures noted)
  • GPU e2e with the store on: not run yet

@Rockdu
Rockdu marked this pull request as ready for review November 11, 2026 01:39
@Rockdu Rockdu added the run-ci-e2e Run e2e metric-regression tests on this PR label Nov 11, 2026
@Rockdu
Rockdu added this pull request to stack #362 November 11, 2026 05:33
@Rockdu
Rockdu force-pushed the rockdu/output-store-per-step branch 2 times, most recently from 750b590 to 780ff6b Compare November 11, 2026 06:05
Base automatically changed from output-store/03-trainer-read to main November 11, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci-e2e Run e2e metric-regression tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant