Repository navigation
feat: run the llm-d router from router.json - #4939
Merged
Merged
Conversation
`uv run router @ router.json` now runs either backend. For llm-d it renders the EPP, Envoy and endpoint configs in Python from the config and the engine URLs on its command line, then supervises epp and envoy. Any exit of either is a router failure. So llm-d works wherever the router runs: locally, on several nodes and under P/D. The sbatch templates launch both backends with the same line and lose the Jinja YAML and the getent/sed address fill. A host that does not resolve now fails the router instead of writing an empty address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hallerite
approved these changes
Dec 3, 2026
skpulipaka26
approved these changes
Dec 3, 2026
mikasenghaas
added a commit
that referenced
this pull request
Dec 3, 2026
## Summary **Why.** `[inference] router = "None"` gave `rl`, `sft` and `inference` a second topology: a bare engine on `server.port`. Configs and launchers carried both shapes: - The engine port depended on the router. - The admin URLs were set only with a router. - Three validators rejected `None` on multi-node and P/D. - Each launcher started the router behind `if config.router_config() is not None`. The multi-node and P/D launches already always run a router. **Idea.** Every deployment runs a router on `server.port`, with its engines on `backend_port`. `router` is no longer optional: ```python # before router: RouterBackendConfig | None = Field(default_factory=VllmRouterConfig) def router_config(...) -> RouterConfig | None # after router: RouterBackendConfig = VllmRouterConfig() def router_config(...) -> RouterConfig ``` - `InferenceConfig.components()` and `placement()` always hold `router`. - `rl` and `sft` hold it whenever they have an `[inference]` block. - The local `rl`, `sft` and `inference` launchers always start the router. - Clients keep `server.port`, so their URLs do not change. ## Breaking - **`router = "None"` is rejected** in `[inference]` of `rl` and `sft`, and in `inference`. Remove the line. Clients still connect on `server.port`. To reach the engine directly, use `backend_port` (`server.port + 100` by default). - **`uv run inference` on one node** now starts a router on `server.port` and the engine on `backend_port`. Before, `router = "None"` served the engine itself on `server.port`. - **Operator.** `model-factory-iac` passes `--router None` to `inference` (`roles.go`). That flag now fails. The operator should run `engine @ engine.json` instead. Its `inference @ inference.json` launch already broke with the configs split, which merged in #4928. - `ServingSection.router_config()` and `InferenceSection.router_config()` return `RouterConfig`, not `RouterConfig | None`. ## Verification **Local runs on a 2-GPU box** (RTX PRO 6000; engine on GPU 0, trainer on GPU 1). The setup is `dev/examples/reverse-text/rl.toml`, 20 steps, with `--monitors.wandb None --ckpt None`. Both runs used this branch's tree on 3c366c9d5, which is 3ef3710 applied as a patch: | Router | Exit | Wall time | Reward, step 10 | Reward, step 20 | Router processes left after exit | | --- | --- | --- | --- | --- | --- | | `vllm-router` (default) | 0 | 198 s | 0.752 | 0.838 | 0 | | `llm-d` | 0 | 196 s | 0.750 | 0.866 | 0 | **Standalone inference.** `uv run inference --router.type llm-d` on one GPU: - The engine on port 8100 is ready after 35 s. - A chat completion through the router on port 8000 returns HTTP 200. - When the router dies, `inference` shuts down within 1 s. | Change removed | Result | | --- | --- | | `router` accepts `None` again | `test_every_engine_runs_behind_a_router_on_the_backend_port` fails: did not raise | ## Merge order Stacked on #4939 (`feat/llmd-router`). Merge that first: it lets the always-on router be llm-d on one node. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes inference topology and launch behavior (breaking for `router=None`); client URLs on `server.port` stay the same but operators and IAC that started bare engines need updates. > > **Overview** > **Inference always uses a router:** `[inference].router` is required (`VllmRouterConfig` by default); `router = None` is rejected. The engine always binds `backend_port` behind the router on `server.port`, and `router_config()` / `components()` / `placement()` always include a router entry. > > **Simpler wiring:** Validators that mandated a router on multi-node SFT/RL/inference and conditional checks when setting `admin_base_url` or launching router processes are removed—those paths now assume a router is always present. > > **Launchers:** Local `inference`, `rl`, and SFT always start the router subprocess (no optional bare-engine path). Standalone `uv run inference` exposes the API on the router port, not directly on the engine. > > **Breaking:** Configs that disabled the router must drop `router = None`; direct engine access uses `backend_port` instead of `server.port`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3ef3710. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Why. The llm-d router (EPP + Envoy) existed only inside the SLURM templates.
uv run routerran vllm-router only. The sbatch rendered the EPP, Envoy and endpoint YAML from Jinja, then filled in node IPs withgetentandsed. So llm-d could not run locally, had norouter.json, and its configs could not be tested. If a host did not resolve, the sbatch wrote an emptyaddress:and raised no error.Idea.
uv run router @ router.jsonruns either backend. For llm-d, the router process does three things:router.jsonand the engine URLs on its command line.eppandenvoyand exits non-zero when either one exits.Both backends start the same way:
components()andplacement()now includerouterfor llm-d too.RouterConfig.routeris the backend union. The newRouterConfig.decode_portlets llm-d map each decode engine to its pd-sidecar.templates/llmd/*.yaml.j2is deleted.launch_routerin the sbatch is one line for both backends. The pd-sidecar launch stays on the decode nodes.uv run inferencewritesrouter.jsonto its attempt's config dir and starts the router from it.Breaking
launch_routernow takes<worker_args> <log>instead of<mode> <worker_args> <port> <log>.templates/llmd/is gone. A custom template that calls either one breaks. Calllaunch_router "$ROUTER_ARGS" <log>.prometheus_port(server.port + 21000, so 29000 by default), not 9090.backend-<i>,prefill-<i>anddecode-<i>, one per engine URL. Before, they werebackend-<node>-rank-<k>.Verification
Same configs as before. I rendered the deleted Jinja templates (from
main) and the new Python configs for a colocated case (2 nodes × 2 ranks) and a P/D case (1 prefill and 1 decode node, 2 ranks each). The EPP, Envoy and endpoint configs are equal: same addresses, ports, labels, plugins, profiles and scorer weights. Only the endpoint names differ.Local runs on a 2-GPU box (RTX PRO 6000; engine on GPU 0, trainer on GPU 1). The setup is
dev/examples/reverse-text/rl.toml, 20 steps, with--monitors.wandb None. The vllm-router run also skips the final checkpoint (--ckpt None). On 7885c87:vllm-routerllm-d(--inference.router.type llm-d)The llm-d router's temp config dir is gone after the run. I lost the llm-d run's logs to a full disk on the box. The numbers come from the run's output, which I read before the disk filled.
Standalone inference with llm-d. This ran on the stack tip, with #4940 applied. #4940 does not change the llm-d path.
uv run inference --vllm.model PrimeIntellect/Qwen3-0.6B-Reverse-Text-SFT --router.type llm-d:pkill -x envoymakes the router exit with code 1, andinferenceshuts down within 1 s. Noepp,envoyor vLLM process is left.SLURM dry run.
uv run inference --deployment.type disaggregated --router.type llm-d --slurm.job-name x --dry-runrenders an sbatch that runsuv run router @ "$CONFIG_DIR/router.json" $worker_argsand still starts the pd-sidecar on decode nodes.router.jsonholds the llm-d settings anddecode_port = 8200.The tests can fail. Each row removes one piece of this PR:
router_config()builds llm-d (back toNonefor non-vllm-router)test_llmd_pd_router_sends_decode_requests_to_the_sidecarfailstest_llmd_router_runs_epp_and_envoy_from_its_configfailsepp/envoyexit fails the routertest_llmd_router_fails_when_epp_or_envoy_exits[exiting1]failsepporenvoyexitstest_llmd_router_fails_when_epp_or_envoy_exits[exiting0]failsI had no SLURM cluster for this PR. A multi-node or P/D llm-d run on SLURM has not run yet.
🤖 Generated with Claude Code
Note
Medium Risk
Touches inference routing for every deployment shape and changes SLURM launch contracts; misconfiguration could break multi-node/P-D routing until validated on cluster.
Overview
Unifies router startup so
uv run router @ router.jsonruns either vllm-router or llm-d (EPP + Envoy). For llm-d, the router process now generatesendpoints.yaml,epp.yaml, andenvoy.yamlin Python fromrouter.jsonplus CLI engine URLs, resolves hosts to IPv4, and superviseseppandenvoyuntil one exits (non-zero on failure).Removes the old SLURM-only llm-d path: Jinja templates under
templates/llmd/and the branchedlaunch_routershell logic. SLURM now calls the sameuv run router @ "$CONFIG_DIR/router.json" $worker_argsas local inference.Config / validation: drops validators that blocked llm-d on single-node;
router_config()andcomponents()include llm-d; addsRouterConfig.decode_portfor P/D sidecar port mapping. Localuv run inferencewritesrouter.jsonand starts the router subprocess instead of inliningvllm-routerargv.Breaking:
launch_routersignature is<worker_args> <log>only; llm-d endpoint naming and EPP metrics port behavior change per PR notes.Reviewed by Cursor Bugbot for commit 7885c87. Bugbot is set up for automated code reviews on this repo. Configure here.