Llama 3 8B
Meta · Llama 3 · open weights
- GQA
- RoPE
- Pre-norm
Facts and where they come from
| Released | 2024-04 | config.jsonconfig.jsonHugging Face repository creation date (api.createdAt) |
|---|---|---|
| Licence | llama3 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 8B | labmodel cardREADME table: Params 8B |
| Active parameters | not disclosed | not disclosed |
| Context length | 8K tokens | labmeta-llama/llama-models sku_list.py (pinned)model card (README): context length 8k |
| 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 32q/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) | 8.03B |
|---|---|
| Active per token (modelled) | 8.03B |
| Without embeddings and output head | 6.98B total, 6.98B active |
| Published weights (Hugging Face count) | 8.03B |
| KV cache per token, BF16 (layers that grow with context) | 128 KiB |
| KV cache + state at 8K tokens, BF16 | 1 GiB |
| Decode FLOPs per token at 4K context | 17.2 GFLOP |
| Prefill FLOPs for a 4K prompt | 61.6 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 4,096 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_8b: 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 | 32 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_8b: n_heads |
| mixers.full.kv_heads | 8 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_8b: 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 | 14,336 | labmeta-llama/llama-models sku_list.py (pinned)llama3/model.py FeedForward: int(2*4*dim/3), x ffn_dim_multiplier 1.3, rounded up to multiple_of 1024 |
| ffns.dense.gated | true | codemodelling codeMLP: gated (SwiGLU/GeGLU) |
| layout | 32× full/dense | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama3_8b: n_layers |
Sources
- config.json @ 8cde5ca
- model card
- 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
Listed in the LLM Architecture Gallery checklist as “Llama 3 (8B)” (name only; see about).