Repository navigation
feat: store by-handle sampling masks as CSR - #3962
Closed
faresobeid wants to merge 6 commits into
Closed
faresobeid wants to merge 6 commits into
faresobeid wants to merge 6 commits into
Conversation
…ode runs A train request whose extra_args carries payload_dir (set by the orchestrator when orchestrator.payload_root is set; rl sets it to <run dir>/payloads on multi-node runs with router replay or sampling-mask capture) gets its routed_experts and sampling_mask written to one file under payload_dir/v<dispatch version> and returned as payload segments. Verifiers attributes the segments to trace nodes; the orchestrator clips and packs them. GC: the orchestrator wipes payload_root on a fresh run and deletes v<k> once no unread batch can reference it. Files that no queued sample points into (dropped groups, untrainable branches, pruned samples, traces swept as stale) are deleted as soon as the sink drops them. Ported to vLLM 0.31: the inline path keys on aux_output_config.enable_return_routed_experts. Disaggregated P/D and score centering stay inline (rejected with an explicit payload_root). Bumps verifiers and renderers to their by-handle branches.
…gprobs) PAYLOAD_FIELDS declares each by-handle field once with its fill value and read window: routed_experts and routed_expert_weights (input positions, CP chunk), sampling_mask (label positions), sampling_mask_logprobs (whole sequence, consumed after the CP gather). The writer, packing, truncation, dummy batches and the trainer reader go through the table, so a new field is one line plus its writer.
faresobeid
force-pushed
the
feat/payload-fields
branch
from
October 10, 2026 15:11
75760d8 to
fb41a04
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.
Stacked on #3904.
What
By-handle sampling masks (and score-centering mask logprobs, when they come back) were written as
[tokens, widest row]arrays padded to each request's widest row. At top_p 0.97 a sampled token keeps 1.7 ids on average but requests run ~32 wide, so a mask cost ~128 B per completion token (~35% of payload bytes on math, plus the same again for mask logprobs) against ~11 B inline. This stores them as CSR instead.PayloadField.raggedmarks fields with rows of varying width (sampling_mask,sampling_mask_logprobs).ragged_bytes):rows + 1uint32 file offsets where each row's values start (the last one is where the last row ends), then the values (int32 for an int fill, float32 for a float fill). The segment's rows are the offsets (dtype="uint32",shape=[]), so the orchestrator and verifiers clip segments exactly as before, with no knowledge of row widths and noPayloadSegmentchange._PackedOutputspasses(counts, ids)straight from perf(inference): pack /generate per-token payloads and tune API-server GC #3900'sPackedSamplingMask;_write_payloadlays ragged fields out withragged_bytes. Score centering would add("sampling_mask_logprobs", prompt_len, (mask.counts, logprobs)).csr_rowsis gone; the fixed-width and ragged paths share one concurrent_preadover(file, offset, size)reads with the short-read retry.Size: ~4 B per completion token + 4 B per kept id (~11 B at 1.7 ids) instead of ~128 B.
Tests
test_payload_by_handle_matches_inlinenow writes masks and mask logprobs withragged_bytes, one CSR region per sample split into two segments mid-request (a clipped head), and still checks bitwise equality with inline through truncation, packing, padding, 2 DP ranks and CP 1/2.test_inline_and_by_handle_samples_keep_their_masks,test_payload_dir_writes_routing_and_masks_by_handle(reads the written file back throughread_field),test_pread_retries_short_reads.pytest tests/unit/orchestrator tests/unit/test_configs.py tests/unit/inference tests/unit/train/rl -m "not gpu"on vLLM 0.31.0 with feat: write router-replay ids and sampling masks by handle on multi-node runs #3903's pinned verifiers/renderers on the path,ruff check,ruff format --check: pass.VLLM_BATCH_INVARIANT=1, router replay + sampling masks, top_p 0.95 / top_k 50):payload_dir; tokens equal, response 33.4 MB → 0.06 MB.read_fieldequals the inline(ids, counts), and each routing segment equals the inline routing.prepare_batch+DataLoader._micro_batch_to_tensor(seq_len 16384/4096 with truncation, 2 DP, CP 1/2/4; every other sample's segments split at a random position) give 140/140 micro batches whose routing and masks are bitwise equal to inline (masks at the micro batch's width, no trimming).