LeaderWorkerSet
Core concepts of LeaderWorkerSet (LWS) — unit of replication, relationship with StatefulSet, architecture, and design rationale.
This project provides two complementary Kubernetes APIs for distributed AI/ML workloads: LeaderWorkerSet (LWS) (leaderworkerset.x-k8s.io/v1) and DisaggregatedSet (DS) (disaggregatedset.x-k8s.io/v1).
LeaderWorkerSet and DisaggregatedSet work together in a layered architecture:
leaderworkerset.x-k8s.io/v1): A foundational API for deploying a group of pods as a single unit of replication. LWS addresses multi-node model-parallel inference where pods within a replica share fate, require tight co-location, and communicate via high-speed interconnects.disaggregatedset.x-k8s.io/v1): A higher-level orchestration API designed for disaggregated inference architectures (e.g., separating prefill and decode phases). DisaggregatedSet manages and coordinates multiple underlying LeaderWorkerSets as distinct roles within a unified logical workload. DisaggregatedSet uses LeaderWorkerSet as a core primitive, it composes multiple LeaderWorkerSets into a complete serving topology, handling cross-role coordination that individual pod groups cannot manage alone.┌─────────────────────────────────────────────────────────────┐
│ DisaggregatedSet │
│ (Multi-role orchestration, ratio-preserving rollouts, │
│ service discovery, slice management, coordinated drain) │
└──────────────┬───────────────────────────────┬──────────────┘
│ │
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────┐
│ LeaderWorkerSet (Role 1)│ │ LeaderWorkerSet (Role 2)│
│ e.g., Prefill │ │ e.g., Decode │
├─────────────────────────┤ ├─────────────────────────┤
│ • Pod group lifecycle │ │ • Pod group lifecycle │
│ • Leader/worker template│ │ • Leader/worker template│
│ • Exclusive topology │ │ • Exclusive topology │
│ • Subgroup scheduling │ │ • Subgroup scheduling │
│ • Failure restart policy│ │ • Failure restart policy│
└─────────────────────────┘ └─────────────────────────┘
| Feature / Dimension | LeaderWorkerSet (LWS) | DisaggregatedSet (DS) |
|---|---|---|
| Primary Purpose | Deploying a group of pods as a unit of replication | Orchestrating multi-role disaggregated serving topologies |
| Unit of Replication | Replica = 1 leader Pod + N worker Pods | Set = Multiple roles, each mapped to a child LWS |
| Workload Type | Homogeneous multi-node inference | Heterogeneous multi-role inference (prefill, decode, encode) |
| CRD | leaderworkerset.x-k8s.io/v1 | disaggregatedset.x-k8s.io/v1 |
| Rollout Ownership | LWS controller (maxUnavailable, maxSurge) | DisaggregatedSet controller (lockstep, ratio-preserving) |
| Scaling | Horizontal Pod Autoscaler (HPA) via scale subresource | Independent per-role scaling & full topology slice scaling |
| Service Discovery | Headless service per replica (UniquePerReplica subdomain policy) | Headless service per role with revision-aware routing |
| Placement & Topology | Exclusive topology placement & subgroups per replica | Slice-level placement policy and topology spread |
| Failure Handling & Lifecycle | Per-replica restart policies (RecreateGroupOnPodRestart, None, RecreateGroupAfterStart), isolating failure recovery to the affected pod group | Per-role LWS failure handling; coordinated rollout and drain across all roles |
Core concepts of LeaderWorkerSet (LWS) — unit of replication, relationship with StatefulSet, architecture, and design rationale.
Understanding DisaggregatedSet — purpose, relationship to LeaderWorkerSet, and when to use it.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.