Transformers and LLM Foundations - Overview

Summary

Four papers define the technical core of modern large language models (LLMs). Vaswani et al. (2017) introduce the Transformer, a sequence model built only from attention, residual connections and position-wise feed-forward layers (Transformer Architecture and Positional Encoding). Trained as a next-token predictor (Autoregressive Language Modeling and Pretraining), its test loss follows smooth power laws in parameters , data and compute (Kaplan et al. 2020, Neural Scaling Laws). Hoffmann et al. (2022) correct the allocation rule: for a fixed compute budget, parameters and tokens should grow in equal proportion (Compute-Optimal Training (Chinchilla)). Brown et al. (2020) show that a sufficiently large autoregressive model (GPT-3, 175B parameters) can perform new tasks from a handful of demonstrations in its prompt, with no gradient updates (In-Context Learning and Few-Shot Prompting).

Overview

The cluster answers four questions in sequence.

  1. What is the function class? A Transformer maps a sequence of token vectors to a sequence of token vectors. Its one non-standard ingredient is attention, , a content-dependent weighted average that connects every pair of positions in sequential steps (Vaswani et al., Sec. 3.2, Table 1). Everything else (residual connections, layer normalization, a two-layer ReLU network applied to each position, sinusoidal position signals) is conventional.
  2. What is the training objective? The chain rule of probability: , fitted by maximum likelihood (cross-entropy in nats per token) on web-scale text. A causal mask in the attention layer enforces the factorization, so all conditionals of a training sequence are evaluated in one parallel pass.
  3. How does performance depend on scale? Kaplan et al. find with , with and , holding across six to eight orders of magnitude and depending only weakly on depth, width or head count. Hoffmann et al. re-estimate the allocation of a budget and find , rather than Kaplan’s and .
  4. What does scale buy besides lower loss? Brown et al. show the gap between zero-, one- and few-shot accuracy widens with model size: larger models are better “meta-learners”, extracting a task from the prompt alone.
PaperContributionHeadline number
Vaswani et al. 2017Attention-only encoder-decoder28.4 BLEU EN-DE, 41.8 BLEU EN-FR after 3.5 days on 8 P100 GPUs
Kaplan et al. 2020Power laws , , , joint , ,
Hoffmann et al. 2022Compute-optimal vs ; Chinchilla 70B on 1.4T tokens; MMLU 67.6% vs Gopher 60.0%
Brown et al. 2020GPT-3 175B; in-context learningLAMBADA 86.4% few-shot; TriviaQA 71.2% few-shot

Main Content

Transformer ^def-transformer

A sequence transduction model “based solely on attention mechanisms, dispensing with recurrence and convolutions entirely” (Vaswani et al., Abstract). Each layer applies multi-head attention and a position-wise feed-forward network, each wrapped as . See Transformer Architecture and Positional Encoding.

Large language model (as used in these papers) ^def-llm

A Transformer (in Kaplan, Brown and Hoffmann: decoder-only) trained to “autoregressively model language”, i.e. to minimize the cross-entropy of the next token given the preceding context, on hundreds of billions of tokens. The scale variables are (non-embedding parameters in Kaplan; all parameters in Hoffmann), (training tokens) and (training FLOPs). See Autoregressive Language Modeling and Pretraining.

The empirical regularities that organize the field ^thm-regularities

These are empirical laws, not theorems in the mathematical sense.

  1. Scale over shape. Loss “depends strongly on scale, weakly on model shape” (Kaplan, Sec. 1.1, Sec. 3.1).
  2. Power laws. Loss is a power law in each of , , “when not bottlenecked by the other two” (Kaplan, Eqs. 1.1-1.3).
  3. Joint law and overfitting. (Kaplan, Eq. 1.5), or in Hoffmann’s additive form (Eq. 2).
  4. Compute-optimal allocation. Minimizing subject to gives and (Hoffmann, Eq. 4); all three of Hoffmann’s estimation approaches put both exponents near .
  5. In-context learning improves with scale. Few-shot performance “increases more rapidly” with model size than zero-shot performance (Brown, Fig. 1.3).

Reading order

Relevance to marketing measurement and applied work

Examples

One accounting identity ties the four papers together. Training compute is FLOPs (Kaplan, Sec. 2.1: per token forward, twice that backward). For GPT-3, and give

matching the FLOPs and PF-days reported in Brown et al. (Appendix D), where one PF-day is FLOPs. Gopher used FLOPs with B and B; Hoffmann et al. spend the same budget on B and T and obtain a uniformly better model. At roughly 20 tokens per parameter (Hoffmann, Table 3), a compute-optimal 175B model would need about 3.7T tokens, more than twelve times what GPT-3 saw.

Connections

See Also