How an FP8 expert weight crosses the nccl_reshard refit, before and after this PR

NVIDIA-NeMo/RL #4525 (refactor(refit): restore canonical HF pre/post hooks). All permalinks pin head 74295f6; "before" links pin the merge base 66c0925.

Before
Blockwise-FP8 training weights went over the wire as raw FP8 bytes. Their scales took a second, slower path into vLLM's own loader.
This PR
Every quantized source is decoded to BF16 before sending. The receiver quantizes it again into its own format, scales included.
Status
Implemented in this PR. Simpler and allows more format pairs, at 2× the wire bytes for FP8 sources. One regression came with it; see the next page.

Two pages on this PR, one question each. This one: what moves where, before and after.

Background. A refit copies new weights from training to the generation engine after each step. With refit_transport: nccl_reshard, the big FFN weights (gate, up, down, dense and MoE) go on a bulk path: one point-to-point NCCL transfer per weight, resharded from training layout to generation layout. Everything else goes on a misc path: a packed broadcast loaded through the engine's normal weight loader. Each side describes each weight with a LocalParamSpec: pre builds the send/receive buffer, post commits it. Dotted words have a short explanation: hover or tap them.

The example is one MoE expert's gate_proj weight, shape [768, 2048], stored as Transformer Engine blockwise FP8 (one scale per 128×128 block, so a [6, 16] scale grid). It goes to a vLLM engine also running blockwise FP8. On the PR side, the source hook pre decodes and picks the BF16 wire dtype. The vLLM hook _blockwise_fp8_receiver_quant_spec quantizes the weight again on arrival.

One weight, two paths

BEFORE (main @ 66c0925) AFTER (this PR @ 74295f6) training param (TE blockwise FP8) values fp8 [768,2048] + scale_inv f32 [6,16] bulk: raw bytes fp8 [768,2048] 1 byte/elem = 1.5 MiB no decode, sent as-is misc: scales scale_inv [6,16] packed broadcast _scale_inv → misc (base) vLLM w13 slice bytes copied in directly wire == param dtype (base) vLLM load_weights vLLM's own loader writes the scales (and adapts them to vLLM's grid, see page 2) Format decided per backend by get_refit_payload_mode(), threaded through every synchronizer; plus a per-layer source cache. training param (TE blockwise FP8) values fp8 [768,2048] + scale_inv f32 [6,16] source pre(): decode, then pick the HF slice bf16 [768,2048] 2 bytes/elem = 3 MiB on the wire _default_param_spec.pre materialize(): dtype check source scale_inv is dropped from misc for bulk weights receiver post(): quantize again into vLLM storage fp8 [768,2048] + new scale_inv [6,16] _blockwise_fp8_receiver_quant_spec misc scale exclusion No format negotiation: the wire is BF16 for any quantized source, and an unquantized source keeps its dtype (BF16/FP16/FP32). Source hooks read live params, no cache. Same in both: the transfer loop (xferdtensor per weight, same metadata order on both sides), and the misc path for attention, embeddings, router, KV-cache scales. A BF16 → BF16 weight still goes straight into the vLLM param. raw FP8 on the wire new hook in this PR

What this buys, and what it costs

BeforeThis PR
Who knows the storage formatboth ends, plus a negotiated modeonly the hooks on each end
Format pairs allowed at setupBF16→BF16, blockwise→blockwise, BF16→MXFP8most pairs (see the PR's design-doc table)
Wire bytes for an FP8 source1 byte/elem2 bytes/elem, plus decode + quantize
Who writes the scalesvLLM's loader, via miscthe receiver hook, with the values
So what. The transfer loop no longer cares how either side stores a weight. That is why this PR could delete refit_payload_mode and the source cache, and allow format pairs main rejected. The price is 2× wire bytes for FP8 sources. There is no FP8 timing after the change yet; the review asks for one. Also, the receiver now computes scale shapes itself, where vLLM's loader used to. On one vLLM MoE layout it gets that shape wrong: page 2.