Llama 3

Llama 3 / 3.1

A generation with a 128-thousand-token vocabulary and more than 15 trillion training tokens, whose 405B version reached a level competitive with leading closed models at its release, with a detailed technical paper ("The Llama 3 Herd of Models").

2024Large language modelsPublished weights
DeveloperMeta
Year of publication2024
Number of parameters8 and 70 billion parameters (April 2024), then 405 billion in Llama 3.1 (July 2024)
Layers32, 80 and 126 layers
Context length8K tokens in Llama 3, and 128K in Llama 3.1
Training dataMore than 15 trillion multilingual tokens
Training objectiveCausal language modeling, then SFT, rejection sampling and DPO
LicenceLlama 3 / 3.1 Community License
ArabicLlama 3.1 officially supports eight languages, Arabic not among them, although there is Arabic data in training; Arabic fine-tuning improves its performance.
Page contents
  1. What is new compared with Llama 2?
  2. Tokens-to-parameters ratio
  3. DPO instead of PPO

What is new compared with Llama 2?

AspectLlama 2Llama 3.1
Training tokens2 trillionMore than 15 trillion
Vocabulary32 thousand128 thousand
Context4096128 thousand
AlignmentPPODPO with rejection sampling

Tokens-to-parameters ratio

An 8-billion model on 15 trillion tokens means about 1875 tokens per parameter, roughly 94 times the Chinchilla ratio. This is an explicit application of the idea that a small model trained for long is cheaper at inference.

DPO instead of PPO

Direct preference optimization (DPO) turns the RLHF problem into a classification loss directly on preference pairs, without a separate reward model or reinforcement learning:

\mathcal{L}_{DPO} = -\log \sigma\!\left(\beta \log \frac{\pi_\theta(y_w|x)}{\pi_{ref}(y_w|x)} - \beta \log \frac{\pi_\theta(y_l|x)}{\pi_{ref}(y_l|x)}\right)

It is simpler and more stable, so Meta adopted it in this generation.

Decoder-only model (GPT family) Decoder-only (GPT family)
Languagep(·|≤1)Arabicp(·|≤2)غنيةp(·|≤3)بـp(·|≤4)Token + Position embeddingsN×masked (causal) self-attention+ feed-forwardVocabularycausal maskrow i attends to j ≤ i

A causal mask stops each token from seeing what comes after it, so the model learns to predict the next token. Generation repeats this token by token.

Key contributions

  • A tokenizer with a 128K-token vocabulary reduces the number of tokens per text.
  • GQA at all sizes.
  • Alignment with DPO instead of PPO.

Limitations and caveats

  • The 405B model needs massive hardware for inference.
  • The license is not open source by the OSI definition.

Original references

  1. Llama Team, AI @ Meta (2024). The Llama 3 Herd of Models arxiv.org/abs/2407.21783

The figures are taken from the papers and official cards cited in the references. When the developer does not disclose a figure we write "not disclosed" and do not estimate it. Check the model card before any commercial use, because license terms may change.