Skip to content

vllm.model_executor.model_loader.weight_cache.daemon

Weight cache daemon for fast engine restarts.

One daemon process per GPU holds the post-quantized, TP-sharded weights of its rank in GPU memory and serves shared storage handles to vLLM engines over a Unix domain socket. Restarting engines map the weights zero-copy instead of reloading from disk.

Launch one daemon per TP rank with a single command:

vllm preload \
    --model /path/to/model --tensor-parallel-size 4

Engines then load from the daemons with:

vllm serve /path/to/model --tensor-parallel-size 4 \
    --load-format ipc_cache

Tensor, expert, data and pipeline parallelism are supported.

For multi-node tensor parallelism, run one launcher per node with a shared rendezvous so the global TP group forms across nodes (weight sharing is node-local, so each node serves only its local GPUs' shards). Reuse the same --nnodes/--node-rank/--master-addr flags you pass the engine, plus a --weight-cache-master-port distinct from the engine's --master-port:

# node 0 (8 local GPUs)
vllm preload \
    --model /path/to/model --tensor-parallel-size 16 \
    --nnodes 2 --node-rank 0 --master-addr 10.0.0.1 \
    --weight-cache-master-port 29600
# node 1 (8 local GPUs)
vllm preload \
    --model /path/to/model --tensor-parallel-size 16 \
    --nnodes 2 --node-rank 1 --master-addr 10.0.0.1 \
    --weight-cache-master-port 29600

The global TP rank of local GPU i on node r is r * (tp_size // nnodes) + i, matching vLLM's contiguous per-node rank assignment, so each engine worker maps its shard from the daemon on its own node. With pipeline parallelism each node additionally runs one daemon per PP stage; the global rank is pp_rank * tp_size + tp_rank.

For data parallelism (e.g. a TP1 x DP16 x EP decode fleet) run one launcher per node with the engine's DP placement flags. Local GPU i serves DP rank start_rank + i // tp_size and TP rank i % tp_size, and all dp_size * tp_size daemons form one world group on --data-parallel-address/--weight-cache-master-port so the expert shards are laid out exactly as in the engine:

# node r (4 local GPUs)
vllm preload \
    --model /path/to/model --tensor-parallel-size 1 --enable-expert-parallel \
    --data-parallel-size 16 --data-parallel-size-local 4 \
    --data-parallel-start-rank 4r --data-parallel-address 10.0.0.1 \
    --weight-cache-master-port 29600

Data parallelism also combines with multi-node tensor parallelism: pass both flag sets (--nnodes/--node-rank/--master-addr and the DP flags with a reachable --data-parallel-address). Each node then serves a contiguous block of the dp_size * tp_size global ranks, e.g. TP8 x DP2 on 4 nodes:

# node r (4 local GPUs)
vllm preload \
    --model /path/to/model --tensor-parallel-size 8 --enable-expert-parallel \
    --nnodes 4 --node-rank r --master-addr 10.0.0.1 \
    --data-parallel-size 2 --data-parallel-address 10.0.0.1 \
    --weight-cache-master-port 29600

With MTP, EAGLE or EAGLE3 speculative decoding the launcher additionally starts a draft daemon group that caches the draft model. It uses its own cache key, Unix sockets (*_draft.sock) and rendezvous port (--weight-cache-draft-master-port, default --weight-cache-master-port + 1), so each process serves exactly one model role. Other draft types are not cached and keep loading from disk in the engine. With pipeline parallelism only the draft daemons of the last stage serve the draft model.

Seeding a replica from another

A second replica's daemons can seed their shards from a loaded replica with --weight-cache-seed; see docs/features/preload.md.

Classes:

  • WeightCacheDaemon –

    Per-GPU process that loads one shard and serves its shared storage handles.

Functions:

WeightCacheDaemon

Per-GPU process that loads one shard and serves its shared storage handles.

Methods:

  • capture_state –

    Materialize canonical post-warmup storages and drop the model.

  • get_model –

    Load the daemon's model, composed from the configured loader.

  • release_distributed –

    Release process groups and BLAS workspaces after loading and warmup.

  • serve_forever –

    Serve requests until terminated.

  • warmup –

    Run each warmup cache's pass (adopting remote caches via D2D).

_acquire_gpu_lock(socket_path)

Take an exclusive lock guarding this GPU's socket path.

The lock is advisory and released automatically when the daemon exits (or crashes), so a stale socket is only ever removed by whoever owns the lock. A running daemon holding it makes a second daemon fail fast instead of clobbering the live socket.

_export_state()

Export this rank's storage handles, manifest, aliases and flags.

_handle_watch(conn)

Hold the connection open until this daemon exits.

Zero-copy engines keep serving from the mapped weights after the daemon exits; the closed connection tells them their daemon is gone.

_prune_watchers()

Close the watch connections of engines that have exited.

capture_state()

Materialize canonical post-warmup storages and drop the model.

get_model()

Load the daemon's model, composed from the configured loader.

Runs the quantization check after model creation but before the slow weight load, so an unsupported method fails fast. Online quantization always fails the check, so load_model's finalize step for it is unnecessary here.

release_distributed()

Release process groups and BLAS workspaces after loading and warmup.

Serving only exports shared storage handles, so the communicators (NCCL, custom all-reduce and FlashInfer workspaces) and cached BLAS scratch would otherwise pin GPU memory for the daemon's lifetime.

serve_forever(ready_callback=None)

Serve requests until terminated.

The socket is only bound once the model is fully cached, so clients get a connection error (and fall back to disk) until the daemon is ready.

Parameters:

  • ready_callback

    (Callable[[], None] | None, default: None ) –

    Invoked once the socket is bound and listening, so the launcher can report overall readiness.

warmup()

Run each warmup cache's pass (adopting remote caches via D2D).

daemon_serves_model(is_draft, global_rank, parallel_config)

Whether the daemon at this placement loads and serves a model.

The engine runs the draft model only on the last pipeline stage. Draft daemons on other stages join the group's rendezvous and then exit.

get_draft_daemon_config(vllm_config)

VllmConfig for the draft daemon group

plan_local_ranks(parallel_config)

Contiguous global ranks on this node, ordered by DP, then PP, then TP.