Distributed training runs one training job across many GPUs, in one machine or several, so it finishes faster or fits a model too big for one GPU. It combines data parallelism (split the data), sharding (split model state), tensor parallelism (split each layer) and pipeline parallelism (split the layers), synchronised by all-reduce over NCCL.
- Main strategies
- Data, sharded (FSDP/ZeRO), tensor, pipeline, expert parallelism
- Core operation
- All-reduce of gradients (NCCL on NVIDIA GPUs)
- All-reduce traffic per GPU (ring)
- ≈ 2 × (N−1)/N × gradient size
- Within one machine
- PCIe or NVLink/NVSwitch
- Across machines
- InfiniBand or RoCE, typically 400 Gb/s per GPU on modern clusters
- Common frameworks
- PyTorch DDP/FSDP, DeepSpeed, Megatron-LM, TorchTitan
Distributed training is how every large model you have heard of was built, and how most serious fine-tunes are run. The idea is simple: split one training job across many GPUs. The detail is in what you split, and in how the GPUs keep each other in sync without spending all their time talking. This guide explains the main forms of parallelism, the communication underneath them, and how to decide what your job needs. It is part of our guide to GPU model training.
What is distributed training?
Distributed training is the practice of running a single model-training job across more than one processor, usually GPUs, so that it either completes faster or fits a model and optimiser state larger than one device's memory. The GPUs can be in one machine or spread across many machines connected by a network.
Each training step has the same three parts as on one GPU: a forward pass, a backward pass that computes gradients, and an optimiser step that updates weights. Distributed training divides some of that work and adds communication to stitch the results back together. The art is choosing a split where the communication is cheap compared with the computation it saves.
Why do you need it?
Two limits push you there: memory and time.
- Memory. Full training with Adam in mixed precision needs roughly 16–20 bytes per parameter before activations. A 70B model therefore needs about 1,120–1,400 GB of model state. The largest single GPU we rent, the B300, has 288 GB. No single card can hold it.
- Time. Training compute is about 6 × parameters × tokens FLOPs. A 1B model on 20 billion tokens is 1.2×10²⁰ FLOPs, which we estimate at about 126 hours on one H100 PCIe (756 TFLOPS dense BF16 at 35% utilisation). Eight GPUs bring that under a day. Frontier models need millions of GPU-hours, which is only practical spread over thousands of GPUs.
What are the types of parallelism?
There are five main strategies. Real large-scale runs combine several; fine-tuning jobs usually need only the first two.
| Strategy | What is split | Solves | Communication | Typical scope |
|---|---|---|---|---|
| Data parallelism (DDP) | The batch | Time | All-reduce of gradients once per step | Any |
| Sharded data parallelism (FSDP, ZeRO) | Optimiser state, gradients, weights | Memory and time | All-gather weights + reduce-scatter gradients per layer | Within a node; across nodes with fast networking |
| Tensor parallelism | Each layer's weight matrices | Memory, latency | All-reduce inside every layer, many times per step | Within a node (NVLink) |
| Pipeline parallelism | Groups of layers | Memory | Activations passed between stages | Across nodes |
| Expert parallelism | Experts in a mixture-of-experts model | Memory for MoE | All-to-all token routing | Within and across nodes |
Data parallelism
Every GPU holds a full copy of the model and processes a different slice of each batch. After the backward pass, an all-reduce averages the gradients so every copy applies the same update. It is the simplest form, scales speed nearly linearly within a machine, and does nothing for memory. PyTorch's DistributedDataParallel (DDP) is the standard implementation; see the PyTorch distributed overview.
Sharded data parallelism
Sharding removes the redundancy in data parallelism. Instead of every GPU holding the full optimiser state, gradients and weights, each holds 1/N of them. Before computing a layer, the GPUs all-gather that layer's weights, use them, then discard the non-local parts. After the backward pass, gradients are reduce-scattered so each GPU keeps only its shard. Model-state memory per GPU falls from 16P to about 16P ÷ N. PyTorch FSDP and DeepSpeed ZeRO stage 3 both work this way; ZeRO stages 1 and 2 shard only the optimiser state, or the optimiser state and gradients. Our single vs multi-GPU training guide has the per-GPU memory tables.
Tensor parallelism
Tensor parallelism splits individual weight matrices across GPUs. For a transformer's MLP block, the first matrix is split by columns and the second by rows, so each GPU computes part of the layer and one all-reduce combines the outputs. This happens in every layer, forward and backward, so it needs very fast links. It is almost always kept inside one NVLink-connected machine. Megatron-LM popularised the approach for transformers, and inference engines like vLLM use the same idea to serve one model across several GPUs.
Pipeline parallelism
Pipeline parallelism places different layers on different GPUs: layers 1–20 on GPU 0, 21–40 on GPU 1, and so on. Activations flow forward through the stages and gradients flow back. Done naively, only one GPU works at a time; schedules such as GPipe and 1F1B split each batch into micro-batches so stages overlap. Communication is only activations at stage boundaries, which makes it the usual choice for splitting across machines.
Expert parallelism
Mixture-of-experts models, such as gpt-oss and Qwen3's MoE variants, route each token to a few of many expert sub-networks. Expert parallelism puts different experts on different GPUs and sends tokens to wherever their expert lives with an all-to-all exchange.
How do GPUs communicate during training?
GPUs synchronise through collective operations, implemented on NVIDIA hardware by the NCCL library. The main ones:
- All-reduce: every GPU contributes a tensor; every GPU gets the sum. Used for DDP gradients and tensor-parallel layers.
- All-gather: every GPU contributes a shard; every GPU gets the full tensor. Used by FSDP/ZeRO-3 to rebuild a layer's weights.
- Reduce-scatter: sum across GPUs, then each keeps one shard. Used by FSDP/ZeRO for gradients.
- All-to-all: every GPU sends a different piece to every other. Used for expert parallelism.
With the common ring algorithm, an all-reduce moves about 2 × (N−1)/N × the tensor size in and out of each GPU. Worked example: DDP full fine-tune of an 8B model with BF16 gradients on 8 GPUs. Gradient size = 8×10⁹ × 2 bytes = 16 GB. Traffic per GPU per step ≈ 2 × 7/8 × 16 GB = 28 GB.
| Link | Approximate bandwidth | Time to move 28 GB (ideal) |
|---|---|---|
| PCIe Gen4 x16 | ≈ 32 GB/s per direction | ≈ 0.9 s |
| PCIe Gen5 x16 | ≈ 64 GB/s per direction | ≈ 0.44 s |
| NVLink 4 (H100 SXM, aggregate) | 900 GB/s bidirectional, per NVIDIA | ≈ 0.06 s |
| 400 Gb/s InfiniBand per GPU | ≈ 50 GB/s | ≈ 0.56 s |
| 25 Gb/s Ethernet | ≈ 3.1 GB/s | ≈ 9 s |
Idealised: real collectives achieve less than link peak, and much of the all-reduce overlaps with the backward pass. The table shows why within-machine training works over PCIe for many jobs, and why cross-machine training of large models needs InfiniBand or RoCE: on ordinary Ethernet, a step would spend seconds waiting for gradients. For LoRA, only the adapter gradients are exchanged, often under 100 MB, so communication barely registers.
Single node or multi-node?
A node is one machine. Inside it, GPUs share fast links and a single host. Across nodes, every byte goes over a network card. Most distributed fine-tuning should stay on one node:
| Job | One node (up to 8 GPUs) | Multi-node needed? |
|---|---|---|
| LoRA/QLoRA up to 70B | Yes | No |
| Full fine-tune up to ≈ 14B | Yes, FSDP or ZeRO-3 on 80 GB cards | No |
| Full fine-tune of 70B | Only on 8 × B200 or B300 class | Often yes |
| Pre-training a 1–3B model on tens of billions of tokens | Yes, in days | Optional, for speed |
| Pre-training 7B+ on trillions of tokens | No | Yes, hundreds to thousands of GPUs |
The memory column for 70B: 1,120 GB of model state ÷ 8 = 140 GB per GPU before activations, which fits on a 180 GB B200 or 288 GB B300 but not on 80 GB or 141 GB cards. Our VRAM guide for fine-tuning has the full sums.
How do you run distributed training in practice?
You write one script and start one process per GPU. The launcher assigns each process a rank and tells it how to find the others; PyTorch then initialises a process group over NCCL. A minimal DDP example that runs as-is:
# ddp_min.py — run with: torchrun --standalone --nproc_per_node=4 ddp_min.py
import os, torch, torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
dist.init_process_group("nccl")
rank = int(os.environ["LOCAL_RANK"])
torch.cuda.set_device(rank)
model = torch.nn.Sequential(
torch.nn.Linear(4096, 4096), torch.nn.GELU(), torch.nn.Linear(4096, 4096)
).cuda()
model = DDP(model, device_ids=[rank])
opt = torch.optim.AdamW(model.parameters(), lr=1e-4)
for step in range(100):
x = torch.randn(64, 4096, device="cuda")
loss = model(x).pow(2).mean()
opt.zero_grad()
loss.backward() # gradients are all-reduced here
opt.step()
if rank == 0 and step % 20 == 0:
print(f"step {step} loss {loss.item():.4f}")
dist.destroy_process_group()In practice, most people let a framework handle this. Hugging Face Trainer, TRL and Axolotl read the launcher's environment and use DDP, FSDP or DeepSpeed based on a config file. Large pre-training runs use Megatron-LM, NVIDIA NeMo or PyTorch's TorchTitan, which combine data, tensor and pipeline parallelism (often called 3D parallelism). The DeepSpeed site documents ZeRO and offload options.
A multi-node launch adds the node count and a rendezvous address, and only works when every node can reach the others over a fast fabric:
# on each of 2 nodes (shown for reference; needs a multi-node cluster)
torchrun --nnodes=2 --nproc_per_node=8 --node_rank=$NODE_RANK \
--rdzv_backend=c10d --rdzv_endpoint=$MASTER_ADDR:29500 train.pyStep-by-step setup and NCCL health checks for a single machine are in how to set up a multi-GPU ML environment.
What does distributed training cost?
GPU-hours = single-GPU compute hours ÷ scaling efficiency. Distribution does not make training cheaper; it makes it faster or possible. Example: pre-training a 1B model on 20 billion tokens, estimated at about 126 H100 PCIe GPU-hours of pure compute.
| Setup | Assumed efficiency | Wall-clock | Billed GPU-hours | Price per GPU-hour | Cost |
|---|---|---|---|---|---|
| 1 × H100 | 100% | ≈ 126 h | 126 | $4.99/hr | $628.74 |
| 8 × H100, DDP | 90% | ≈ 17.5 h | ≈ 140 | $4.99/hr | $698.60 |
| 8 × B200, DDP | 90% | ≈ 5.9 h | ≈ 47 | $15.49/hr | $728.03 |
Estimates, prices as of November 2026. B200 compute uses about 2,250 TFLOPS dense BF16, giving ≈ 42 single-GPU hours. Eight GPUs cost about 11% more in total at 90% efficiency but finish in under a day instead of over five. Prices for every card are on our GPU list. Whether a faster, newer card is cheaper per run depends on the ratio of its speed to its price; work it out for your job.
When renting from Wandering Giants fits
Wandering Giants Compute is built for single-node distributed training: one machine with 2, 4 or 8 of the same GPU, from RTX 4090 to B300, with root access for PyTorch DDP, FSDP, DeepSpeed and Accelerate, billed by the minute from prepaid credit. That covers LoRA and QLoRA at any open-model size up to 70B, full fine-tunes of small and mid-size models, and pre-training of small models.
We do not offer multi-node clusters or InfiniBand. If your plan needs tensor and pipeline parallelism across many machines, for example pre-training at 7B and above, use a provider built for it, such as CoreWeave, Lambda's 1-Click Clusters, Nebius or one of the hyperscalers. For guidance on the single-machine setup, read multi-GPU computing explained.
Frequently asked questions
What is the difference between data parallelism and model parallelism?
Data parallelism copies the whole model to every GPU and splits the training data between them. Model parallelism splits the model itself, either each layer's matrices (tensor parallelism) or groups of layers (pipeline parallelism), so a model too large for one GPU can run. Large runs combine both.
What is all-reduce?
All-reduce is a collective operation in which every GPU contributes a tensor and every GPU receives the sum (or average). In data-parallel training it averages gradients so all model copies apply the same update. NVIDIA's NCCL library implements it efficiently over NVLink, PCIe and InfiniBand.
Do I need InfiniBand for distributed training?
Inside one machine, no: GPUs communicate over NVLink or PCIe. Across machines, for large models, effectively yes. Ordinary Ethernet is far slower than InfiniBand or RoCE, and sharded or tensor-parallel training across nodes would spend most of its time waiting on the network.
Is FSDP the same as DeepSpeed ZeRO?
They implement the same idea: shard optimiser state, gradients and weights across data-parallel workers and gather weights layer by layer when needed. FSDP is built into PyTorch; ZeRO is part of Microsoft's DeepSpeed and adds features such as CPU and NVMe offload.
How many GPUs do I need for distributed training?
Two is enough to start. Most fine-tuning jobs that need distribution fit on one machine with 4 or 8 GPUs. Pre-training large models uses hundreds to tens of thousands of GPUs across many machines.
Why doesn't training scale perfectly with more GPUs?
Every step includes communication, and some of it cannot be hidden behind computation. Slow links, small batches, stragglers and data loading all reduce efficiency. Within one machine 85–95% efficiency is a common rule of thumb; across many nodes it depends heavily on the network.
Rent the GPU for this, by the minute.
Run distributed training on up to 8 of the same GPU in one machine, with root access and per-minute billing.
Prepaid credit, billed by the minute, stops itself when credit runs out. Prices in £, $, €, ¥, CA$, A$, CHF and S$; UK prices include VAT.
Keep reading
- Complete guideWhat Is GPU Model Training? A Complete Guide
- GuideSingle GPU vs Multi-GPU Training: What Changes?
- TutorialHow to Set Up a Multi-GPU Machine Learning Environment
- GuideWhat Is Multi-GPU Computing and When Do You Need It?
- GuideWhat Is GPU Parallel Processing? Explained for AI Developers
- GuideHow Much VRAM Do You Need to Fine-Tune an LLM?
About this article. Written by the Wandering Giants Compute team, the people who run Wandering Giants Compute. Hardware figures are the manufacturers’ published specifications. Speeds and costs marked as estimates are worked out from those specifications and our current prices, with the method shown; they are not measured benchmarks. Wandering Giants prices are taken live from our price list each time this page is built.
Last reviewed 25 November 2026.