Skip to content

feat(modelexpress): stage whole versions in pinned host memory - #4825

Draft
hallerite wants to merge 9 commits into
feat/mx-pullfrom
feat/mx-pull-host-staging
Draft

hallerite wants to merge 9 commits into
feat/mx-pullfrom
feat/mx-pull-host-staging

Conversation

@hallerite

Copy link
Copy Markdown
Member

weight_broadcast.staging_host_bytes gives every inference GPU pinned host memory, on its NUMA node, that receives a whole version while the engines serve. The pause then only copies the version to the GPU through the bounded staging buffers and installs it.

  • The pause costs host-to-device time instead of the wire time shared by every engine reading from one trainer.
  • It uses no more GPU memory than bounded staging, so gpu_memory_utilization stays where it is.

Changes:

  • staging_host_bytes on the ModelExpress weight broadcast config, and on the inference config for pulling engines.
    • It requires staging_buffer_bytes.
    • It is passed to every worker's init_broadcaster in both modes: engines that pull, and orchestrator pushes.
  • docs/model-express.md: the option and its memory floor, and the recommendation to set MX_RDMA_NIC_PIN = "auto" in [inference.env_vars]. Without it, reads into host memory converge on a few NICs and take twice as long.

It requires a ModelExpress release with staging_host_bytes; the dependency pin moves when one is out.

Results

Setup:

  • One trainer node and two 8-GPU inference nodes, each an expert-parallel DP8 engine.
  • A 284B-parameter MoE model; 83.9 GB per GPU per version.
  • Background load; the same gpu_memory_utilization in every run; 17 updates per run.
p50 bounded staging host staging + NIC pin
Pause per DP group 3.66 s 1.87 s
Client-visible stall per rank 3.91 s 2.17 s
Staging while serving 1.1 s 5.0 s
Publish to all engines serving 5.4 s 7.5 s
Decode tokens lost per update 75.6k 54.7k
GPU KV cache per engine 231k tokens 231k tokens

Host memory: each engine node pinned about 640 GiB (8 x 80 GiB), in the background in under 25 s.

Stacked on #4822 (engines pull ModelExpress versions). Draft until a ModelExpress release includes staging_host_bytes.

🤖 Generated with Claude Code

hallerite and others added 9 commits November 27, 2026 10:21
…opies

- The MX worker id named the generator's registration, version leases and NIXL
  agent after `rank_offset + self.rank`. vLLM's worker rank restarts at 0 in
  every data-parallel engine, so all engines of a DP>1 server registered under
  the same id, shared one version lease, and the first engine to finish
  released it for all. The id now uses the device index, as the NCCL worker
  does.
- The sender keeps the state dict it publishes from. Packed parameters' splits
  are copies (full q/k/v per layer), so they stayed allocated through every
  training step. The sender now drops the dict after each release; the next
  broadcast refreshes it.

Trainer and inference layouts need not match; the docs list the combinations
covered (FSDP, EP, CP, HSDP and uneven shards on the trainer; TP, DP and DP+EP
on inference), each checked bit-exact against the weights loaded from disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MX uses the worker id only as an opaque key: the worker's registration, its
version lease (the server derives the lease id from the version and worker
id, one lease per worker and version) and its NIXL agent name. It needs the
id to be unique; nothing in MX expects dense ranks or a worker count.

The id was the device index plus a `rank_offset` the orchestrator assigned
(`index * workers_per_server`). That needed the inference layout
(`inference_world_size`, the same number of GPUs on every server) and assumed
one worker per GPU on visible devices 0..N-1.

Each worker now names itself `{session}:{GPU UUID}:{pid}`. The GPU UUID is
unique across data-parallel engines, external-LB servers, P/D roles and
replicas without any global knowledge. The process id keeps ids unique when
engines share a GPU, and fresh after an engine restarts. The id is stable
within a process, so a repeated `init_broadcaster` (the Dynamo admin plane
sends one before every update) keeps the running client.

- The orchestrator and the Dynamo admin plane send every engine the same
  initialization, without `rank_offset` or `inference_world_size`. Dynamo no
  longer adds the instance id to the session.
- `/init_broadcaster` passes its body to the worker extension as keyword
  arguments, so each transport's extension takes its own fields. The NCCL
  request and worker are unchanged and keep `rank_offset`.
- MX no longer reads `weight_broadcast.inference_world_size`; the field stays
  for NCCL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With `[weight_broadcast] type = "modelexpress"` and `pull = true`, each inference server moves itself onto every
version the trainer publishes, instead of the orchestrator pausing every engine and pushing each update.

- Engine (`inference/vllm/weight_pull.py`). A task in the API server polls ModelExpress for the newest READY
  version published after the one it serves. Every worker stages it on a background thread while the engine
  serves; once all have, the engines pause with the running requests kept, install it, label the tokens sampled
  from then on with its step and resume. The first version of a trainer stages while paused: that stage records
  the layout on the live model.
- Groups. `Engines` is the interface (init, can_stage_live, stage, discard, pause, apply, resume). `LocalEngine`
  moves this server's engines in process, every data-parallel engine of an internal-LB server included.
  `EngineGroup` moves the ranks of an external-LB DP group through new admin routes
  (`/modelexpress/{can_stage_live,stage,discard,apply}`, `/pause`, `/resume`), so its first rank pulls for the
  group (`weight_broadcast.pull_group`, set by the multi-node template). vLLM's data-parallel pause stops every
  rank at the same step. Groups switch independently.
- Failures. A failed stage leaves the live weights untouched and the engines keep serving. A failed install keeps
  the engines paused and installs the newest version from scratch until one succeeds; past `timeout` the server
  exits.
- `GET /weight_version` returns the label the engine serves.
- Trainer. Each rank publishes from one host copy, so it holds one version. Before publishing the next, the
  master marks the previous one RELEASING (no new leases) and every rank waits until the reads in flight end. No
  install is awaited, except for the last version at close. A new trainer retires a previous trainer's READY
  versions.
- Orchestrator. `ModelExpressPullWeightReceiver` initializes, pauses and pushes nothing: it waits until every
  engine serves the version or a newer one of this trainer, then marks it installed. The watcher keeps
  dispatching across a swap.
- `rl` rejects pull with Dynamo, draft swaps and rollout checkpoints; SFT rejects it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… to ModelExpress

- docs/model-express.md: how pull stages, switches and fails, and what the trainer and the orchestrator still do.
- The puller retries connecting the engines to ModelExpress until the server answers, so engines may start before
  it. Its log line now separates reaching the pause from the time paused.
- Config tests: pull reaches the engines, the trainer and the orchestrator; the arguments a group leader gets
  parse; pull rejects rollout checkpoints and transports other than ModelExpress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…served version ids; model name override

- `weight_broadcast.pull_group` becomes `weight_broadcast.group`, which no longer needs `pull`: it is the admin URL
  of every rank of the server's DP group, and the multi-node launcher gives it to the first rank of each group
  whether or not the engines pull, so anything that moves a group's weights can find its ranks.
- `GET /weight_version?uid=true` also returns the ModelExpress version every worker installed last
  (`modelexpress_served`, cleared while an install runs); `Engines.served()` reads it. The plain route, which the
  orchestrator polls, stays a label read.
- `weight_broadcast.model_name` names the model versions are published under, defaulting to `vllm.model`, and
  reaches `init_broadcaster`.
- `WeightPuller.lock` is held through every switch, for anything else that moves the same engines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An install that failed keeps the engines paused and retries with the newest version. A failure to list the versions
then retries the same version instead of leaving the switch while paused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hed engines

The first version of a trainer stages after the pause. When that stage fails, no install started, so the live
weights are untouched: discard, resume and let the puller retry later, instead of keeping the engines paused as
after a failed install, which may leave the weights partly written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`weight_broadcast.staging_host_bytes` gives every inference GPU pinned host memory, on its NUMA node, that receives
a whole version while the engines serve. The pause then copies it to the GPU through the bounded staging buffers and
installs it, so it takes host-to-device time instead of the wire time of every engine sharing a trainer, with no
more GPU memory than bounded staging. The memory is pinned in the background from when the engine connects to
ModelExpress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant