Walk through how tensor parallelism shards one matmul across GPUs and what it adds to decode step time
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Describe how tensor parallelism splits a single weight matrix across GPUs, what communication operation is needed to reassemble the output, and the concrete cost this imposes on each decode step. State the interconnect requirement that makes or breaks the strategy.
Tensor parallelism shards each weight matrix column-wise then row-wise across N GPUs; an all-reduce after every layer sums the partial outputs, paid once per layer per decode step, and only pays off on NVLink-class
Imagine a long math problem split across four friends. The first friend does the left quarter of the multiplication, the second friend the next quarter, and so on. Each friend ends up with only a piece of the answer. Before they can do the next problem together, they have to pass their pieces around and add them up so everyone has the full answer. If the friends are sitting at the same table and can hand papers across instantly, the sharing is cheap. If they are in different buildings and have to mail letters, the sharing takes longer than the math itself. That is the trick behind splitting one giant multiplication across several GPUs, and it is the reason this only pays off when the GPUs sit next to each other on a fast fabric like NVLink.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: column-then-row sharding inside the block, why the first matmul needs no communication, the all-reduce closing each block, the per-layer per-token cadence, and the interconnect-class binary that decides whether TP wins or loses.
| Aspect | Tensor parallelism | Pipeline parallelism | Data parallelism |
|---|---|---|---|
| What is sharded | Each weight matrix (intra-layer) | Layer groups across stages | Batch across replicas |
| Communication primitive | All-reduce per layer | Point-to-point at stage boundary | All-reduce of gradients (training only) |
| Communication frequency | Every layer every forward pass | Once per pipeline stage | Once per training step |
| Bandwidth need | Very high (NVLink class) | Modest (Ethernet OK) | Modest |
| Decode latency impact | Each token waits on N_layers reductions | Adds pipeline-fill latency at batch 1 | No effect on single-request latency |
| Typical scope | Inside one node | Across nodes | Across replicas for throughput |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating tensor parallelism as a free capacity expander. The cross-GPU all-reduce fires every layer every decode step, so on PCIe-only or cross-node links it costs more wall-clock than the weight-bandwidth saving buys you.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.