Tensor parallelism is a model-parallel method that splits the weight matrices of a single layer across multiple GPUs and has each GPU compute its share of the matrix multiplication. Megatron-LM is a design of this approach tailored to the Transformer; by adding only a small amount of communication inside each layer, it makes it possible to train large language models that do not fit on one GPU.
In data parallelism, every GPU holds the whole model, so it cannot be used unless the model fits in one GPU's memory. A method that splits the model itself is therefore needed. There are two ways to split: pipeline parallelism, which cuts the sequence of layers and assigns the pieces to GPUs, and tensor parallelism, which splits the matrices inside a single layer.
In their 2019 paper "Megatron-LM," Shoeybi et al. showed how to parallelize the two blocks of the Transformer (multi-head attention and the MLP) with only two All-Reduces in the forward pass and two in the backward pass per layer. No new compiler or library is required; it can be implemented by adding communication at a few places in an existing PyTorch Transformer implementation. With this method they trained an 8.3B-parameter GPT-2-style model and a 3.9B-parameter BERT-style model.
As an analogy, it is like splitting the computation of a large table by columns among several people. Each person computes only their assigned columns, and at the end they bring their results together and add them up.

