Training

Pinned sources Language Models are Unsupervised Multitask Learners (Radford et al. 2019) · openai/gpt‑2 publishes no training code

  1. Start of training
  2. Pre‑trainingWebText1KNTPWhat trains: all
  3. GPT-2

Not stated for any stage: tokens.

  • checkpoint
  • checkpoint, weights published

Pre-training

×

Language modelling on WebText, about 8 million web pages that Reddit users linked to, the learning rate tuned for each size on held-out WebText.

Next-token prediction

L=−1T∑i=2T+1log⁡Pi[ti]\mathcal L=-\frac1T\sum_{i=2}^{T+1}\log P_i[t_i]
In words

At every position the model gives each token of the vocabulary a probability of coming next; the loss is the negative logarithm of the probability it gave the token that does come next, averaged over the sequence.

tit_i: the token at position ii; Pi[ti]P_i[t_i]: the probability the model, reading the tokens before it, gave that token; TT: the sequence length.

The paper writes the language model’s factorization, p(x)=∏np(sn∣s1,…,sn−1)p(x)=\prod_n p(s_n\mid s_1,\dots,s_{n-1}).

Data
WebText, about 8 million documents, 40 GB
Context
1,024 tokens
Batch
512
Fit
all four still underfit

Not disclosed Tokens · Steps · Epochs · Optimizer · Hardware

Why

Common Crawl, a large and nearly unlimited source, has significant data quality issues. WebText keeps only pages people had curated: outbound links from Reddit with at least 3 karma, a heuristic sign that users found them interesting, educational or funny. GPT-2 paper §2.1, p. 3

Wikipedia is removed because it is a common source of other datasets, and overlap between training data and the test tasks could complicate the analysis. GPT-2 paper §2.1, p. 3

All settings9
Data
WebText: the text of the outbound links from Reddit that received at least 3 karma, 45 million links; the version used has no links created after December 2017 and, after de-duplication and heuristic cleaning, slightly over 8 million documents, 40 GB of text; Wikipedia documents removed
Objective
Language modelling: the probability of a text as the product of each token’s probability given the tokens before it
Context
1,024 tokens, up from GPT’s 512
Batch
512, up from GPT’s; the paper gives no unit
Learning rate
Tuned by hand for each size, for the best perplexity on a 5% held-out sample of WebText; the values are not given
Vocabulary
50,257 tokens, byte-level BPE whose merges never cross character categories, spaces excepted
Sizes
Four, log-uniformly spaced: the smallest equals the original GPT, the second the largest BERT; 117M, 345M, 762M and 1,542M parameters by the paper’s count
Fit
All four still underfit WebText; held-out perplexity was still improving with more training time
Trainable
Every parameter
Sources3

GPT-2

Small, Medium, Large, XL