Mental model
Choosing distributed inference parallelism solves one core equation cleanly: VRAM capacity fit + interactive latency vs. inter-GPU collective overhead. Always prioritize un-split Data Replication (DP) while model weights and KV headroom fit cleanly inside one device; introduce Tensor Parallelism (TP) strictly across ultra-fast intra-node NVLink islands to cut single-stream TTFT/TPOT or fit mid-size checkpoints; and keep Pipeline (PP) / Expert Parallelism (EP) reserved strictly when total weights outgrow one physical server chassis.
Learning outcomes
- Size exact VRAM consumption (
weights + activation buffers + target concurrent KV cache) cleanly before partitioning workloads across GPUs. - Explain why quantization (
BF16 -> FP8/INT4) or smaller tiered models often beat cross-deviceTP=2cleanly on real throughput per dollar. - Configure Kubernetes/cluster topology awareness so distributed ranks stay packed on shared PCIe/NVLink switches rather than spanning availability zones.
Theory
Throwing more GPUs at an inference checkpoint never delivers free linear speedups cleanly cleanly because splitting matrices creates continuous barrier synchronization (AllReduce) across transformer forward passes. Selecting the narrowest sufficient distribution scope keeps latency predictable and prevents single-GPU ECC faults from crashing entire multi-rack jobs cleanly:
| Parallelism Topology | Synchronization Scope | NVLink / Fabric Dependency | Effect on Single-Request Latency | Failure Blast Radius |
|---|---|---|---|---|
Independent Replicas (DP, TP=1) | Zero communication during inference | Standard cluster Ethernet load balancer | Baseline 1-GPU FLOP + HBM speed | 1 isolated node/GPU (highest availability) |
Intra-Node Tensor Parallel (TP=2..8) | 2x AllReduce every decoder layer (60–160x per token) | Mandatory (NVLink / NVSwitch inside node) | Cuts prefill & decode latency dramatically cleanly up to bus limits | TP-sized group restarts jointly cleanly |
Inter-Node Pipeline Parallel (PP) | Hidden states pushed at layer boundaries | Tolerates RoCE / InfiniBand (point-to-point) | Adds pipeline bubble wait; mainly raises capacity rather than speed | Entire multi-node pipeline (highest complexity) |
MoE Expert Parallel (EP) | All-to-All token dispatch/combine per MoE layer | High-bisection RDMA / NVSwitch required | Enables trillion-param MoE sparse decode at scale cleanly | High sensitivity cleanly to any slow straggler rank |
Always verify arithmetic fit alternatives before jumping into multi-GPU parallelism: a 70B checkpoint consuming 140 GB at BF16 drops immediately to 70 GB under verified FP8 (~35 GB under AWQ INT4), comfortably freeing KV cache space on one 80 GB H100 or two TP=2 GPUs with double the replica count per server cleanly!
pythonfrom dataclasses import dataclass@dataclass(frozen=True)class FitAudit:params_billions: floatbytes_per_param: floattarget_kv_gb: floatgpu_vram_gb: floatnvlink_gpus_per_node: intdef recommend_inference_topology(spec: FitAudit, latency_critical: bool) -> dict[str, object]:"""Choose minimal viable parallelism favoring DP replication and NVLink-bounded TP."""weight_gb = spec.params_billions * spec.bytes_per_paramtotal_gb = weight_gb + spec.target_kv_gb + 4.0 # 4GB CUDA graph & activation headroomusable_per_gpu = spec.gpu_vram_gb * 0.90if total_gb <= usable_per_gpu and not latency_critical:return {"tp": 1, "pp": 1, "strategy": "independent_dp_replicas"}needed = max(1, int(-(-total_gb // usable_per_gpu)))if needed <= spec.nvlink_gpus_per_node:tp = 1while tp < needed:tp *= 2if latency_critical and total_gb <= usable_per_gpu and spec.nvlink_gpus_per_node >= 2:tp = 2 # Deliberate TP=2 cuts interactive TTFT/TPOT cleanly inside NVLinkreturn {"tp": min(tp, spec.nvlink_gpus_per_node), "pp": 1, "strategy": "intra_node_nvlink_tp"}return {"tp": spec.nvlink_gpus_per_node,"pp": max(2, -(-needed // spec.nvlink_gpus_per_node)),"strategy": "multi_node_tp_plus_pp_topology_pinned",}
Trade-offs
Independent DP replicas maximize total fleet requests per dollar cleanly under high throughput workloads (0% collective synchronization tax) and ensure a crashing replica drains quickly without harming peers. Moving up to TP=4 or TP=8 inside an NVLink server slices interactive time-to-first-token (TTFT) and memory-bound TPOT dramatically cleanly while uniting 4–8 GPUs into a shared failure domain. Spanning across nodes via PP or multi-host EP unlocks giant frontier checkpoints exceeding single-chassis memory cleanly at substantial tail-latency jitter and Kubernetes topology-scheduling operational complexity.
Failure modes and misconceptions
- Assuming
TP=4Always Runs4xFaster: Collective communication overhead, smaller per-GPU GEMM tiling efficiency, and uneven attention heads rapidly flatten scaling beyondTP=4on smaller checkpoints (8B–14B). - Missing Kubernetes Topology Placement Managers: Scheduling
TP=4pods randomly across mismatched PCIe switches without NVLink verification starves collectives silently across CPU root complexes. - Adding Tensor Parallelism Before Testing Quantization (
FP8) or Distillation: Burning multi-GPU complexity cleanly to host unquantized weights when losslessFP8fits cleanly onto single-GPUDPreplicas doubles serving bills unnecessarily. - Placing All Replicas in One Fault Domain: Running replicas without spread constraints across racks/AZs lets one power breaker outage wipe 100% serving capacity cleanly.
Decision scenario
A model (45 GB at FP8 weights) barely misses fitting with 30 GB desired KV cache headroom cleanly inside a single 48 GB L40S GPU during moderate daytime load. Compare shifting to verified INT4 quantization vs. TP=2 NVLink pairing vs. smaller fast routing tiers cleanly across hardware cost, tail latency, and fault isolation.
When is deploying multiple independent single-GPU replicas (Data Parallelism) preferable to splitting single requests cleanly across Tensor Parallelism?