Repository navigation
Conversation
…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>
…versions `tools/publish_checkpoint.py MODEL_DIR STEP --model-name NAME` offers an exported HF safetensors checkpoint to running engines as an MX version, numbered with its step, so that a deployment can move to it without a restart. - Ranks (one process each, joined by a gloo group) split the checkpoint's tensors into runs of about equal bytes, read their share into page-locked host buffers (cudaHostRegister, exact size) with reader threads, and bind them IN_PLACE through ModelExpressTrainerClient: MX serves the buffers themselves, so the publisher holds one copy. - Tensors keep the checkpoint's names, layout and dtypes (bf16, fp16 or fp32), which is what vLLM's loader reads. - One trainer mesh for the publisher's lifetime, so engines stage only its first version while paused. - One version at a time. Publishing the next checkpoint (HTTP `POST /publish` on rank 0) checks that it holds the same tensors, marks the current version RELEASING, waits until its leases drain, reads the new checkpoint into the same buffers and publishes it. `POST /release` or SIGTERM retires the version and exits; `GET /status` reports it. - MX publishes floating-point tensors only. The version's uid carries a digest of the checkpoint's integer tensors (by value and shape, independent of names and integer width), so engines can refuse a checkpoint whose integer tables differ from the ones they keep. - `--serve-modelexpress` runs an MX server beside the publisher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… restart
`POST /swap-checkpoint {step | version_uid, mode, drain_timeout_s}` (admin) moves every rank of a DP group onto a
ModelExpress version, such as one a checkpoint publisher offers, through the group's first rank
(`weight_broadcast.group`) or a server that holds all of its engines.
- Order: resolve the target (newest READY version of the step; 404 if none), return `unchanged` if every rank serves
it, refuse a version whose integer tables differ from the engines' (409, needs a restart), stage it while serving
(a failed stage changes nothing, 502), stop admitting requests and handle the ones in flight by `mode` (`fail`: 409
if any; `drain`: wait up to `drain_timeout_s`, else 409; `abort`: abort them, finish reason `abort`), pause the group,
install, reset the prefix cache, label the tokens with the step, resume, and answer with timings (stage, drain,
pause, apply, total). The first version of a mesh stages while paused (`cold`, `stage_paused` counts toward
`pause`).
- Requests that arrive during a swap wait at the API server (an admission gate on the engine client's `add_request`)
and then run on the new weights; they are never rejected. vLLM's own wait and abort pauses reject them, and a
data-parallel wait pause cannot be cancelled on a drain timeout.
- One swap at a time per group: a request for the version being installed shares that swap's result, one for another
version gets 409. The swap continues if its client disconnects.
- A failed install keeps the group paused, reports every rank unhealthy (`/health` 503, so the router drops it),
answers 500 and retries the install while paused until it succeeds or `weight_broadcast.timeout` passes. A new swap
to any version takes over. It never resumes on mixed weights.
- Engines interface: `hold`, `release`, `in_flight`, `abort`, `reset_prefix_cache`, `set_health`, `integer_tables`,
with per-rank admin routes for EngineGroup (`/admission/{close,open}`, `/in_flight`, `/abort_in_flight`,
`/reset_prefix_cache_paused`, `/set_health`, `/modelexpress/integer_tables`).
- Worker: a version's tensors convert from PrimeRL to the checkpoint layout only when their names are PrimeRL's (the
model class's `is_hf_state_dict`, as when the trainer loads a checkpoint), so checkpoint publishers need no
conversion. `modelexpress_integer_tables` digests the integer parameters vLLM loaded from the checkpoint (not those
it derives after loading, such as MXFP8 scales).
- `tools/swap_checkpoint.py --router URL --step N --mode drain` discovers every DP group behind a router (or
`--servers`) and swaps all of them, or one at a time out of the router's rotation with `--rolling`.
- The multi-node inference template passes every EP group's first rank its group's admin URLs when the engines use
ModelExpress, and the admin token from `$ADMIN_TOKEN_SEND_ENV`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and keeps a host memory floor Reading a 530 GiB checkpoint from Lustre into pinned buffers let the Lustre client cache grow beside the pinned copy until the host ran out of memory. The publisher now reads with O_DIRECT through a page-aligned bounce buffer per reader thread (buffered reads that drop their pages on filesystems without O_DIRECT), and refuses to start, or fails a publish, rather than leave less host memory available than max(200 GiB, 15% of the total) (`--min-available-gib`, `--min-available-fraction`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ils; swap phase and group URLs - A swap that takes over from a failed install stages while the group is paused with partly written weights. If that stage fails, the group stays paused and unhealthy and retries the new version, instead of resuming as a group with intact weights does: a dense engine resumed that way ran a step on meta tensors and died. - `GET /swap-checkpoint` reports where a running swap is (`phase`: staging, draining, paused). A failed ModelExpress lookup answers 502. - The swapping server connects its group to ModelExpress at startup, best effort, so the first swap does not. - A server that pulls from a trainer builds no swapper: its generator clients follow the trainer. - The multi-node inference template names a group's ranks by host name, as the router does, so `tools/swap_checkpoint.py` matches the router's workers to their groups. - Docs: the publisher's O_DIRECT reads and memory floor, bounded staging needs a buffer of the largest tensor, the JIT-compiled receive-buffer allocator on a first stage, and the failure cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-decoding draft `POST /swap-checkpoint` takes an optional `draft_dir` (a directory, or a Hub id in the local cache). The route checks it against the served draft before anything changes (422 if it does not match), and the group loads it on every rank in the same pause, after the version and before the prefix cache reset (`timings.draft`). A failed draft load counts as a failed install. Without `draft_dir` the draft keeps its weights, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bin, copying without the GIL A Lustre file's bandwidth is bounded by its storage targets, so readers that drain one file after another stall on it: each rank now interleaves its chunks over its files, and copies from its O_DIRECT bounce buffers with torch, which releases the GIL. One process read 63 GiB of an export at 8 GiB/s instead of 1.6 GiB/s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pages of its own ModelExpress registers each tensor with NIXL separately, and UCX's registration cache merges registrations whose pages overlap and registers the union anew. With a rank's tensors packed back to back in one buffer, every registration re-registered everything before it: for 4,300 tensors (one rank of a 530 GiB checkpoint) pinned memory accounting grew past 21 TB and host memory drained at 2.5 GiB/s. Each tensor now starts on a page boundary (at most 4 KiB of padding per tensor), so registrations never overlap: one rank registers in ~78 s with VmPin at 16x its buffer (8 NICs, two registrations each). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NIXL's UCX in the docs With at least as many GPUs as ranks (and CUDA_VISIBLE_DEVICES unset), rank r of the checkpoint publisher now uses GPU r, the RDMA port nearest it among UCX_NET_DEVICES and the CPUs of that port's NUMA node, so its buffers land there (`--rails`/`--no-rails` to choose). Each rank then registers its tensors with one port instead of every port: for a 530 GiB checkpoint over 8 ranks, registration drops from ~78 s to ~9.5 s and VmPin from 16x to 2x a rank's buffer, and an engine connects to a new publisher in ~0.1 s instead of ~34 s, so a cold swap pauses ~12 s instead of ~54 s. Docs: engines that swap must not point LD_LIBRARY_PATH or UCX_MODULE_DIR at another UCX build; NIXL ships its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
hallerite
force-pushed
the
feat/mx-pull
branch
from
December 3, 2026 22:05
a27ad19 to
d397d5b
Compare
This branch has not been deployed
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.
A deployment that serves exported checkpoints (offline evals of an RL run) can move to another checkpoint in seconds instead of a full teardown and restart. Two parts:
tools/publish_checkpoint.py,transports/weights/checkpoint_publisher.py). Offers an HF safetensors export as a ModelExpress version, numbered with its step, and rolls from checkpoint to checkpoint.POST /swap-checkpointon the engines, plustools/swap_checkpoint.pyfor a whole deployment. A DP group's first rank installs a version on every rank of the group.Builds on the Engines interface of the pull branch (stage / pause / apply / resume). It adds a few general primitives to it:
hold,release,in_flight,abort,reset_prefix_cache,set_health,integer_tablesandupdate_draft, with per-rank admin routes.Publisher
ModelExpressTrainerClient, so the host holds a single copy.is_hf_state_dict.UCX_NET_DEVICES) and that port's NUMA node. Each rank then registers with one port instead of all of them.tid2eid). An engine refuses a version whose tables differ from its own (409, needs a restart).POST /swap-checkpoint {step | version_uid, mode, drain_timeout_s, draft_dir}The swap runs these steps in order:
unchanged.mode:fail: 409 if there are any.drain: wait up to the timeout, else 409.abort: abort them; they finish with reasonabort.The response includes
timings(stage, drain, pause, apply, total).Further behavior:
cold,stage_paused)./healthanswers 503 on every rank, the request gets 500, and the group retries the install while paused. It never resumes on mixed weights, even when a later stage fails. A new swap takes over.GET /weight_version?uid=truereturns{version, uid}, and completions carry per-tokenweight_versionslabels.Results
Tiny models, 4 GPUs:
--rolling;Full size. A DeepSeek-V4-architecture model, 530 GiB bf16, served as one DEP8 replica with online MXFP8, DSpark speculative decoding and bounded staging. The publisher runs on a second node with 8 ranks. 32 sessions of load ran through the router throughout.
Known limits and follow-ups
LD_LIBRARY_PATHorUCX_MODULE_DIRat another UCX build. Mixing them aborts every worker as soon as its NIXL agent starts (undefined symbol: uct_ib_mlx5_ext_register).TORCH_EXTENSIONS_DIR. That costs ~20 s of pause when the cache is cold, for example after another environment rebuilt it. Give each environment its ownTORCH_EXTENSIONS_DIR.api_server_count = 1).Stacked on #4822 (engines pull ModelExpress versions); review that first.
🤖 Generated with Claude Code