Llama 3.1 405B
Meta · Llama 3 · open weights
- GQA
- RoPE
- Pre-norm
Facts and where they come from
| Released | 2024-07 | paperarXiv 2407.21783arXiv v1, July 2024 |
|---|---|---|
| Licence | not disclosed | not disclosed |
| Total parameters | 405B | paperarXiv 2407.21783abstract: a dense Transformer with 405B parameters |
| Active parameters | not disclosed | not disclosed |
| Context length | 128K tokens | labmeta-llama/llama-models sku_list.py (pinned)Llama 3 paper (arXiv 2407.21783): 128K context |
| Norm placement | pre | codemodelling codetransformers 5.18.0 / repo modelling code for llama: input_layernorm before attention, post_attention_layernorm before the MLP |
| Norm type | RMSNorm | codemodelling codetransformers 5.18.0 / repo modelling code for llama: input_layernorm before attention, post_attention_layernorm before the MLP |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | RoPE | codemodelling coderotary on the full head (default) |
| Parallel attention and MLP | no | codemodelling codetransformers 5.18.0 / repo modelling code for llama: input_layernorm before attention, post_attention_layernorm before the MLP |
Architecture, drawn from the data
GQA 128q/8kv. Each column is one layer: its token mixer above, its feed-forward block below. Paler columns reuse another layer’s keys and values.
Modelled costs
From the cost model, batch size 1. Totals the lab states are in the table above; differences come from rounding, from what a lab counts, or from parts the model does not describe (listed on the about page).
| Parameters (modelled) | 406B |
|---|---|
| Active per token (modelled) | 406B |
| Without embeddings and output head | 402B total, 402B active |
| KV cache per token, BF16 (layers that grow with context) | 504 KiB |
| KV cache + state at 128K tokens, BF16 | 63 GiB |
| Decode FLOPs per token at 4K context | 841 GFLOP |
| Prefill FLOPs for a 4K prompt | 3.36 PFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 16,384 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_1_405b: dim |
| vocab | 128,256 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py: LLAMA3_VOCAB_SIZE |
| tied_embeddings | false | labmeta-llama/llama-models sku_list.py (pinned)llama3/model.py: separate output projection |
| mixers.full.type | attn | codemodelling codeattention block |
| mixers.full.heads | 128 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_1_405b: n_heads |
| mixers.full.kv_heads | 8 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_1_405b: n_kv_heads |
| mixers.full.head_dim | 128 | codemodelling codetransformers 5.18.0: head_dim = hidden_size / num_attention_heads |
| ffns.dense.type | dense | codemodelling codeMLP block |
| ffns.dense.d_ff | 53,248 | labmeta-llama/llama-models sku_list.py (pinned)llama3/model.py FeedForward: int(2*4*dim/3), x ffn_dim_multiplier 1.2, rounded up to multiple_of 4096 |
| ffns.dense.gated | true | codemodelling codeMLP: gated (SwiGLU/GeGLU) |
| layout | 126× full/dense | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_1_405b: n_layers |
Sources
- arXiv 2407.21783
- meta-llama/llama-models sku_list.py (pinned) · meta-llama/llama-models sku_list.py (pinned)
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision