Skip to content
StackDecode
LLM Library
Dense decoderOpen weightsArchitecture animation

Llama 2

An open model family with chat versions trained by RLHF.

At a glance

Made by
Meta
Released
2023
Type
Dense decoder
Access
Open weights
Parameters
7B, 13B, 70B
Context window
4,096 tokens
Attention
Multi-head attention; grouped-query attention in the 70B

How it works

Llama 2 uses RMSNorm, SwiGLU feed-forward layers and rotary position embeddings, and its chat versions were tuned with supervised fine-tuning and RLHF. Its release under a community licence started the open-weight ecosystem.

Architecture, step by step

A token travels from text in to prediction out. The boxed layers repeat many times.

× N layersText inTokenizerEmbedding + positionNormCausal self-attentionAdd (residual)NormFeed-forward (MLP)Add (residual)Final normLM head (vocabulary scores)Softmax, then sample next token

Raw text enters the system, for example "The cat sat on the".

stage:
1/12
part:
Text in
1/12

The green dot is one token travelling through the model. The boxed section repeats for every layer.

What stands out

  • RoPE, RMSNorm, SwiGLU
  • GQA on the 70B model
  • Chat models tuned with RLHF

Keep in mind

The licence has usage conditions, so it is not open source in the strict sense.

Related models