When scaling multi-GPU training, keep Tensor Parallelism within NVLink (TP <= 8) and use Ring/Tree AllReduce with gradient bucketing across nodes.
TL;DR30-second simplified summary▾
Ring AllReduce divides an M-byte tensor into N chunks and runs 2*(N-1) pipelined ring steps, keeping per-GPU traffic bounded at ~2M even as N grows. Pairing column-parallel W1 (independent GeLU) with row-parallel W2 reduces each Transformer MLP/Attention block to a single AllReduce.
P · Problem & The Parameter-Server Bottleneck.
Imagine 64 GPUs each holding a 10 GB gradient vector. If all 64 GPUs send their 10 GB vector to one Parameter Server (PS) to be averaged and broadcast back, that single PS NIC must receive 640 GB and transmit 640 GB every training step.
With a 400 Gbps (50 GB/s) NIC, receiving and broadcasting 1.28 TB takes at least 25.6 seconds per step—longer than the forward and backward math itself. Worse, in a naive peer-to-peer All-to-All where every GPU sends M bytes to N-1 peers, link congestion scales quadratically.
Parameter Server O(N) Fan-In vs. Ring AllReduce O(1) Per-Link
- Root NIC ingests N * M bytes
- 63 GPUs idle during reduction
- Single point of congestion
- Each GPU sends 2*(N-1)/N * M
- All N NICs active in full duplex
- Throughput independent of N
R · Representation: Scatter-Reduce + AllGather.
Arrange N GPUs in a circle: GPU 0 -> GPU 1 -> ... -> GPU N-1 -> GPU 0. Slice the M-byte tensor into N equal chunks of size M/N. Every step, each GPU sends one chunk to its right neighbor while receiving one chunk from its left neighbor.
In Phase 1 (Scatter-Reduce, N-1 steps), each GPU adds the incoming chunk into its local buffer and forwards the running sum. After N-1 steps, GPU k holds the complete global sum for chunk k. In Phase 2 (AllGather, N-1 steps), each GPU forwards its finalized chunk around the ring without adding, overwriting local chunks until all N GPUs hold all N summed chunks.
Scatter-Reduce Followed by AllGather Across N Ranks
I · Invariant: Column-Then-Row Tensor Parallelism.
When a single MLP weight matrix W1 is too large for one GPU, you can slice it across GPUs. If you sliced W1 row-wise, every GPU would hold only a partial dot product and would have to AllReduce before applying GeLU(x), because GeLU(a + b) != GeLU(a) + GeLU(b).
Megatron-LM avoids that extra sync by splitting W1 column-wise: W1 = [W1_A | W1_B]. Both GPUs receive the full input X, compute Y_A = GeLU(X * W1_A) and Y_B = GeLU(X * W1_B) completely independently, and then feed into W2 split row-wise: W2 = [W2_A; W2_B]. Because matrix multiplication distributes over row splits, Y_AW2_A + Y_BW2_B equals the exact unsharded output after a single AllReduce.
Column-Wise W1 -> Local GeLU -> Row-Wise W2 -> Single AllReduce
M · Mechanics at Scale: NVLink Bounds & Tree Fallbacks.
Ring AllReduce maximizes bandwidth, but its step count grows linearly with N: 2*(N-1) hops. For small tensors (like 1 MB biases or small TP activations), latency per hop—not bandwidth—dominates total step time.
On an 8-GPU H100 node with 900 GB/s NVLink, transferring a 64 MB activation tensor via Ring AllReduce takes ~2 * (7/8) * 64 MB / 450 GB/s ~ 0.25 ms. Moving that exact same TP AllReduce across 50 GB/s InfiniBand adds ~2.3 ms per layer—times 80 layers, that is 368 ms of pure network stall per forward+backward pass.
Intra-Node NVLink (900 GB/s) vs. Inter-Node InfiniBand (50 GB/s)
- Problem
- How to scale collective reduction and tensor sharding from 8 GPUs to 1,024 GPUs without stalling compute.
- Naive Solution
- Stretch Tensor Parallelism across all 1,024 GPUs or use a single-node Parameter Server.
- Why It Fails
- Parameter Servers hit an O(N) NIC bottleneck, while cross-node Tensor Parallelism hits 2*(L) synchronous AllReduces per step over slower InfiniBand.
- Alternatives
- Ring AllReduce vs. Double-Binary Tree AllReduce; TP inside NVLink vs. Pipeline Parallelism (PP) + Data Parallelism (DP) across nodes.
- Engineering Decision
- Keep Tensor Parallelism strictly within the intra-node NVLink domain (TP <= 8), use Ring/Tree AllReduce for Data Parallel gradients, and overlap backward compute with gradient bucketing.
- Trade-Offs
- Requires 3D topology-aware rank placement (NCCL topo detection) and careful microbatch tuning to hide pipeline and DP communication.
E · Edge Cases, Assumptions & When NOT to Use It.
Ring AllReduce is lock-step synchronous: if 1 GPU out of 1,024 throttles thermally or hits a PCIe error, all 1,023 other GPUs stall waiting for its ring chunk.
When NOT to use Tensor Parallelism: if your model fits on 1 GPU with activation checkpointing, TP=1 always beats TP=2+ because it eliminates AllReduce overhead completely. Similarly, do not use Ring AllReduce for tiny tensors (<1 MB) across hundreds of ranks—latency dominates, so use Tree AllReduce or fuse gradients into 25 MB+ buckets.
Ring Health -> Straggler Stall -> Watchdog Timeout -> Checkpoint Rollback
You are training a 7B-parameter model on 64x 80 GB H100 GPUs (8 nodes x 8 GPUs). The model weights + optimizer states fit comfortably on 1 node (or even 1–2 GPUs with ZeRO-2). Your team proposes setting TP=16 across two nodes. What should you do?
Practice: Make the trade-off yourself.
For N = 16 GPUs syncing a 2 GB gradient tensor via Ring AllReduce, roughly how much data does each GPU transmit in total across both phases?