Llama 3.1

Meta (Llama Team, AI @ Meta) · 2024-07-31 · analysed 2026-08-08 · skill v0.3.0

dense full-attention text-only open-weights frontier frontier-generalist

Design overview

Llama 3.1 is a deliberately conservative dense Transformer: the report describes a standard architecture (Vaswani et al. 2017) that 'does not deviate significantly' from Llama 2, with four enumerated changes — grouped-query attention with 8 KV heads (shrinking KV caches during decoding), a document-level attention mask that blocks cross-document mixing within a sequence, a 128K-token vocabulary (100K tiktoken tokens plus 28K added for non-English), and a RoPE base frequency raised to 500,000 for longer contexts. The 405B reference variant stacks 126 layers of hidden size 16,384 with 128 query heads, an FFN of 53,248, and SwiGLU activations; head dimension is 128. Context grows from 8K to 128K tokens not by interpolation but by staged continued pre-training, followed by an annealing phase with checkpoint averaging. The pre-training recipe is plain but extreme in scale: AdamW, cosine schedule, batch size doubling from 4M to 16M tokens, 15.6T tokens and 3.8e25 FLOPs, run with 4D parallelism (TP/CP/PP/DP) on up to 16K H100s with a tuned interleaved pipeline schedule. Post-training runs six iterative rounds of SFT and DPO, leaning heavily on rejection sampling, synthetic data, and reward-model filtering, with dedicated capability pushes for code, multilinguality, math, long context, tool use, and factuality. The report also sketches compositional image/video/speech extensions via cross-attention adapters, but these are explicitly unreleased; the shipped herd is text-only.

What the report claims is novel

Atlas assessment: Architecturally Llama 3.1 is deliberately incremental: the report itself frames the block as a standard dense Transformer barely diverging from Llama 2, with GQA, a raised RoPE base, a tiktoken-derived vocabulary, and a document mask as the only enumerated changes — no new attention, normalization, or stability mechanisms relative to peers. Its genuine novelty lies outside the block: an order-of-magnitude jump in data and compute (15.6T tokens, 3.8e25 FLOPs), context extension by staged continued pre-training rather than post-hoc interpolation, and an iterated SFT + rejection-sampling + DPO pipeline that scaled to a 405B open release with a system-level safety suite. The multimodal adapters follow Flamingo-style cross-attention (cited in-report) and are explicitly unreleased, so they do not count as a shipped contribution.

Relation to the atlas

Lineage in

Influence out

No descendants recorded yet.

Notable omissions

Closest relatives in the atlas

Spec sheet

Identity

FamilyLlama 3.1[1]
OrganisationMeta (Llama Team, AI @ Meta)[2]
Release date2024-07-31
Report URLhttps://arxiv.org/abs/2407.21783[3]
LicenseLlama 3 Community License[4]
Open weightsyes[5]

Variants

Scale

Total parameters405B[6]
Active parameters / token405B
Layers126[7]
Hidden dimension16384[7]
FFN inner dimension53248[7]
FFN ratio3.3
Query heads128[7]
KV heads8[8]
Head dimension128
Vocabulary size128000[8]
Embedding tyingnot disclosed

Per-variant configs

VariantTotalLayersHiddenFFNQ headsKV headsContext
8B8B32409614336328131,072
70B70B80819228672648131,072
405B405B12616384532481288131,072

Core block

Block typedense[9]
Attention variantGQA[10]
Attention layer patternuniform
Depth mixingsequential-residual
ActivationSwiGLU[7]
Expert countn/a[11]
Experts per tokenn/a[11]
Shared expertsn/a[11]
Routingn/a[11]
Load balancingn/a[11]
Expert granularityn/a[11]
MethodRoPE[8]
RoPE base frequency500000[8]
Partial RoPEnot disclosed
Typenot disclosed
Placementnot disclosed
QK-normno
Attention sinksno
Softcappingno
Other

Context

Trained context length131,072[13]
Deployed context length131,072[14]
Extension methodother: continued pre-training (staged 8K to 128K); no interpolation method disclosed[12]

Tokenizer

Algorithmtiktoken-based (100K tiktoken tokens + 28K additional tokens)[10]
NotesVocabulary combines 100K tokens from the tiktoken tokenizer with 28K additional tokens for better non-English support; improves English compression from 3.17 to 3.94 characters per token vs the Llama 2 tokenizer. Vocab size (128,000) lives in scale.vocab_size.[10]

Training

Training tokens15.6T[4]
Data compositionFinal mix roughly 50% general knowledge, 25% mathematical/reasoning, 17% code, 8% multilingual tokens; heavy curation of web data (PII/safety filtering, URL/doc MinHash and line-level dedup, heuristic and model-based quality filtering, code/math pipelines, 176-language LID); knowledge cutoff end of 2023.[15]
Curriculum / stagingThree stages: (1) initial pre-training at 8K context, (2) long-context pre-training to 128K in six increments (~800B tokens), (3) annealing on the final 40M tokens with LR linearly annealed to 0 and checkpoint averaging.[16]
OptimizerAdamW[17]
LR schedulePeak LR 8e-5 (405B; 3e-4 for 8B and 1.5e-4 for 70B per Table 3), linear warmup of 8,000 steps, cosine decay to 8e-7 over 1,200,000 steps.[18]
Batch scheduleStarts at 4M tokens (seq len 4,096); doubled to 8M tokens at seq len 8,192 after 252M tokens; doubled again to 16M after 2.87T tokens.[17]
PrecisionBF16 (38-43% BF16 MFU); FP32 gradient accumulation and FP32 reduce-scatter for numerical stability[19]
Parallelism4D parallelism combining tensor, pipeline, context, and data parallelism (FSDP), ordered [TP, CP, PP, DP]; all-gather-based CP; interleaved PP schedule with tunable micro-batch count N; network-aware configuration.[19]
HardwareUp to 16K H100 GPUs (700W TDP, 80GB HBM3) on Meta Grand Teton servers (8 GPUs/server, NVLink); RoCE fabric (Arista 7800, Minipack2) for 405B, Nvidia Quantum2 InfiniBand for smaller models; 400 Gbps interconnects; MAST scheduler; Tectonic storage fabric.[20]
Disclosed compute3.8e25 FLOPs (405B pre-training), almost 50x the largest Llama 2 model[4]

Post-training

SFTyes[21]
Preference optimisationDPO[22]
Reasoning trainingSFT on step-wise reasoning traces filtered by answer correctness, self-verification, and outcome/stepwise reward models (MCTS used for challenging prompts); interleaved text+Python-code reasoning with execution feedback; no RLVR or test-time compute disclosed.[23]
Distillationnone disclosed

Modality

Typetext-only
Attachmentn/a[24]

Inference efficiency

KV-cache designGQA with 8 KV heads: KV-cache size and decoding memory reduced vs MHA; all-gather CP overhead small because KV tensors are far smaller than Q under GQA[25]
Quantisation shippedFP8 inference for 405B (FFN-layer matmuls only, row-wise dynamic scaling, scaling factors upper-bounded at 1200, first/last layers unquantized; kernels released); Llama Guard 3 ships an int8-quantized variant (size reduced >40%)[26]
Speculative decodingnone disclosed
Serving optimisations405B inference: BF16 pipeline parallelism across 16 GPUs on two machines (TP within node over NVLink, PP across nodes) with micro-batching for better throughput-latency trade-off; FP8 inference raises pre-fill throughput up to 50% vs two-machine BF16[27]

Evaluation

Benchmarks (report's own numbers only)

BenchmarkValueRef
MMLU (5-shot)87.3Table 2
MMLU-Pro (5-shot, CoT)73.3Table 2
IFEval88.6Table 2
HumanEval (0-shot)89.0Table 2
MBPP EvalPlus (0-shot)88.6Table 2
GSM8K (8-shot, CoT)96.8Table 2
MATH (0-shot, CoT)73.8Table 2
ARC Challenge (0-shot)96.9Table 2
GPQA (0-shot, CoT)51.1Table 2
BFCL88.5Table 2
Nexus58.7Table 2
ZeroSCROLLS/QuALITY95.2Table 2
InfiniteBench/En.MC83.4Table 2
NIH/Multi-needle98.1Table 2
MGSM (0-shot, CoT)91.6Table 2

Provenance references

  1. stated · §1 (report title is 'The Llama 3 Herd of Models'; the released family is named Llama 3.1)
  2. stated · Title block
  3. stated · pipeline
  4. stated · §1
  5. stated · Abstract / §1
  6. stated · Abstract / §1 / Table 3
  7. stated · Table 3
  8. stated · Table 3 / §3.2
  9. stated · Abstract / §1 / §3.2
  10. stated · §3.2
  11. n/a · §1 / §3.2
  12. stated · §3.4.2
  13. stated · §3.4.2 / Table 4
  14. stated · Abstract / §2
  15. stated · §3.1.1 / §3.1.2
  16. stated · §3.4
  17. stated · §3.4.1
  18. stated · §3.4.1 / Table 3
  19. stated · §3.3.2
  20. stated · §3.3.1
  21. stated · §4 / §4.1.3
  22. stated · §4.1.4
  23. stated · §4.3.3
  24. n/a · Abstract / §2
  25. stated · §3.2 / §3.3.2
  26. stated · §6.2 / §5.4.7
  27. stated · §6.1 / §6.2