Meta · 2024-07 · Dense

Llama 3.1 8B

Llama 3.1 8B is a grouped-query attention (GQA) transformer released by Meta in 2024-07, with 32 layers, hidden size 4096 and a context window of 131,072 tokens.

Layer stack

Attention ×32 · Layers 32

Key facts

FamilyMeta
Released2024-07
Params8.03 B
Context131,072 tokens
AttentionGQA (32:8)
Layers32
Hidden4,096
Heads32
Vocab128,256
PositionRoPE
NormRMSNorm
Activationsilu
Dtypebf16
Architecture classLlamaForCausalLM

Architecture overview

t₁ t₂ t₃ t₄ input tokens Embedding · Vocab 128,256 → Hidden 4,096 Q1 Q2 Q3 Qn KV1 KV2 KV3 KVn Heads 32 KV heads 8 head dim 128 · RoPE FFN · SwiGLU FFN dim 14,336 × 32 transformer block Attention Feed-forward / MoE RMSNorm pre-norm Final norm · RMSNorm LM head → Vocab 128,256 p p p → next token Position RoPE Dtype BF16 Context 128K tok
Drawn from the shipped config.json · 32 layers / width 4,096 / context 131,072. Original diagram by this atlas.

Attention

grouped-query attention (GQA) — 32 q-heads / 8 kv-heads. RoPE θ=500,000.

Feed-forward / MoE

It is a dense model: all 8.03B parameters participate in computing every token.

Field-level comparison

Compared against the previous model of the same lab; where none exists, against the structurally closest model. The ratio column is this model divided by the comparison model.

Full-field comparison vs predecessor Llama 3.1 70B
ModelLlama 3.1 8BLlama 3.1 70BRatio
model_typellamallama
architecturesLlamaForCausalLMLlamaForCausalLM
hidden_size40968192×0.500
num_hidden_layers3280×0.400
num_attention_heads3264×0.500
num_key_value_heads88≈1
head_dim128
intermediate_size1433628672×0.500
hidden_actsilusilu
rope_theta500000500000≈1
max_position_embeddings131072131072≈1
rms_norm_eps0.000010.00001≈1
vocab_size128256128256≈1
torch_dtypebfloat16bfloat16
_name_or_pathmeta-llama/meta-Llama-3.1-8B-Instruct
attention_biasfalsefalse
attention_dropout00
bos_token_id128000128000≈1
eos_token_id128009128001×1 + 128008×1 + 128009×1
initializer_range0.020.02≈1
mlp_biasfalsefalse
pad_token_id128004
pretraining_tp11≈1
tie_word_embeddingsfalsefalse
transformers_version4.49.0.dev04.42.3
unsloth_fixedtrue

Most similar architectures

Similarity values range from 0 (no shared categorical features) to 1 (identical profiles).

Raw config fields

27 fields
_name_or_pathmeta-llama/meta-Llama-3.1-8B-Instruct
architecturesLlamaForCausalLM
attention_biasfalse
attention_dropout0
bos_token_id128000
eos_token_id128009
head_dim128
hidden_actsilu
hidden_size4096
initializer_range0.02
intermediate_size14336
max_position_embeddings131072
mlp_biasfalse
model_typellama
num_attention_heads32
num_hidden_layers32
num_key_value_heads8
pad_token_id128004
pretraining_tp1
rms_norm_eps0.00001
rope_theta500000
tie_word_embeddingsfalse
torch_dtypebfloat16
transformers_version4.49.0.dev0
unsloth_fixedtrue
use_cachetrue
vocab_size128256