Why shard?
You reach for sharding when 1 of 4 things is true:- The model is too large for 1 GPU. A 70B dense model at FP16 needs ~140 GB. Even at Q4 quantization (~35 GB), it fills a single RTX 4090 (24 GB). You need at least 2 GPUs to hold the weights.
- You need lower latency per token. When every GPU contributes to each token simultaneously, the wall-clock time per token drops.
- You need higher throughput. More GPUs means more concurrent users served in parallel.
- You need redundancy. Running 2 replicas behind a load balancer means 1 GPU can fail without downtime.
Where your GPU memory actually goes
Before you pick a sharding strategy, know what competes for VRAM. It is not just model weights:
A 24 GB RTX 4090 running a 70B Q4 model has ~35 GB of weights — it does not fit on 1 GPU at all. With TP=2, each GPU holds ~17.5 GB of weights and has ~6.5 GB left for KV cache and overhead. That is enough for short contexts and a few concurrent users, but not much more.
Usable memory is less than total VRAM. On a DGX Spark (128 GB unified), expect ~110 GB usable for model + KV after the OS and runtime reserve their share. On discrete GPUs, vLLM’s
--gpu-memory-utilization (default 0.90) controls this. Set it lower if you hit OOM.
This is why expert parallelism exists: instead of loading all 231 GB of experts onto every GPU, each GPU holds only its assigned experts. See Expert parallelism below.
2 decisions: make it fit, then make it fast
Sharding answers 2 questions in order: Make it fit — get the weights (and headroom for KV cache) inside your GPU memory budget:- Quantize first. Going from FP16 to Q4 cuts weight memory by ~4×. This is the cheapest win. See the quantization guide.
- Shard across GPUs. When quantization alone is not enough, split the model with TP, PP, or EP.
- Prune experts (MoE only). For MoE models with 256 experts where only 6 fire per token, REAP-style expert pruning cuts routed-expert weights roughly in half without touching active compute.
- Pick the right parallelism. TP gives lowest per-token latency. PP tolerates slow interconnects. DP multiplies throughput.
- Use MTP / speculative decoding. If the model ships multi-token prediction heads (Qwen3.6, DeepSeek-V3), enable them — they speed up decode without a quality loss. See model serving and scaling.
- Tune KV cache and batch size. More KV cache headroom means more concurrent users. See DGX Spark memory tuning.
The 4 sharding strategies at a glance
Tensor parallelism: splitting layers across GPUs
Tensor parallelism (TP) slices every layer’s weight matrices across GPUs. Each GPU holds a fraction of every layer, and all GPUs work on the same token simultaneously.1/N of the model weights, where N is the TP degree. A 70B model at Q4 (~35 GB) with TP=2 puts ~17.5 GB of weights per GPU.
Latency: lowest per token. All GPUs compute on every token, so the wall-clock time is the compute time plus the AllReduce synchronization.
Best for: 2–4 GPUs connected by NVLink or a fast PCIe bus. The 200Gb/s QSFP link between 2 DGX Sparks is ideal.
vLLM flag: --tensor-parallel-size 2
PCIe delivers 3–5× less bandwidth than NVLink for AllReduce operations. Tensor parallelism over PCIe still works — 2× RTX 4090 at TP=2 is a common setup — but expect 20–30% lower decode throughput than the same model on NVLink-connected GPUs.
Example: 70B on 2× RTX 4090
Pipeline parallelism: splitting layers sequentially
Pipeline parallelism (PP) assigns contiguous groups of layers to different GPUs. GPU 0 holds layers 0–19, GPU 1 holds layers 20–39. Tokens flow through the pipeline like an assembly line.--pipeline-parallel-size 2
When PP beats TP
Use pipeline parallelism over tensor parallelism when:- GPUs are in different machines connected by a network (10GbE–100GbE).
- GPUs are connected by PCIe and the model is small enough that PP’s bubble waste costs less than TP’s AllReduce bandwidth.
- You chain 3+ nodes where TP across all of them would saturate the interconnect.
Data parallelism: running the same model on multiple GPUs
Data parallelism (DP) runs a full copy of the model on each GPU and distributes incoming requests across them. There is no inter-GPU communication during inference — each GPU independently handles its own batch of requests./v1/chat/completions requests across both ports.
Expert parallelism: for mixture-of-experts models
Expert parallelism (EP) applies only to mixture-of-experts (MoE) models. In an MoE model, each token activates only a small subset of the model’s “experts” — for example, Qwen3-235B has 256 routed experts but only 6 fire per token (~22B active parameters out of 235B total). EP puts different experts on different GPUs so you do not waste memory storing inactive experts everywhere.--enable-expert-parallel combined with --tensor-parallel-size
Combining strategies: TP, PP, and DP
When you have many GPUs, you combine strategies hierarchically:- TP within a node (where the interconnect is fast).
- PP across nodes (where the interconnect is slower).
- DP for throughput (run multiple replicas of the combined TP+PP setup).
4 GPUs: TP=2 + PP=2
8 GPUs: TP=4 + DP=2
Run 2 replicas of a 4-way tensor-parallel setup. Each replica uses 4 GPUs for TP, and a load balancer distributes requests between the 2 replicas. This gives you the low latency of TP=4 with 2× the throughput.The rule of thumb
- TP first — within the fastest interconnect you have (NVLink, QSFP, PCIe).
- PP second — across slower links (Ethernet, network between machines).
- DP last — when you need more throughput and have spare GPUs for replicas.
TP × PP = total GPUs used for one replica. If you set --tensor-parallel-size 4 --pipeline-parallel-size 2, vLLM uses 8 GPUs for 1 replica.
Sharding decision matrix
70B, 2× RTX 4090 (PCIe)
PP. PCIe bandwidth is too low for efficient AllReduce. Pipeline parallelism avoids the bottleneck.
70B, 2× A100 (NVLink)
TP. NVLink delivers enough bandwidth for AllReduce. Lower latency per token.
235B MoE, DGX Spark
EP. Native MoE handling — each GPU holds only its experts, not the full 235B.
7B, high traffic
DP. Model fits on 1 GPU. Replicate for throughput.
70B, 4× A100 (NVLink)
TP=4 (or TP=2 + DP=2 if you need throughput over latency).
70B, 2 machines
PP=2. Network between machines is too slow for TP. Pipeline avoids the bandwidth wall.
Practical commands
Verify sharding is working
Runnvidia-smi on every GPU. All participating GPUs should show memory allocated for the model:
Common mistakes
Using TP over slow PCIe. AllReduce sends activation data after every layer. On PCIe 3.0, this chokes decode throughput. If your GPUs lack NVLink, test PP and compare. Using PP with batch size 1. The pipeline bubble wastes the most compute when only 1 token flows at a time. vLLM’s continuous batching mitigates this — make sure you run with enough concurrent requests to fill the pipeline. Forgetting that DP requires N× model memory. 4 replicas of a 70B Q4 model (~35 GB each) need 140 GB total. Plan memory before adding replicas. Not accounting for KV cache. Model weights are only part of GPU memory. The KV cache for active sequences takes the rest. When you shard weights across 2 GPUs, you also shard the KV cache — effectively doubling your concurrent user capacity. But if you plan memory for weights alone, you will OOM. Budget for weights + KV cache + ~3 GB overhead before you pick a sharding strategy. Mixing TP and PP in the wrong order. vLLM applies TP within each pipeline stage. Set--tensor-parallel-size to the GPU count within a single node and --pipeline-parallel-size to the node count. Reversing them puts PP within a node (wasting fast interconnect on point-to-point) and TP across nodes (saturating the network with AllReduce).
Next steps
Tensor vs pipeline parallelism
Detailed TP vs PP comparison with performance benchmarks.
One vs two DGX Sparks
When to add a second Spark and how to configure the 200Gb/s link.
DGX Spark memory tuning
KV cache math and memory parameters for sharded deployments.
Model serving and scaling
How inference engines manage batching, precision, and parallelism.