Meta · 2023-02 · Dense

LLaMA 1 7B

LLaMA 1 7B is a multi-head attention (MHA) transformer released by Meta in 2023-02, with 32 layers, hidden size 4096 and a context window of 2,048 tokens.

Layer stack

Attention ×32 · Layers 32

Key facts

FamilyMeta
Released2023-02
Params6.74 B
Context2,048 tokens
AttentionMHA (32:32)
Layers32
Hidden4,096
Heads32
Vocab32,000
Positionlearned/absolute
NormRMSNorm
Activationsilu
Dtype
Architecture classLlamaForCausalLM

Architecture overview

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

Attention

multi-head attention (MHA) — 32 q-heads / 32 kv-heads.

Feed-forward / MoE

It is a dense model: all 6.74B 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 most-similar DeepSeek-Coder 6.7B
ModelLLaMA 1 7BDeepSeek-Coder 6.7BRatio
model_typellamallama
architecturesLlamaForCausalLMLlamaForCausalLM
hidden_size40964096≈1
num_hidden_layers3232≈1
num_attention_heads3232≈1
num_key_value_heads32
intermediate_size1100811008≈1
hidden_actsilusilu
rope_theta100000
max_position_embeddings204816384×0.125
rms_norm_eps0.0000010.000001≈1
vocab_size3200032256×0.992
torch_dtypefloat16bfloat16
_name_or_path/home/sgugger/tmp/llama/llama-7b/
bos_token_id132013×0.000
eos_token_id232014×0.000
initializer_range0.020.02≈1
max_sequence_length2048
pad_token_id0
tie_word_embeddingsfalsefalse
transformers_version4.28.0.dev04.34.1
use_cachetruetrue

Most similar architectures

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

Raw config fields

20 fields
_name_or_path/home/sgugger/tmp/llama/llama-7b/
architecturesLlamaForCausalLM
bos_token_id1
eos_token_id2
hidden_actsilu
hidden_size4096
initializer_range0.02
intermediate_size11008
max_position_embeddings2048
max_sequence_length2048
model_typellama
num_attention_heads32
num_hidden_layers32
pad_token_id0
rms_norm_eps0.000001
tie_word_embeddingsfalse
torch_dtypefloat16
transformers_version4.28.0.dev0
use_cachetrue
vocab_size32000