Llama 2 70B
Meta · Llama · open weights
- GQA
- RoPE
- Pre-norm
Facts and where they come from
| Released | 2023-07 | paperarXiv 2307.09288arXiv v1, July 2023 |
|---|---|---|
| Licence | llama2 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 70B | labmodel cardmodel name Llama-2-70b |
| Active parameters | not disclosed | not disclosed |
| Context length | 4K tokens | labmeta-llama/llama-models sku_list.py (pinned)Llama 2 paper (arXiv 2307.09288) Table 1: context length 4k |
| 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 64q/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) | 69B |
|---|---|
| Active per token (modelled) | 69B |
| Without embeddings and output head | 68.5B total, 68.5B active |
| Published weights (Hugging Face count) | 69B |
| KV cache per token, BF16 (layers that grow with context) | 320 KiB |
| KV cache + state at 4K tokens, BF16 | 1.25 GiB |
| Decode FLOPs per token at 4K context | 148 GFLOP |
| Prefill FLOPs for a 4K prompt | 583 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 8,192 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama2_70b: dim |
| vocab | 32,000 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py: LLAMA2_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 | 64 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama2_70b: n_heads |
| mixers.full.kv_heads | 8 | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama2_70b: 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 | 28,672 | 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 4096 |
| ffns.dense.gated | true | codemodelling codeMLP: gated (SwiGLU/GeGLU) |
| layout | 80× full/dense | labmeta-llama/llama-models sku_list.py (pinned)sku_list.py llama2_70b: n_layers |
Sources
- config.json @ 3aba440
- model card
- arXiv 2307.09288
- 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