How images would reach the TQ write when prefill and decode are split

PR #5097 (6 of 6 in the Megatron prefill/decode stack) ยท main a723b597 ยท #5097 head 751efd79 ยท Megatron-LM e0a4bfed ยท Dynamo nightly 1.8.0.dev20261117 (source read at 4573c9b6)

Before
Behind Dynamo (vLLM, aggregated), the frontend runs the HF processor and sends the pixel tensors to the one engine, which writes them to TQ with the call's tokens.
This PR
Megatron behind Dynamo is text-only: #4912 refuses a processor and #5097 refuses any call with media. So no media has to move yet.
Status
Proposed design for the later multimodal PR โ€” not implemented. Nothing is broken today. The answer below needs no new transport: Dynamo already hands the decode leg the frontend's request extras.

Four pages on #5097, one question each; the first chip is an earlier PR in the stack. This one: once images are allowed, who writes them to TQ, and how do they get there?

Background. For an image, the HF processor turns raw pixels into model inputs. Training needs those exact inputs, so the TQ write stores them with the call's tokens. With prefill/decode, the prefill engine runs the vision encoder; the decode engine only imports the finished KV cache and writes the answer, and is the one that writes to TQ. Dotted words: hover or tap.

Today's single-engine flow, and the same flow split in two

Today: vLLM behind Dynamo, one enginemain Proposed: Megatron behind Dynamo, prefill + decodelater multimodal PR; nothing new to transport Gym โ†’ messages + raw image (in the request body) Dynamo frontend process render pool: HF processor โ†’ ids [1,9,9,9,4] + pixels [1, 3, 8, 6] R TQ: token prefix only (no media) KV router sees ids only extra_args.nemo_rl.multimodal = pickled pixels vLLM worker process (one engine) unpickle โ†’ engine prompt vision encoder โ†’ KV โ†’ generate begin: copy pixels; R TQ earlier media finalize W TQ once: ids, logprobs, routes, pixels Gym โ†’ messages + raw image (in the request body) Dynamo frontend process render pool: HF processor (as today) โ†’ ids [1,9,9,9,4] + pixels [1, 3, 8, 6] R TQ: token prefix only (no media) KV router sees ids only same extra_args prefill leg = req.clone() decode leg keeps extra_args prefill engine, rank 0 pixels โ†’ vision encoder โ†’ prompt KV cache no TQ access KV handoff: KV + resume state, no media decode engine, rank 0 import KV โ†’ generate (no pixels needed to compute) begin: copy pixels from extra_args; R TQ earlier media finalizeW TQ once: ids, logprobs, routes, pixels works today proposed: decode does what the single engine does processed pixels in the request's extra_args pixels [1, 3, 8, 6] = [images, colors, height, width]: 1 RGB image, 8 pixels tall, 6 wide, after the HF processor. ids: 9 = image placeholder. Dashed boxes = one OS process. Underlined names link to the code. R/W TQ = the call's one TQ read / one TQ write.

Why decode should write, and the pixels should ride the request

OptionWhat it costsVerdict
Frontend sends processed pixels in extra_args; decode writes oncePixels travel twice (prefill needs them for the encoder; decode only to write them). No new code path: Dynamo's prefill router clones the request for prefill and keeps extra_args on the decode request, so decode already receives them.Recommended. Keeps one TQ write per call, with tokens, logprobs, routes and media together, and reuses today's begin/finalize code.
Frontend writes the pixels to TQ itselfTwo writes per call: a failure between them can leave tokens without their media. The frontend's TQ client also turns from read-only into a writer.No.
Prefill ships pixels to decode inside the KV handoffMegatron-LM's handoff has no field for media; it needs a Megatron-LM wire change.No.
Decode re-runs the HF processorWasted CPU, and the result can differ from what prefill encoded.No.

Two checks for the multimodal PR: (1) decode imports prefill's KV by block hash, so two prompts with the same token ids but different images must not share blocks โ€” confirm Megatron-LM's block hash covers the image, not only block_hash_salt; (2) #5097's adapter still marks the "decode gets the frontend's extra_args" fact as a DRAFT assumption (adapter.py L198); it holds at the pinned Dynamo nightly, so the note can cite the router code instead.

So what. Images need no new transport under prefill/decode. Dynamo already gives the decode leg the frontend's request extras, so the frontend's processed pixels reach the engine that writes TQ, just as they reach the single engine today. The multimodal PR should keep the one write on decode, check the block hash, and lift the two text-only refusals (#4912's processor check and #5097's media check).