In the MLP block it splits both matrix multiplies, and needs a single all-reduce in the forward pass and one in the backward pass. In attention, each head's matrix multiply runs locally on one GPU. A whole layer takes two all-reduces forward and two backward, and each one carries the layer's activations: tensors of size b × s × h, for the batch, sequence length and hidden size.
NVIDIA's NCCL tests give an all-reduce's best case: S elements over n GPUs, each sending at bandwidth B, take S × 2(n − 1) / (n × B). Inside a node, NVIDIA lists 900 GB/s of NVLink for an H100, which the scaling book counts as about 450 GB/s out of each GPU. Between nodes, each GPU has 50 GB/s.
Here's that traffic for one 8,192-token sequence through all 80 layers, split 8 ways:
layers, hidden, seq, tp = 80, 8_192, 8_192, 8
# one sequence's activations at one layer
values = seq * hidden
# 4 all-reduces across 8 GPUs, 2 bytes a value
per_layer = 4 * 2 * (tp - 1) / tp * values * 2
per_sequence = per_layer * layers
# the 8 GPUs share one sequence's work
compute = 6 * params * seq / (tp * 989e12 * 0.40)
for link, bw in (("NVLink", 450e9), ("InfiniBand", 50e9)):
print(f"{link:10}: {per_sequence / bw:.2f} s of traffic a sequence, {compute:.2f} s of compute")