How a NeMo RL rollout reaches vLLM through Dynamo, before and after this PR

NVIDIA-NeMo/RL #4905 (stacked on #4978, under #4979). Permalinks pin head 44671d3b; removed code is linked at the base 1fe249f6.

Nine pages on this stack (#4905, #4979 and #5115), one question each. This one: the old Dynamo backend vs the new one.

Before
backend: dynamo started Dynamo's own vLLM (python -m dynamo.vllm) in a separate venv, one process per GPU group, and refit its weights over HTTP.
This PR
backend: vllm + dynamo: true. NeMo RL's own vLLM workers register with the Dynamo frontend and serve each rollout with the same method the native path uses.
Status
In review, not merged. CI is green on the functional and unit lanes. The review found no correctness bug; its asks are about test coverage and small guards (bottom of the page).

Related pages: #4979 · NeMo-Gym through Dynamo · #4801 · Megatron Dynamo switch

Background. Dynamo puts one HTTP frontend in front of all generation engines. Its KV router sends each request to the engine that already has most of the prompt cached. A rollout here is one prompt in, and generated token ids plus their log-probs out. Below, [t0 … tP-1] means the prompt's P token ids, and G is the number of generated tokens. Dotted words have a short explanation: hover or tap them.

Before, the driver's DynamoGeneration set the sampling settings in the HTTP request, and a separate dynamo.vllm process did the work. After, VllmGeneration._generate_through_dynamo sends only the prompt and a tag. The tag tells NativeVllmEngine, which runs inside NeMo RL's own vLLM worker, to sample the request from its generation config, exactly as native generate_async does.

One rollout, two paths

Before: backend: dynamo (removed) After: backend: vllm, dynamo: true 1 · Driver sets the sampling in the request POST /v1/completions {prompt: [t0 … tP-1], temperature, top_p, top_k, logprobs: 0, stop: […], max_tokens} _build_completion_request · dynamo_generation.py:468 1 · Driver sends the prompt and a tag only POST /v1/completions {prompt: [t0 … tP-1], ignore_eos: true, nvext.annotations: ["nemo_rl:rollout:{greedy, stop_strings}"]} rollout_payload · rollout_client.py:92 2 · Dynamo frontend (Rust): the KV router picks the engine that has most of [t0 … tP-1] cached same in both · needs etcd, NATS and the frontend, which NeMo RL starts and stops itself 3 · A separate dynamo.vllm process serves it python -m dynamo.vllm, one per GPU group, from its own venv (/opt/dynamo_venv) weights updated over HTTP /engine/* routes launch · dynamo_worker.py:172 refit · refit.py:85 3 · NeMo RL's own vLLM worker serves it NativeVllmEngine, registered by Dynamo's backend SDK on the worker's own event loop refit, pause, quantization: the worker's own start_dynamo_endpoint_async · :652 native_engine.py:261 ── from here: the same code native generate_async runs ── 4 · Dynamo's vLLM samples with the request's settings reply: choices[0].logprobs.token_logprobs [G], nvext.completion_token_ids [G] 4 · _serve_rollout(TokensPrompt([t0 … tP-1])) budget, sampling from the generation config, AsyncLLM.generate → RolloutResult (G tokens) engine · native_engine.py:204 native · :2148 5 · Driver rebuilds the output from the reply output_ids [P+G] = prompt + completion ids, logprobs [P+G], its own builder _single_sample_output · dynamo_generation.py:556 5 · Engine ships the RolloutResult back whole nvext.engine_data {rollout: wire(result), gen_leader_worker_idx} → rollout_output() rollout_output · request_pipeline.py:128 (shared) same code as the native vLLM path removed by this PR Dynamo-only, kept or new

Where they meet, and what still differs

After this PR, the Dynamo path and the native path become the same code at _serve_rollout (step 4) and use the same output builder (step 5). For a text prompt both hand vLLM the same token ids. What still differs is only how the request reaches the worker, and a short list of settings Dynamo cannot serve yet.

PieceBefore (backend: dynamo)After (dynamo: true)
Which vLLM runsDynamo's own, in /opt/dynamo_venv with its own lock fileNeMo RL's vLLM. Only Dynamo's backend SDK is added, and it imports no vLLM. vLLM venvs pin pydantic 2.13.0 for Dynamo.
Refit, pause, quantization, speculative decodingRefit and pause went over HTTP /engine/* routes; anything else had to be ported to dynamo.vllmThe worker's own; nothing to port
Who picks the engineKV routerKV router (native: the driver picks a shard)
Rejected at startup—colocated, fleet health, NeMo-Gym (until #4979), EP > TP, API key, router_mode: direct
Media prompts—Stay on the native path (_dynamo_serves)
Why it matters. Dynamo now costs one config flag and no second vLLM, so a vLLM bump no longer waits on Dynamo's copy, and the PR removes about 12,500 lines while adding 2,600. CI runs the SingleController math and reload-refit tests through Dynamo and checks that every rollout was routed and KV events were applied. The review's open asks: a CI test for examples/run_grpo.py with dynamo: true (its only one was deleted), an upstream Dynamo issue for the logging takeover, and native-vs-Dynamo timing from the existing runs.

🟠 C58 · dynamo-generation.md:3 C59 · native_engine.py:293 C60 · reply on C35 C61 · groundwork for Gym · native_engine.py:146