Pages on this design, one question each. This one: who does each P/D job, and what one shared interface would look like.
Before
P/D runs natively for TRT-LLM on main, and for vLLM in the open #4920. Behind Dynamo, main has only vLLM without P/D: every engine registers as one backend component. Megatron P/D behind Dynamo is the six-PR stack above.
This page
Compares where each design does each P/D job, against the shape main already uses for vLLM + Dynamo: one adapter base that a backend fills in with a few methods, and NeMo RL's own chat engine in the frontend.
Status
Proposed — a design comparison. Nothing in the target section is implemented. The #4801-sized parts are review comments C9–C12; the engine-side asks are staged on #5023, #5024, #5025 and #5097.
Background. In P/D, a replica is P prefill engines plus D decode engines, each with its own width (TP × PP). On main, vLLM behind Dynamo runs NeMo RL's own adapter base inside the native worker, so refit, pause, capture, forest training and prefix recovery work unchanged. Dotted words have a short explanation: hover or tap them.
Where each design does each job
Three things stand out:
The frontend chat side is already shared. #5097 moves NemoRLChatEngine out of dynamo/vllm/ and adds a ChatBackend interface with a vLLM and a Megatron implementation. This is the pattern to copy everywhere else.
The engine side is not. Megatron subclasses Megatron-LM's own adapter instead of main's DynamoEngineAdapter, sends rollouts through a copied client whose retry rules differ, and stages capture through a third path. So routed experts and generation cuts are missing, and the driver builds each rollout's sampling settings as OpenAI fields, which Megatron-LM translates back, instead of the worker building them as native generation does.
The layout is split three ways. #4920 makes disagg_layout.py shared by TRT-LLM and vLLM. The Megatron stack computes its own roles and widths, and keeps per-role engine knobs in dynamo_cfg, where TRT-LLM and vLLM keep them in the backend's own block.
The target: one interface, two thin backends — proposed, not in any PR
Nothing below is implemented. Everything green is written once. A backend writes only the blue boxes.
The four engine methods are the ones main already asks of every backend (engine_adapter.py L148-L169). P/D adds two: the engine's role, which picks the Dynamo component it registers as (main hard-codes backend), and the KV handoff: the prefill leg returns its transfer handle and the decode leg takes it. Dynamo's SDK (ai-dynamo 1.8 on main) already routes both legs: an engine sets WorkerConfig.disaggregation_mode, the prefill leg puts an opaque handle in disaggregated_params on its last chunk, and the frontend passes it to the decode leg as prefill_result. A decode engine never calls prefill. So a backend writes serve_prefill (returns the handle), takes the handle in serve_rollout, and may write release_handoff (Megatron-LM claims and releases prefill blocks; vLLM's NIXL needs nothing). Two things are not checked yet: whether Dynamo's prefill router keeps NeMo RL's request annotations, and what happens when a refit lands between the two legs (the base should refuse a handle from older weights).
The fleet jobs are the same in all three P/D designs: plan the roles, give each engine its own refit ranks (the earlier widths added up, as worker_offset in #4801 does), pause prefill before decode, and refuse partial membership. Each design writes them again today. A backend only needs to supply its engine width and config per role.
What this means for #4801 and the rest of the stack
#4801 sets the config and layout shape every later PR builds on, so its parts are cheap to fix now:
C10: import dynamo_enabled and the shared frontend fields from dynamo/config.py, instead of a second schema.
C11: build roles and widths on #4920's shared layout module, and add Megatron to its allowed backends (otherwise the two PRs refuse each other).
C12: keep per-role layouts in mcore_generation_config, as TRT-LLM and #4920 keep them in their own blocks.
C9: remove dynamo_cfg.control_timeout_s: main rejects it, and on main the caller passes each control call its timeout.
The engine-side asks are staged on the later PRs, for their own reviews:
#5023 C1: base the Megatron adapter on DynamoEngineAdapter, not Megatron-LM's MegatronLLMEngine, and add the prefill/decode hooks (serve_prefill, serve_rollout(handoff=), release_handoff) to the shared base there.
#5024 C1: use the caller's timeout_s instead of control_timeout_s.
#5024 C2: refuse fleet health with Megatron engines behind Dynamo; the engine set is fixed.
#5025 C1: send rollouts through main's rollout_client, so the worker builds the sampling settings and errors match native generation.
#5097 C1: setup_token_capture lacks three required arguments, so token capture fails at startup with a TypeError.
#5097 C2: write routed experts from the engine's final record, as native Megatron does.
So what. Half of the "one interface" goal is already built: #5097's shared chat engine and #4920's shared layout. The other half is the engine side, where Megatron still goes around main's adapter. Moving it onto DynamoEngineAdapter plus the two P/D methods would let vLLM P/D behind Dynamo reuse all of it, so it would not need a fourth design. The review links work for others only after the review is published.