Tensor Parallelism › Row Parallelism
Language AI HandbookAll chapters Tensor Parallelism › Row ParallelismOne section · Sections in this chapter4 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Row parallelism splits a weight matrix along its input (row) dimension. Given the weight matrix , we partition along the row dimension into slices:
where each .
Each GPU stores its row shard and receives a corresponding slice of the input, then computes:
where:
- is the input shard on GPU
- is the row shard on GPU
- is the partial result on GPU
The full output requires summing the partial results:
This is an all-reduce operation: each device produces a partial sum over the full output dimension , and summing these partial results gives the correct final output. Unlike column parallelism, where the output shards can be consumed independently (each GPU's shard feeds into a corresponding downstream shard), row parallelism requires synchronization to assemble the full output.
The correctness of this decomposition follows directly from the block form of matrix multiplication. If we write the full input as (conceptually partitioned along the column dimension) and the weight matrix as stacked row blocks, then:
Each term is a partial contribution to the full output, and summing them gives the correct result. Note that each partial result has the full output shape rather than a shard of it. This is the defining feature of row parallelism: the partial results are over the full output space, and correctness requires their sum, not their concatenation.
Why Row Parallelism Follows Column Parallelism Naturally
The design of row parallelism makes most sense when you see it as the second half of a pair. The output of a column-parallel layer is a feature-sharded tensor, where GPU holds the columns of the full hidden state. This is precisely the input format that row parallelism expects: GPU should receive input shard corresponding to its row shard . When you place a row-parallel layer directly after a column-parallel layer, the output of the first layer is already distributed in exactly the right way for the second layer to consume without any additional communication.
This chaining property is what makes tensor parallelism efficient. Without it, you would need an all-gather after the column-parallel layer to reassemble the full activation before the row-parallel layer, adding an extra communication step. With careful layer pairing, the communication is deferred to the very end, where a single all-reduce assembles the final output.