Papers · 2019 · Reading: 23 min, plus 6 in closed details.
Paper · arXiv preprint · arXiv 1909.08053

Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism (Megatron-LM)

Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, Bryan Catanzaro
NVIDIA · September 2019 (arXiv v1 17 September 2019; v4 13 March 2020)

In one line: Made tensor (intra-layer model) parallelism simple for transformers in plain PyTorch: column-split the GEMM feeding each nonlinearity and row-split the one after it, so a transformer layer needs only 4 all-reduces (2 forward, 2 backward), training an 8.3B GPT-2 on 512 V100s at 76% weak-scaling efficiency against one GPU.

8.3B parameters
GPT-2-style model on 512 V100s, 8-way tensor × 64-way data parallel
about 5.5 times GPT-2's 1.5B; 15.1 PFLOP/s sustained · §5.1
4 all-reduces per layer
2 forward and 2 backward, for attention and MLP together
the whole of the communication the split adds · Figure 4
10.81 perplexity
WikiText103 zero-shot, against 15.79 before
and 66.51% on LAMBADA, against 63.24% · Table 3

How far to trust it: Trust the mechanism fully: it is exact algebra, and every later training and serving stack uses it. Read the 76% as weak scaling in model size against a strong baseline, not as a speedup, and the state-of-the-art results as single runs on different training data. The evidence, point by point.

The idea in one sentence: split the matrix that feeds a nonlinearity by columns and the matrix after it by rows, so each GPU runs its slice of the block with no communication and one all-reduce restores the output; a whole transformer layer then costs 2 all-reduces forward and 2 backward, written in plain PyTorch.

You need: data parallelism and what an all-reduce is (Distributed training, sections 2 and 3). New terms: column-parallel (each GPU holds whole output columns of a weight matrix), row-parallel (each GPU holds input rows and produces a partial sum), f and g (the two communication operators), weak scaling (the model grows with the GPU count) against strong scaling (the same model on more GPUs).

Fig. 1 · One transformer layer on 2 GPUs: everything blue is local; the orange all-reduces are the only communication

Redrawn from Figures 3 and 4 for 2 GPUs, with the shapes of the 8.3B scaling model (H = 3,072, 32 heads, Table 1); the paper runs it on 8. Blue: work on this GPU's own slice. Orange, dashed: a partial sum. Grey: identical on both GPUs. f and g are the paper's two operators: g all-reduces in the forward pass, f in the backward pass, once per block, so 4 per layer.

Problem

§1 Introduction, §2.3

By 2019 the useful frontier of language models (BERT-large at 336M parameters, GPT-2 at 1.5B) had reached the memory of a single accelerator. Training keeps the weights, their gradients and the Adam optimiser's extra state per parameter, plus the activations, and a 32 GB V100 was running out even with activation checkpointing (§1, §2.3; what recomputation trades is on Distributed training, section 10). Data parallelism, the usual way to scale out, has a hard limit here: "the model must fit entirely on one worker" (§2.3). Sharing parameters across layers, as ALBERT does, shrinks the footprint but also the model's capacity.

The existing ways to split a model across devices each had a cost (§2.3):

  • Pipeline parallelism (layers on different devices, in stages): with a parameter server (PipeDream and others) it suffers inconsistency; GPipe fixes that with synchronous gradient descent but pays either in pipeline bubbles that reduce efficiency or in optimiser changes that affect accuracy (the bubble is drawn on Distributed training, section 6).
  • Distributed tensor computation (one operation split across devices): general, but FlexFlow and Mesh-TensorFlow are frameworks with their own language and compiler, and GPipe and Mesh-TensorFlow "require rewriting the model, and rely on custom compilers and frameworks that are still under development" (§1).

The calculator makes the memory wall concrete with the Table 1 models. It counts 16 bytes per parameter for mixed-precision Adam (fp16 weights and gradients, fp32 master weights, momentum and variance, the accounting in ZeRO §3.1), divides it by the number of GPUs splitting each layer, and adds the activations that checkpointing after every layer still holds.

The gap: a way to split a transformer layer itself across GPUs that is simple enough to write in native PyTorch with a handful of communication calls: no new compiler, no new framework, and orthogonal to pipeline parallelism so the two can be combined (§1).

Try: pick each model and find the fewest GPUs that bring it under the 32 GB line, then compare with the GPU count the paper used in Table 1.

Defaults reproduce: the fewest GPUs that fit is 1, 2, 4 and 8 for the four models, Table 1's model-parallel GPU column, independently (recompute.py).

The memory formula

Per GPU: 16 × parameters / t for weights, gradients and Adam state; 2sbh bytes per layer for the checkpointed fp16 layer inputs (not split by Megatron); one layer's full activations during its recomputation, sbh(10 + 24/t + 5as/(ht)) bytes (Korthikanti et al. 2022, §4.1). Batch 8 and sequence 1,024 as in the paper's model-parallel scaling runs (§5.1). Ignores fragmentation and framework buffers.

Idea: split each matrix the way that keeps nonlinearities local

§3, Eq. 1 to 3

The core idea is intra-layer model parallelism, now called tensor parallelism (TP): partition the weight matrices of every transformer layer across GPUs, choosing the direction of each split so that no nonlinearity ever sees a partial sum. Then the GPUs only need to synchronise a few times per layer (§3).

A transformer layer is a self-attention block followed by a two-layer MLP (Figure 2). The MLP's first half is a matrix multiply (GEMM) followed by a GeLU:

Y = GeLU(XA)
Equation 1 (§3). X is the batch of token vectors, A is H × 4H.

There are two ways to split that GEMM across two GPUs:

  1. Split A by rows and X by columns: X = [X1, X2], A = [A1; A2], so XA = X1A1 + X2A2 (Eq. 2). Each GPU holds a partial sum of the whole output. Because GeLU is nonlinear, GeLU(X1A1 + X2A2) ≠ GeLU(X1A1) + GeLU(X2A2), so the GPUs must add their partials (an all-reduce) before the GeLU.
  2. Split A by columns: A = [A1, A2] gives [Y1, Y2] = [GeLU(XA1), GeLU(XA2)] (Eq. 3). Each GPU owns whole output columns, so GeLU applies to each shard independently: no synchronisation.

Megatron takes option 2 for the first GEMM (column-parallel) and then splits the second GEMM, B (4H × H), by rows (row-parallel): B = [B1; B2], so GPU i computes YiBi straight from its own GeLU output and the full result Y1B1 + Y2B2 is recovered by a single all-reduce before dropout (§3, Figure 3a). The general recipe: column-split the layer that feeds a nonlinearity, row-split the layer that follows it, and the elementwise nonlinearity lives entirely between them with zero communication.

with option 1 (A split by rows), suppose each GPU applies GeLU to its own partial result and the outputs are summed afterwards, to save the synchronisation. How close is that to the true GeLU(XA)?

Method: the f and g operators

§3, Figure 3, Code 1

The MLP block is Z = Dropout(GeLU(XA)B), with A: H × 4H and B: 4H × H. The whole scheme is packaged as two conjugate autograd functions placed around each block (Figure 3):

OperatorWhereForward passBackward passWhy
fblock inputidentityall-reduce of the gradientevery GPU needs the full X, and each contributes part of the gradient with respect to X, which must be summed
gblock outputall-reduceidentitysums the row-parallel partials YiBi; its gradient is already complete on every GPU

Each is a few lines of PyTorch. The paper prints f (Code 1); g swaps the two methods:

class f(torch.autograd.Function):
    def forward(ctx, x):
        return x
    def backward(ctx, gradient):
        all_reduce(gradient)
        return gradient

With one g and one f per block and two blocks per layer, a transformer layer needs exactly 4 all-reduces in total: 2 in the forward pass (one g per block) and 2 in the backward pass (one f per block), covering both attention and the MLP (§3, Figure 4).

Megatron against the split it rejected, step by step (Fig. 2). One MLP block runs forward and backward on 2, 4 or 8 GPUs, at a Table 1 model's own sizes. Megatron splits A by columns and B by rows (§3); Option 1 splits A by rows and must synchronise before the GeLU (Eq. 2). The plain two-GPU forward pass, with sequence parallelism beside it, is drawn on Distributed training (Fig. 7); this figure adds the backward pass, the rejected split and what each sends. Predict before Option 1 plays: it adds one synchronisation; does it send about 1.5, 2 or nearly 4 times Megatron's bytes per block?

  1. Input X, the same on every GPU. Each lane is one GPU (8 at the defaults). Every GPU starts with the whole input for its tokens, H numbers each (the grey slab). The f gate in front of the block is the identity in the forward pass: nothing is sent.
  2. First GEMM, column-parallel: XAi. GPU i holds the columns Ai of the H × 4H matrix, the glass plate on its lane (3,072 × 1,536 at the defaults; the outline is the whole A). Stacked in depth, the slices tile A. Each GPU computes 4H/t whole output columns (blue): nothing is missing from them.
  3. GeLU, locally. Because each GPU owns complete columns, GeLU applies to its slice on its own (Equation 3): no communication, and each GPU evaluates only 1/t of the GeLUs.
  4. Second GEMM, row-parallel: YiBi. GPU i holds the matching rows Bi (1,536 × 3,072 at the defaults), so column block i of A meets row block i of B on the same GPU and it multiplies its own GeLU output straight away. Each result is H wide but only a partial sum (orange).
  5. g: one all-reduce. Dots run between the lanes: the partial sums are added across GPUs, and afterwards every GPU has Z, H numbers per token. This is the block's only forward communication.
  6. Dropout and residual, duplicated. Cheap elementwise work is repeated on every GPU rather than computed once and sent (the dropout masks match because the generators share a seed outside parallel regions).
  7. Backward: the gradient arrives. The gradient of Z is the same on every GPU, and g's backward pass is the identity: nothing to send.
  8. Back through Bi, GeLU and Ai, all local. Each GPU computes the gradients of its own weights and its contribution to the gradient of X: a partial sum, because X fed every GPU's columns.
  9. f backward: one all-reduce of the gradient of X. Summing the contributions gives the full gradient on every GPU. Block total: 2 all-reduces, each of H numbers per token; the attention block adds the same again, so a layer needs 4.

In Fig. 2 each lane is one GPU. Glass plates: the weights that GPU holds, drawn to the model's shape (rows up, columns across; the outline is the whole matrix). Slabs on the lane: what it holds for one token, blue its own slice, orange a partial sum (full width but not yet the answer), grey the full tensor, identical on every GPU. Dots along a lane are local work; dots between lanes are the only communication. The column on the right is what each GPU has sent so far; its outline, the other split's whole block.

How the counters are computed

Elements sent per GPU use the ring algorithm: an all-reduce of n elements sends 2(t − 1)/t × n, an all-gather (t − 1)/t × n, at 2 bytes (fp16) for b × 1,024 tokens. Time is elements ÷ link speed, with no overlap and no latency. Megatron's two collectives are the paper's (Figure 3a); Option 1's backward collectives are derived here (the conjugate of each forward step), not given in the paper.

Answer, and the count with checkpointing

3.75 times for any t. Megatron sends 4(t − 1)/t × H numbers per token per block (two all-reduces of H); Option 1 sends 15(t − 1)/t × H (all-reduces of 4H and H, all-gathers of 4H and H), and every GPU evaluates all 4H GeLUs instead of 4H/t. With activation checkpointing, as the paper trains, each layer's forward pass runs again during the backward pass, and its 2 all-reduces with it: 6 per layer in practice (our reading of how checkpointing works; the paper counts 4). The ring formula behind the byte counts is Interconnects and scaling's.

Method: self-attention, split by heads

§3, Figure 3b

Multi-head attention is embarrassingly parallel over heads. The query, key and value projections are split by columns so that each GPU holds the full Q, K and V projections for a subset of heads; the softmax, attention dropout and the weighted sum over V for those heads then run entirely locally. The output projection is split by rows and consumes the local head outputs directly, followed by the g all-reduce: the same fused pair of GEMMs, the same single forward synchronisation (§3, Figure 3b). It also means the number of heads must be divisible by the number of GPUs.

Does the head count matter for speed? (Appendix D, Table 7)

Yes, a little: at 8.3B on 8 GPUs, 16 heads of 192 scale at 82%, 24 of 128 at 80% and 32 of 96 at 77%, because more heads mean smaller GEMMs and a larger softmax (Table 7).

Method: embeddings and the loss

§3

The output embedding is H × v and GPT-2's vocabulary is 50,257 tokens, so it is worth splitting; and because the input and output embeddings share weights, both are split. The input embedding EH×v is split along the vocabulary, E = [E1, E2]: each GPU looks up the tokens in its slice and an all-reduce (g) merges them. For the output, the parallel GEMM [Y1, Y2] = [XE1, XE2] gives each GPU the logits of its slice. All-gathering them for the loss would communicate b × s × v elements (batch × sequence × vocabulary), huge because v is large; instead the GEMM is fused with the cross-entropy, which reduces what is communicated to b × s (§3).

The vocabulary is padded so each GPU's slice is a multiple of 128 for efficient GEMMs: for up to 8-way splits that means a multiple of 128 × 8 = 1,024, and 50,257 becomes 51,200 (§5.1).

fp16 logits at 2 bytes; losses and statistics at 4 bytes (fp32). Bars to scale on a log axis. The paper counts b × s; Megatron's current cross_entropy.py all-reduces three b × s tensors (the maximum logit, the target's logit and the sum of exponentials), which is still a factor v/3 smaller. Llama 3's vocabulary is from its paper.

Method: duplicate cheap work rather than communicate

§3, Appendix B.2

"Much of our model parallel approach can be characterized as techniques aimed at reducing communication and keeping the GPUs compute bound" (§3). LayerNorm, dropout and the residual connections are cheap, so instead of one GPU computing them and broadcasting the result, every GPU keeps a duplicate copy of the LayerNorm parameters and runs dropout and the residual on the output of the parallel region before feeding the next one. Each model-parallel worker optimises its own set of parameters; since every value is either local to a GPU or duplicated on all of them, no updated parameter values are ever communicated.

Dropout and the random number generators (Appendix B.2)

Dropout needs care because some of it sits outside the parallel regions (before the residual connections) and some inside (attention dropout). Outside, the GPUs must drop the same elements, so all random number generators are seeded identically at the start; inside, each GPU must draw a different pattern, so a separate generator is kept for dropout in the parallel regions, seeded uniquely per worker (Appendix B.2).

Method: combining with data parallelism

Appendix B.1, Figure 8

Tensor parallelism is orthogonal to data parallelism (and to pipeline parallelism), so they compose. Two or more GPUs in the same server form a model-parallel group holding one copy of the model; GPUs with the same position in every model-parallel group form a data-parallel group, whose weight gradients are all-reduced together, several such all-reduces running in parallel. The total GPU count is the product. For the 8.3B model: 8 GPUs per model-parallel group times 64-way data parallelism is 512 GPUs. All communication is PyTorch calling NCCL (Appendix B.1, Figure 8). The 8-way groups sit inside one DGX-2H server, where NVSwitch gives 300 GB/s between GPUs, against 100 GB/s per server between servers (§5).

Fig. 3 builds the 8.3B run's layout of Figure 8 on its real hardware: 32 DGX-2H servers of 16 V100s, GPUs numbered as in the figure.

  1. One DGX-2H server. 16 V100s joined by NVSwitch, 300 GB/s between any two. Its front row (GPUs 1 to 8) is one model-parallel group and its back row (9 to 16) another: two copies of the 8.3B model in every server.
  2. A model-parallel group: f and g on NVSwitch. The 8 GPUs of one group each hold an eighth of every layer and all-reduce activations 4 times per layer (6 with recomputation): 288 all-reduces per iteration for the 72 layers (4 × 72, derived), every one inside the server.
  3. 32 servers, 64 copies of the model. 512 GPUs. Every server holds two model-parallel groups, so the run keeps 64 copies of the model, each working on 8 of the global batch of 512 sequences (512 ÷ 64, derived).
  4. A data-parallel group spans every server. The GPUs at the same position in every group (1, 9, 17, ..., 505 for GPU 1) hold the same slice of the weights, so they all-reduce their weight gradients once per step: 64 GPUs, two per server, across all 32 servers over InfiniBand (100 GB/s per server). Eight such groups, one per position, run their all-reduces in parallel.

Try: pick a GPU. Fig. 3 lights its model-parallel group (blue, inside one server) and its data-parallel group (green, across every server).

One slab per DGX-2H server (16 V100s in two rows of 8), 32 servers, numbered as in Figure 8 (GPUs 1 to 8 form the first model-parallel group; 1, 9, ..., 505 a data-parallel group).

Setup: data, models and recipe

§4, §5.1
Data, training recipe and hardware (§4.1, §4.2, §5)

Data (§4.1): an aggregate of Wikipedia, CC-Stories, RealNews and OpenWebText, with the Wikipedia articles of the WikiText103 test set removed to avoid leakage and stray newlines removed from CC-Stories; BooksCorpus is added for BERT but excluded for GPT-2 because it overlaps with LAMBADA. Documents shorter than 128 tokens are dropped, near-duplicates (Jaccard similarity above 0.7) removed with locality-sensitive hashing: 174 GB of deduplicated text.

Recipe (§4.2):

  • Mixed precision with dynamic loss scaling, for the V100's Tensor Cores.
  • Weights initialised from N(0, 0.02), and the weights just before each residual connection scaled by 1/√(2N), N the number of transformer layers (0.083 for the 72-layer 8.3B model).
  • Adam with weight decay λ = 0.01, global gradient-norm clipping at 1.0, dropout 0.1, activation checkpointing after every transformer layer.
  • GPT-2: sequences of 1,024 subword tokens, batch 512, 300k iterations; learning rate 1.5e-4 with 3k warmup iterations, then a single cosine decay over the remaining 297k, stopped at 1e-5.
  • BERT: largely ALBERT's procedure, the original 30,522-token BERT vocabulary, next-sentence prediction replaced by sentence-order prediction, whole-word n-gram masking (SpanBERT); batch 1,024, learning rate 1.0e-4 warmed up over 10,000 iterations and decayed linearly over 2 million.

Hardware (§5): up to 32 DGX-2H servers, 512 Tesla V100 SXM3 32 GB GPUs; 300 GB/s between GPUs in a server through NVSwitch, 100 GB/s between servers through 8 InfiniBand adapters per server.

Scaling configurations (§5.1, Table 1): four GPT-2 models from 1.2B to 8.3B parameters, keeping the hidden size per head at 96 so attention GEMMs stay the same size; 1.2B fits on one GPU, 8.3B needs 8-way model parallelism. Model-parallel runs use a fixed batch of 8; model-plus-data-parallel runs a global batch of 512, which is 64-way data parallelism.

Results: scaling

§5.1.1, Figures 1 and 5

The baseline is the 1.2B model on a single GPU, a strong one: it sustains 39 TFLOP/s, 30% of the theoretical peak of a V100 in a DGX-2H server (§5.1.1), which makes the peak 130 TFLOP/s (39 / 0.30). Scaling is weak scaling in model size: about 1 billion parameters per GPU, so 2 GPUs train the 2.5B model and 8 the 8.3B (Figure 1), rather than the usual weak scaling in batch size.

The 8.3B model on 8 GPUs keeps 77% of linear scaling. Adding data parallelism costs a little more, for the gradient all-reduces, and the 8.3B model on all 512 GPUs keeps 74% by Figure 5 and the text beside it, sustaining up to 15.1 PFLOP/s over the whole application (§1).

76% or 74%?
The abstract, introduction and this page's takeaway say 76%; Figure 5 and §5.1.1 say 74% for the same 512-GPU run. They come from different arithmetic: 15.1 PFLOP/s ÷ (512 × 39 TFLOP/s) = 75.6%, which rounds to 76%; 74% of 512 × 39 TFLOP/s would be 14.8 PFLOP/s. The paper does not say which measurement each uses (15.1 is "up to"). Both are shown; neither is wrong by its own arithmetic (recompute.py).

Model parallelism also speeds up a model that already fits (strong scaling): the 1.2B model at batch 8 runs 1.64 times faster on 2 GPUs, 2.34 on 4 and 2.98 on 8, with returns diminishing "as the per-GPU computation decreases and the memory bandwidth and communication overheads begin to dominate" (Appendix D.2, Table 8). That is 82%, 59% and 37% of linear: tensor parallelism is for fitting big models, not for speeding up small ones.

the 8.3B model on 8 GPUs (8-way tensor parallel, batch fixed at 8) against the 1.2B model on one GPU: what fraction of perfect linear scaling does it keep?
Does communication alone explain the lost efficiency? A communication-only model against Figure 5 and Table 8

Try: the bars are what the paper measured; the lines are a model that charges only for communication, with every GEMM running at the single-GPU baseline's 39 TFLOP/s. Switch the link to InfiniBand to see why tensor parallelism stays inside one server.

Scaling

Per layer and iteration at batch 8, sequence 1,024: compute 96bsh²(1 + s/6h) FLOPs ÷ (t × 39 TFLOP/s), the forward, recomputed forward and backward GEMMs (Narayanan et al. 2021, Eq. 3, without the logit term); communication 4 or 6 all-reduces of bsh fp16 values. Weak-scaling efficiency is compute ÷ (compute + communication), since the 1-GPU baseline has no communication. Measured: Figure 5 model-parallel bars, Table 8 speedups ÷ t.

Does not reproduce

Results: GPT-2

§5.2, Tables 2 and 3

Three GPT-2 models were trained (Table 2): 355M (the size and shape of BERT-large), 2.5B (bigger than the previous largest GPT-2) and 8.3B ("larger than any left-to-right transformer language model ever trained, to the best of our knowledge"), the last with 24 heads rather than the 32 of the scaling study. An epoch is 68,507 iterations; for the 8.3B model on 512 GPUs it takes about two days (2.10). Larger models converge noticeably faster and to lower validation perplexity; the 8.3B reaches 9.27 (§5.2, Figure 6).

ModelWikiText103 perplexity ↓LAMBADA accuracy ↑
355M19.3145.18%
2.5B12.7661.73%
8.3B10.8166.51%
Previous state of the art15.7963.24%

Zero-shot, Table 3; previous best from Khandelwal et al. 2019 (WikiText103) and GPT-2 (LAMBADA). The abstract rounds these to 10.8 against 15.8 and 66.5% against 63.2%.

How the GPT-2 numbers were measured (Appendix E, leakage check, samples)

Two evaluation details matter for reading these numbers (Appendix E). WikiText103 perplexity is normalised by the test set's original word-level token count, To = 245,566, not the 270,329 subword tokens the model actually sees, so it is comparable with earlier word-level models; it is computed with overlapping 1,024-token windows that advance by 32 tokens (Eq. 4). LAMBADA counts a word right only when every one of its subword tokens is predicted correctly. Test-set leakage was checked with 8-gram overlap, as GPT-2 did: at most 10.8% for WikiText103 (whose own training set already overlaps its test set by 9.09%) and 1.4% for LAMBADA (§5.2). Appendix C prints text samples from the 8.3B model (Appendix C), and v4 of the paper notes that Microsoft and NVIDIA have since trained the 17B Turing-NLG "using Megatron".

Results: BERT, and where the LayerNorm sits

§5.3, Figure 7, Tables 4 and 5

The often-forgotten second contribution. ALBERT had reported that BERT degrades when made larger than BERT-large's 336M parameters, and answered with parameter sharing (§5.3). This paper finds instead that the order of the layer normalisation and the residual connection is what matters: in Figure 7 a 752M BERT with the original arrangement (a) trains well for a while, then its loss jumps and does not recover, while the rearranged architecture (b) trains stably to a lower loss.

In (a) the residual is taken from the LayerNorm's output, which, unrolled, is the original post-LN BERT, every block's output renormalised; in (b) it is taken from the block's input, the pre-LN arrangement GPT-2 already used. Why the pre-LN path trains more stably is taught, with Xiong et al.'s gradient argument, on Normalisation, residuals and stability. With (b), and the hidden size per head fixed at 64, three BERT models were trained (Table 4): 336M (BERT-large's size), 1.3B (BERT-xlarge's configuration, which ALBERT had found worse than 336M) and 3.9B (wider and deeper); the first two for 2 million iterations, the 3.9B for 1.5 million and "still training". Validation perplexity on a 3% held-out set falls monotonically: 1.58, 1.30, 1.16 (§5.3).

Fine-tuned as RoBERTa was (batch size and learning rate tuned, median of 5 seeds reported; Table 6 lists the settings), every downstream score improves with size, and the 3.9B model sets the best development-set results among BERT-style models on MNLI (91.4/91.4), QQP (92.7), SQuAD 1.1 (95.5/90.0) and SQuAD 2.0 (91.2/88.5) (Table 5). On the RACE test set the single 3.9B model scores 89.5% against ALBERT's 86.5%, and the 5-way ensemble 90.9% against ALBERT's ensemble at 89.4%: the 90.9% the abstract quotes is the ensemble. Megatron's models also saw fewer training tokens (ratio 1 against 2 to 3 for the others).

in Figure 7 both (a) and (b) already put a LayerNorm at the start of every sub-block. What is the change?

How much of this to believe

§5, Appendix D

What holds up, and why.

  • The mechanism is exact. Splitting A by columns and B by rows computes the same function as the unsplit layer; only the order of floating-point additions in the all-reduce changes (Eq. 3; the split demo gives an error of 0 on real matrices). There is no accuracy trade-off to measure, which is why the paper does not need an ablation for it.
  • The baseline is strong, not flattering. Efficiency is measured against a single GPU already at 39 TFLOP/s, 30% of peak, over "the entire application" (§5.1.1). A weak baseline would have inflated the 77%.
  • The configurations check out. Every parameter count in Tables 1, 2 and 4 is reproduced from its configuration, and the memory arithmetic reproduces Table 1's GPU counts (tables tab).
  • It held up. The same split, with the same f and g, is what MT-NLG, the PTD-P runs and Llama 3 use for tensor parallelism, citing this paper (Then and now), and serving engines expose it as a standard option.

What to read with care.

  • "76% scaling efficiency" is weak scaling in model size, not a speedup. It compares the 1.2B model on 1 GPU with the 8.3B model on 512 (Figure 5): different models, different GEMM shapes. With the model fixed (strong scaling), 8 GPUs give 2.98 times, 37% of linear (Table 8). The authors say this themselves: model parallelism "is primarily designed to enable training models larger than what can fit" (Appendix D.2), which counts in their favour.
  • The paper disagrees with itself on the headline. 76% in the abstract and introduction, 74% in §5.1.1 and Figure 5, for the same run; 15.1 PFLOP/s ÷ (512 × 39) is 75.6% (box above).
Five more caveats: FLOP counting, single runs, unlike comparisons, an unfinished run, one pair of curves
  • How FLOPs are counted is not stated. Neither 39 TFLOP/s nor 15.1 PFLOP/s says whether the recomputed forward pass of activation checkpointing, or attention, is counted; both are presented as measured throughput. Table 2's epoch time for the trained 8.3B model implies 13.8 PFLOP/s by a later paper's formula, about 9% under the headline, which was measured on a differently shaped (32-head) configuration (Table 2 rebuilt).
  • Single runs. Each pretraining run and each scaling point is one run, with no seeds or error bars (§5). Fine-tuning reports the median of 5 seeds but no spread (§5.3), so margins such as QQP's 92.7 against XLNet's 92.3 cannot be judged against noise.
  • The state-of-the-art comparisons are not like for like. The GPT-2 models were trained on a different, 174 GB corpus (§4.1); the WikiText103 baseline (15.79) is a nearest-neighbour language model (Khandelwal et al. 2019), the LAMBADA baseline GPT-2 itself (Table 3). The 8-gram leakage check is reassuring but bounds overlap only at "at most" 10.8% and 1.4% (§5.2). The RACE record (90.9%) is a 5-way ensemble; the single model scores 89.5% (Table 5). The BERT models saw fewer training tokens than RoBERTa, ALBERT or XLNet, which cuts the other way.
  • An unfinished run. The 3.9B BERT had been trained for 1.5 million iterations (the smaller two for 2 million) and "is still training" when its results were reported (§5.3).
  • The LayerNorm finding rests on one pair of curves. Figure 7 compares one 752M run of each arrangement, by training loss (Figure 7). It held up: pre-norm became the default, and Xiong et al. 2020 later gave a theoretical reason; but the paper itself shows one comparison, not a study.

Verdict: believe the method completely; it is exact and has been the standard for seven years. Treat "77%" and "76%" as "a 7 times larger model on 8 GPUs, and on 512, at about three quarters of the per-GPU throughput", not as a speedup, and treat the accuracy records as single runs on different data that showed scale helps, not as controlled comparisons.

Why it matters (beyond the paper)

  • Tensor parallelism became a standard axis. The data, tensor, pipeline and expert (DP, TP, PP, EP) decomposition every training stack now uses, the "3D parallelism" framing (MT-NLG), takes its TP axis from this paper, and the column-then-row split with conjugate f and g is still the canonical formulation (Llama 3 cites it for TP, §3.3.2). It is also the standard way to serve a model on several GPUs (names in the dated block below). How TP composes with the other axes today is Distributed training's subject (sections 5 and 9).
  • Follow-up work completed the picture. Narayanan et al. 2021 combined this TP with pipeline parallelism and an interleaved 1F1B schedule (PTD-P) and reached 502 PFLOP/s on 3,072 A100s, 52% of peak, on a 1-trillion-parameter model. The pair of papers defines the classic pre-training scaling playbook; Then and now follows it to 2026.
  • It fixed the mental model for communication cost. TP's per-layer all-reduces on activations need a fast interconnect, which is why its degree is conventionally capped at the NVLink domain (8 GPUs per node) while DP and PP cross nodes. The rule comes from this paper's setup (8-way TP inside a 16-GPU server) and was stated as a measured result by Narayanan et al.: "tensor model parallelism is best within a node", with peak performance when "the tensor-parallel size is equal to the number of GPUs in a single node" (§5.4.1).
  • Pre-LN. The BERT result helped make pre-norm the default. It was not the first pre-LN transformer: GPT-2 §2.3 had already moved LayerNorm to the input of each sub-block, and Xiong et al. 2020 later explained why it trains more stably. What this paper showed is that the change is what lets BERT-style encoders scale.
Where it is used now (checked 2026-10-02; volatile)
  • Serving option names: vLLM and TensorRT-LLM call it tensor_parallel_size, SGLang tp_size (server_args.py).
  • The codebase outlived the paper. Megatron-LM grew into Megatron-Core, the repository that NVIDIA's large-model training builds on, and trained or fed many large runs: Turing-NLG 17B (cited in the paper's own v4; Turing-NLG also used ZeRO, ZeRO abstract), MT-NLG 530B (DeepSpeed with Megatron's tensor slicing), NVIDIA's Nemotron models (the Nemotron-4 340B report gives Megatron-LM as its pretraining code), and forks such as Megatron-DeepSpeed.

Connections

  • Papers in this knowledge base: Attention Is All You Need (the layer being partitioned); BERT (the architecture whose LayerNorm placement this fixes); ZeRO (the contemporaneous memory-side alternative: it shards optimizer state, and later gradients and weights, under data parallelism instead of partitioning layers, and its abstract says it trains up to 13B "without requiring model parallelism"); GPT-3 (trained with "a mixture of model parallelism within each matrix multiply and model parallelism across the layers", §2.3); The Llama 3 Herd of Models (4D parallelism, TP included, in a modern frontier run); DeepSeek-V3 (trains "without using costly Tensor Parallelism", with PP, EP and ZeRO-1, though it serves attention with 4-way TP).
  • Topics: llm-training-and-post-training (distributed training: the TP axis), inference-and-serving (TP as the default multi-GPU serving strategy), hardware (NVLink and NVSwitch bandwidth as the TP constraint).