Skip to content

vllm.distributed.weight_transfer.clients

Built-in VLLMWeightSyncClient implementations.

These adapt the inference engine's weight-sync control plane to concrete transports. A TrainerWeightTransferEngine takes one of these (or any object with the same four methods — the protocol is structural) and drives the full handshake through it.

Imports of ray / requests are deferred to call time so this module is importable without those packages installed.

Classes:

HTTPVLLMWeightSyncClient

Talks to a vLLM server over the RLHF HTTP routes.

Mirrors vllm/entrypoints/rl/online/api_router.py: /init_weight_transfer_engine, /start_weight_update, /update_weights, /finish_weight_update, /shutdown_weight_transfer_engine.

Methods:

finish_weight_update(weight_version=None, baseline=None)

Finish the update; raise if the weights differ from baseline.

RayVLLMWeightSyncClient

Talks to one or more vLLM AsyncLLM/LLM Ray actors.

Each call fans out to every handle and blocks on all of them, so a multi-actor (e.g. multi-DP) deployment is driven as one unit.

_json_safe_update_info(update_info)

Make an update_info dict JSON-serializable for HTTP transport.

CUDA IPC handles (ipc_handles) are tuples of non-JSON-native objects, so over HTTP they are pickled+base64-encoded into ipc_handles_pickled (which the worker auto-deserializes when VLLM_ALLOW_INSECURE_SERIALIZATION=1). Other backends (NCCL) carry only JSON-native metadata and pass through unchanged. Mirrors the old IPC _do_send HTTP branch.