Papers › Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism

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

17 Sep 2019arXiv:1909.08053archive 2025-07-28

Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick Legresley, Jared Casper, Bryan Catanzaro

Recent work in language modeling demonstrates that training large transformer models advances the state of the art in Natural Language Processing applications. However, very large models can be quite difficult to train due to memory constraints. In this work, we present our techniques for training very large transformer models and implement a simple, efficient intra-layer model parallel approach that enables training transformer models with billions of parameters. Our approach does not require a new compiler or library changes, is orthogonal and complimentary to pipeline model parallelism, and can be fully implemented with the insertion of a few communication operations in native PyTorch. We illustrate this approach by converging transformer based models up to 8.3 billion parameters using 512 GPUs. We sustain 15.1 PetaFLOPs across the entire application with 76% scaling efficiency when compared to a strong single GPU baseline that sustains 39 TeraFLOPs, which is 30% of peak FLOPs. To demonstrate that large language models can further advance the state of the art (SOTA), we train an 8.3 billion parameter transformer language model similar to GPT-2 and a 3.9 billion parameter model similar to BERT. We show that careful attention to the placement of layer normalization in BERT-like models is critical to achieving increased performance as the model size grows. Using the GPT-2 model we achieve SOTA results on the WikiText103 (10.8 compared to SOTA perplexity of 15.8) and LAMBADA (66.5% compared to SOTA accuracy of 63.2%) datasets. Our BERT model achieves SOTA results on the RACE dataset (90.9% compared to SOTA accuracy of 89.4%).

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1909.08053")

Code

Syntology Ran 12 of 47 code samples harvested from 3 repositories linked to this paper; 35 have no recorded run. Of those that ran: 3 ran · honoured contract; 3 ran · our draft was wrong; 2 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: community (archive-listed): 47 samples from 3 repositories, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

NVIDIA/Megatron-LM officialmentioned in papermentioned on GitHubpytorch report
THUDM/ProteinLM mentioned on GitHubpytorchApache-2.0 report
ezelikman/STaR mentioned on GitHubjax report
facebookresearch/fairscale mentioned on GitHubpytorch report
kingoflolz/mesh-transformer-jax mentioned on GitHubjax report
nvidia/transformerengine mentioned on GitHubjaxApache-2.0 report
qhduan/CPM-LM-TF2 mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

47 samples harvested; 12 ran; 3 honoured the contract we drafted; 35 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

3ran · honoured contract
3ran · our draft was wrong
2ran · fixture could not drive it
4ran
35unverified

Licence: 15 of the 47 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

_CopyToModelParallelRegion facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) ran licence not identified · pointer only · cf02ea13122d66ef · report
_GatherFromModelParallelRegion facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) ran licence not identified · pointer only · 0b452ebdf5b90909 · report
apply_rotary_pos_emb kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · 3e9321ad8928f17d · report
copy_to_model_parallel_region facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) ran · honoured contract licence not identified · pointer only · b333830ef6a60a60 · report
copy_to_model_parallel_region qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) ran MIT (permissive) · 04bccd9db93a140d · report
divide qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · 33de97c702d46371 · report
divide_and_check_no_remainder facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) ran · honoured contract fingerprinted licence not identified · pointer only · 53dcb3e03bcd8ac6 · report
fixed_pos_embedding kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 3d74408951f86d6b · report
get_cuda_rng_tracker qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) ran MIT (permissive) · c3a8d35e5b99ad30 · report
rotate_every_two kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · 5efa020fabe4b20b · report
split_tensor_along_last_dim facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) ran · our draft was wrong fingerprinted licence not identified · pointer only · 787ffed12fc28a46 · report
split_tensor_along_last_dim qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) ran · our draft was wrong MIT (permissive) · c7a00a98e71fad14 · report
BertParallelSelfAttention qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 3a3e6cd309d80ca5 · report
CausalTransformerShard kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 9fafe439d9f687d9 · report
ColumnParallelLinear facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 764045860ccf534a · report
ColumnParallelLinear qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 288f7749514cc2bd · report
CudaRNGStatesTracker qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · fc4bdb2e28201578 · report
EmbeddingShard kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 176d216b0475ad82 · report
ProjectionShard kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 2a11a065886e73ae · report
RMSNorm kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · ae952da8d1f3ecfc · report
RelativePositionEmbs kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 356e9a6604faf993 · report
ReplicatedLayerNorm kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 4e4deb5427de1770 · report
TransformerLayerShard kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · f1f29dd1feac61bc · report
_CopyToModelParallelRegion qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · daaecc67e19dee51 · report
_GatherFromModelParallelRegion qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · d074b0cdd29844e9 · report
_gather facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · b63c4a93c8fbaec8 · report
_gather qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · e042d40151c8e5b5 · report
_initialize_affine_weight facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 6c2eb620fc5d8483 · report
_initialize_affine_weight qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 5bdf5f6af94d14be · report
_reduce facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 2bae7a1462d53b78 · report
_reduce qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · a8bcff2e094dfd4a · report
_set_cuda_rng_state qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 26c4d45293254bda · report
_split facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · e798817bd7481060 · report
_split qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 93b792270121fe82 · report
ensure_divisibility facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 3bd26074ee7c9889 · report
ensure_divisibility qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 158e905c29f23472 · report
f_psum kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · b5f626934ffb18b4 · report
g_psum kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · 0687254bf74e83b3 · report
gather_from_model_parallel_region facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 3e7b5da4deb87f39 · report
gather_from_model_parallel_region qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · f9991e714de95be5 · report
get_model_parallel_group facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · 2929645262f955ef · report
get_model_parallel_group qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · 6bb3803691d991da · report
get_model_parallel_rank facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · cc03593755c3ba09 · report
get_model_parallel_rank qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · f6251a861544b65e · report
get_model_parallel_world_size facebookresearch/fairscale/fairscale/nn/model_parallel/layers.py community (archive-listed) unverified licence not identified · pointer only · e2db563887482b11 · report
get_model_parallel_world_size qhduan/CPM-LM-TF2/CPM-Generate/mpu/transformer.py community (archive-listed) unverified MIT (permissive) · e40c745e214477b2 · report
getnorm kingoflolz/mesh-transformer-jax/mesh_transformer/transformer_shard.py community (archive-listed) unverified Apache-2.0 (permissive) · e905d7fbdd56818f · report

Tasks

LAMBADALanguage ModelingLanguage ModellingQuestion AnsweringReading Comprehension

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Language Modelling WikiText-103 Megatron-LM Number of params 8300M #3 of 89 Archive leaderboard report
Language Modelling WikiText-103 Megatron-LM Test perplexity 10.81 #3 of 89 Archive leaderboard report
Question Answering PIQA MT-NLG 530B (0-shot) Accuracy 82.0 #23 of 67 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT (ensemble) Accuracy 90.9 #2 of 24 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT (ensemble) Accuracy (High) 90.0 #2 of 24 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT (ensemble) Accuracy (Middle) 93.1 #2 of 24 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT Accuracy 89.5 #4 of 24 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT Accuracy (High) 88.6 #4 of 24 Archive leaderboard report
Reading Comprehension RACE Megatron-BERT Accuracy (Middle) 91.8 #4 of 24 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionAttention DropoutBERTBPECosine AnnealingDense ConnectionsDiscriminative Fine-TuningDropoutGPT-2Label SmoothingLayer NormalizationLinear LayerLinear Warmup With Cosine AnnealingLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerReLUResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections