LLaMA: Open and Efficient Foundation Language Models
Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971)
Subscriber deck — free during early access
17 cards
1 Introduction
- What is LLaMA, and what were its two headline claims?A family of foundation language models from 7B to 65B parameters trained on trillions of tokens of publicly available data only. LLaMA-13B outperformed GPT-3 (175B) on most benchmarks, and LLaMA-65B was competitive with Chinchilla-70B and PaLM-540B.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §1
- Why did LLaMA train smaller models on more tokens than the Chinchilla scaling laws recommend?Chinchilla optimizes performance for a training compute budget but ignores the inference budget, which dominates when serving a model at scale. A smaller model trained longer is costlier to train to a given level but cheaper to run; e.g. a 7B model kept improving even after 1T tokens, far beyond Chinchilla’s recommendation of 200B tokens for 10B.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §1
- Why did using only public data matter for LLaMA?It made the work compatible with open release. Competing models used private or undocumented data (e.g. “Books – 2TB”), and earlier open models such as OPT, BLOOM and GPT-NeoX weren’t competitive with PaLM-62B or Chinchilla.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §1
2.1 Pre-training Data
- What was LLaMA’s pre-training mixture?About 1.4T tokens: CommonCrawl via CCNet 67%, C4 15%, GitHub 4.5%, Wikipedia 4.5%, books (Gutenberg, Books3) 4.5%, arXiv 2.5%, Stack Exchange 2%. Most tokens were seen once; Wikipedia and books about twice.
LLaMA’s pre-training mixture (≈ 1.4T tokens, all from public sources) - Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §2.1
- How did LLaMA filter CommonCrawl for quality?With the CCNet pipeline (line-level deduplication, fastText language identification, n-gram language model filtering), plus a linear classifier trained to tell pages cited as references in Wikipedia from random pages, discarding pages not classified as references.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §2.1
- What is distinctive about LLaMA’s tokenizer?BPE via SentencePiece, with all numbers split into individual digits and a fallback to bytes for unknown UTF-8 characters.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §2.1
2.2 Architecture
- Which three changes did LLaMA make to the original Transformer, and where did each come from?Pre-normalization with RMSNorm on each sub-layer’s input for training stability (from GPT-3); the SwiGLU activation instead of ReLU (from PaLM); and rotary positional embeddings (RoPE) at every layer instead of absolute position embeddings (from GPT-Neo).
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §2.2
2.4 Efficient implementation
- How did LLaMA’s authors make training efficient?A memory-efficient causal attention (xformers) that doesn’t store attention weights or compute masked scores; checkpointing that saves expensive activations such as linear-layer outputs via a hand-written backward pass; model and sequence parallelism; and overlapping computation with GPU communication. The 65B model processed about 380 tokens/s/GPU, about 21 days on 2,048 A100s for 1.4T tokens.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §2.4
3.1 Common Sense Reasoning
- How did LLaMA compare with larger models on zero-shot common sense benchmarks?LLaMA-65B beat Chinchilla-70B on all eight benchmarks except BoolQ and PaLM-540B on all but BoolQ and WinoGrande; LLaMA-13B beat GPT-3 on most despite being 10× smaller.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §3.1
3.2 Closed-book Question Answering
- What did LLaMA achieve on closed-book question answering, and why is the 13B result notable?LLaMA-65B reached state of the art on Natural Questions and TriviaQA in zero- and few-shot settings; LLaMA-13B was competitive with GPT-3 and Chinchilla while being 5–10× smaller and runnable on a single V100 GPU.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §3.2
3.4 Mathematical reasoning
- How did LLaMA do on mathematical reasoning without math fine-tuning?On GSM8k LLaMA-65B outperformed Minerva-62B, a PaLM model fine-tuned on 38.5B tokens of math and arXiv data, though LLaMA saw no special math data.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §3.4
3.6 Massive Multitask Language Understanding
- Where did LLaMA-65B lag behind, and what explanation is offered?On MMLU (5-shot) it trailed Chinchilla-70B and PaLM-540B by a few points across most domains, probably because its books and academic papers totalled only 177 GB versus up to 2 TB of books for those models.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §3.6
4 Instruction Finetuning
- What did brief instruction fine-tuning do for LLaMA-65B?A single fine-tuning run following Flan’s protocol (LLaMA-I) raised MMLU from 63.4 to 68.9, beating other moderate-sized instruction-tuned models, though still well below code-davinci-002’s 77.4.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §4
5 Bias, Toxicity and Misinformation
- What did LLaMA’s toxicity evaluation show about model size?On RealToxicityPrompts, toxicity grew with model size, especially for “respectful” prompts asking for polite completions, consistent with earlier findings (Chinchilla vs Gopher being an exception).
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §5
- How did WinoGender reveal gender bias in LLaMA?Co-reference was much more accurate for “their/them/someone” than for “her/she” or “his/he”, and errors rose on “gotcha” sentences where the pronoun doesn’t match the occupation’s majority gender: the model uses occupational gender stereotypes rather than the sentence’s evidence.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §5
- What did TruthfulQA show for LLaMA?LLaMA scored higher than GPT-3 on truthful and truthful-and-informative answers, but the rate of correct answers was still low, so the model is likely to hallucinate wrong answers.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §5
6 Carbon footprint
- What did developing LLaMA cost in energy, and what argument do Touvron et al. make about release?About 2,048 A100s for roughly five months: an estimated 2,638 MWh and 1,015 tCO₂eq (at the US average carbon intensity). Releasing the trained models, some small enough for a single GPU, may reduce future emissions since others needn’t retrain them.
- Touvron et al., 2023, LLaMA (arXiv preprint arXiv:2302.13971), §6
Source
- Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave and Guillaume Lample. 2023. LLaMA: Open and Efficient Foundation Language Models. In arXiv preprint arXiv:2302.13971. https://arxiv.org/abs/2302.13971