Skip to content

vllm.v1.worker.sentinel.eplb_redistribute

EPLB fault-tolerance helpers: expert redistribution and weight reload after peer death.

All redistribution operations are deterministic with stable iteration order, so all surviving ranks running the same function with the same args produce bit-identical results — no cross-rank communication during recovery.

Functions:

compute_dead_ep_ranks(dead_dp_ranks, tp_size, pcp_size=1)

Expand dead DP ranks to the corresponding dead EP ranks.

Each DP rank owns a contiguous block of tp_size * pcp_size EP ranks

mark_dead_expert_slots_inplace(physical_to_logical_map, dead_ep_ranks, num_local_experts)

Mark dead EP ranks' physical expert slots as -1 in place.

physical_to_logical_map is [num_moe_layers, num_physical]; each EP rank owns num_local_experts consecutive physical slots starting at rank * num_local_experts. Shape stays constant (no topology change).

redistribute_expert_placement(physical_to_logical_map, num_logical, num_local_experts)

Steals slots from over-replicated experts (donors with >1 replica) to recover missing logical experts, interleaving across EP ranks for balanced weight loading. Modifies physical_to_logical_map in place.

Returns:

  • set[tuple[int, int]] –

    Set of (moe_layer_idx, logical_id) pairs needing weight reload.

Raises:

  • RuntimeError –

    If not enough slots to cover missing experts.

reload_experts_from_disk(model, vllm_config, reload_set, physical_to_logical_map)

Reload complete MoE layers affected by expert reassignment from disk.

Parameters:

  • model

    (Module) –

    The model whose FusedMoE layers receive the reloaded weights.

  • vllm_config

    (VllmConfig) –

    Engine config, used for the model loader and model config.

  • reload_set

    (set[tuple[int, int]]) –

    {(moe_layer_idx, logical_expert_id), ...} from redistribute_expert_placement.

  • physical_to_logical_map

    (Tensor) –

    Recovered placement, including all replicas.

reset_eplb_async_state(model_runner)

Clear stale EPLB async state after fault or scale-down.