Meta pretrained its flagship 405B-parameter dense Transformer on 15.6 trillion multilingual tokens (3.8 x 10^25 FLOPs) across 16,384 H100 GPUs, matching GPT-4 and GPT-4o on core coding, math, and reasoning benchmarks by betting on aggressive data curation and simple training primitives rather than mixture-of-experts routing or PPO.
- Nearly 50x Llama 2’s compute on a dense GQA architecture: The 126-layer model pairs 128 query heads with 8 grouped-query attention key-value heads,
RoPE(theta = 500,000), and a 128K-token vocabulary that boosts English compression from 3.17 to 3.94 characters per token. - Two-stage scaling laws predicted accuracy across four orders of magnitude: IsoFLOP runs from
6 x 10^18to10^22FLOPs fitN*(C) = 0.29 * C^0.53(pointing to 402B parameters on 16.55T tokens) and mapped log-likelihood to ARC Challenge accuracy accurately before launching the 405B run. - Over 90% effective training time despite 419 unexpected failures: Across a 54-day snapshot on 16,384 GPUs, 78% of unexpected interruptions stemmed from confirmed or suspected hardware faults (58.7% GPU), yet automated recovery left only 3 incidents requiring manual intervention.
- Six rounds of SFT, rejection sampling, and DPO: Llama 3.1 405B Instruct hits 87.3% on MMLU (5-shot), 89.0% on HumanEval, 96.8% on GSM8K, and 88.6% on IFEval, beating GPT-4 (0125) on most categories.
- FP8 FFN quantization raised prefill throughput up to 50%: Quantizing feed-forward matmuls row-wise while leaving attention, first/last layers in BF16 and capping dynamic scales at 1,200 preserved reward scores across 100,000 samples.
Data curation, architecture, and scaling laws
Llama 3’s performance gains come primarily from data scale and quality rather than exotic model blocks. A custom HTML parser stripped markdown markers (which empirically hurt web-trained models) while preserving math inside image alt attributes. Meta then stacked URL deduplication, global MinHash deduplication, and aggressive ccNet-style line filtering (dropping lines appearing over 6 times per 30M-document bucket), followed by DistilRoberta quality, code, and math classifiers trained on Llama 2 annotations.
Guided by Chinchilla-style IsoFLOP curves, Meta finalized a pretraining mix of roughly 50% general knowledge, 25% mathematical and reasoning tokens, 17% code, and 8% multilingual text across 176 languages. To forecast downstream accuracy rather than raw cross-entropy loss, the team correlated compute FLOPs linearly with normalized negative log-likelihood on benchmarks, then fit a sigmoid from log-likelihood to task accuracy. That two-step forecast justified 405B parameters (16,384 model width, 53,248 FFN width) for a 3.8 x 10^25 FLOP budget.
Staged pretraining and cluster reliability
Meta ramped batch size and sequence length in three pretraining phases without a single divergence intervention:
- Initial pretraining: Started at 4M tokens and 4,096 context, doubling to 8M tokens / 8,192 context after 252M tokens and to 16M tokens after 2.87T tokens (
AdamW, peak LR8 x 10^-5decaying to8 x 10^-7). - Long-context extension: Trained for roughly 800B tokens across six increments from 8K to 128K tokens using document-boundary attention masks so quadratic self-attention cost was paid only late in the run.
- Annealing: Decayed learning rate linearly to 0 over the final 40M tokens at 128K context while upsampling elite math and code, then Polyak-averaged checkpoints. Notably, annealing on math training sets boosted Llama 3 8B by 24.0% on GSM8K and 6.4% on MATH, whereas 405B gains were negligible.
Keeping 16,384 H100s productive required 4D parallelism ([TP, CP, PP, DP]) over a 24K-GPU RoCE Clos cluster (with 16-flow E-ECMP load balancing and deep-buffer switches replacing DCQCN), custom NCCLX collectives, and PyTorch’s flight recorder. Even mid-day datacenter temperatures shifted throughput by 1% to 2% via GPU frequency scaling, and synchronized collective pauses swung site power by tens of megawatts.
Post-training with DPO and FP8 serving
Post-training ran six iterative rounds of reward modeling, rejection sampling (accelerated over 2x by sharing prompt KV pages in PagedAttention), SFT, model averaging, and Direct Preference Optimization. Meta chose DPO over PPO because it used less compute at 405B scale and scored higher on IFEval, provided two stabilizers were added: masking special chat header/termination tokens from the DPO loss to stop abrupt truncation, and adding an NLL loss term (0.2 weight) on chosen responses.
For BF16 inference, 405B requires 16 H100s across two nodes (TP=8, PP=2). Quantizing FFN weights and activations row-wise to FP8 boosted prefill throughput by up to 50%, but Meta discovered that standard benchmarks hid occasional output corruption caused by high-perplexity tokens (such as dates) spiking dynamic scales. Auditing reward-model score distributions over 100,000 samples caught the drift and led to keeping first/last layers in BF16 and clamping scaling factors at 1,200.
Caveats and builder takeaway
Unlike the 8B and 70B models, which were over-trained far past Chinchilla optimality for cheap inference and distilled from 405B during post-training, the 405B model itself is too heavy for single-node BF16 serving and serves primarily as a frontier teacher, synthetic data generator, and evaluation ceiling. Also note that the paper’s compositional vision and speech adapters were research prototypes not released alongside the text weights. For applied teams, the highest-leverage takeaways are data-pipeline rigor, using 405B-class models to curate synthetic post-training data for smaller models, and auditing quantized deployments via score distributions rather than multiple-choice benchmarks alone.


