Language models are unsupervised multitask learners
- Publication
- OpenAI 2019Technical report
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@techreport{transformersgpt22019,
title = {{Language models are unsupervised multitask learners}},
author = {Alec Radford and Jeffrey Wu and Rewon Child and David Luan and Dario Amodei and Ilya Sutskever},
year = {2019},
institution = {OpenAI},
url = {https://openai.com/index/better-language-models/}
}
The first GPT stacked twelve Transformer decoder layers. OpenAI apparently thought that was not enough, so they stacked forty-eight in the largest GPT-2 model. The paper also trains smaller variants; forty-eight layers refers only to the largest one.
Defining the Problem
The authors believe that existing machine learning systems, despite their excellent performance, are fraught with issues. The paper briefly outlines several areas of concern:
Fragility
- Machine learning systems exhibit fragility when there are slight changes in data distribution and task specifications.
- These systems lack stability in handling input diversity and variations, leading to unstable behaviors.
Limitations of Narrow Experts
- Current machine learning systems function more like narrow experts rather than general-purpose systems, limiting their application scope.
- These systems rely on manually building and annotating training datasets for each specific task, a tedious and non-generalizable process.
Lack of Generalization
- The prevalence of single-task training on single-domain datasets results in systems that lack generalization capabilities.
- To achieve robust systems, training and evaluation need to span a broader range of domains and tasks.
Solving the Problem
This paper keeps GPT-1's decoder-only architecture, scales up the model, and changes the normalization, initialization, and tokenization.
Model Design
First, the authors moved LayerNorm to the input of each sub-block, similar to pre-activation residual networks. Additionally, they added an extra layer normalization after the final self-attention block.
A modified initialization method was used, considering the cumulative effect on the residual path as model depth increases. The residual layers' weights were scaled by a factor of 1/√N during initialization, where N is the number of residual layers.
To enhance the model's capabilities, the vocabulary size was expanded to 50,257, the context size increased from 512 to 1024 tokens, and a larger batch size of 512 was used.
Multitask Learning
A general-purpose system should be capable of performing many different tasks. This means modeling P(output|input, task) rather than just modeling the conditional distribution of a single task P(output|input).
Here, the authors propose a method of specifying all inputs and outputs as symbol sequences and training the model using language modeling. For example, a translation training example might be represented as (translate to French, English text, French text), while a reading comprehension training example might be (answer the question, document, question, answer).
Text can express the task. GPT-2 does not jointly train on manually labeled versions of all these tasks; it learns next-token prediction on WebText, then tests whether naturally occurring demonstrations support task transfer.
Diverse Data
Most prior language model training focused on single text domains, such as news articles, Wikipedia, or book novels. The authors' approach encourages constructing the largest and most diverse dataset possible to cover a broader range of natural language contexts and demonstrations.
The authors considered Common Crawl for its scale, but their preliminary experiments ran into serious data-quality problems. So they built WebText separately; GPT-2 was not trained directly on Common Crawl.
-
Solution:
- New Web Scraping: Use Reddit outbound links with at least 3 karma as a heuristic quality signal.
- WebText Dataset: The resulting dataset, WebText, includes a subset of texts from these 45 million links. The initial version of WebText excludes links created after December 2017, and after deduplication and heuristic cleaning, it contains just over 8 million documents, totaling 40 GB of text.
- Wikipedia Exclusion: Wikipedia documents were removed from WebText to reduce overlap with evaluations that use Wikipedia and ease analysis.
Optimized BPE Encoding
The advantage of byte-level BPE lies in its flexibility and generality, as it can decompose any character into a sequence of bytes. However, directly applying BPE to byte sequences can result in suboptimal merges due to BPE's greedy frequency algorithm.
To address this, the authors restrict merges across character categories so variants of a word with different punctuation do not consume too many vocabulary slots. Spaces are an exception; the paper says this improves compression efficiency with little word fragmentation.
Discussion
Model Sizes
The report lists 117M/12 layers, 345M/24, 762M/36, and 1542M/48. The forty-eight layers in the subtitle refer only to the largest model. Table 2 also shows d_model rising from 768 through 1024 and 1280 to 1600, so results cannot be attributed to depth alone.
Zero-Shot Performance
Zero-shot here means no task-specific parameter update. The paper separately analyzes pretraining overlap.
In Table 3's zero-shot language-model evaluation, the largest model sets a then-best result on seven of eight datasets. 1BW is the exception: its perplexity of 42.16 remains worse than the prior 21.8. There are ten metric columns because LAMBADA and CBT each contribute two. Gains are especially visible on Penn Treebank and WikiText-2. Those datasets' own training splits contain about one to two million tokens, but GPT-2 did not train on them for this evaluation.
The dataset for measuring long-term dependencies, such as LAMBADA and the Children's Book Test, also showed substantial progress.
| Metric | Meaning | Interpretation |
|---|---|---|
| PPL | Perplexity: exponentiated mean negative log probability of a test sequence. | Lower means the model predicts that sequence better; compare under the same data and processing. |
| ACC | Accuracy: proportion correct under specified candidates or answer rules. | Higher is better, with task constraints in view. |
| BPB | Bits per byte: model-derived information content averaged per byte. | Lower means less prediction loss on this test set. |
| BPC | Bits per character: the same information content normalized by character count. | Lower means less prediction loss on this test set. |
Compare PPL under consistent tokenization and evaluation conditions. BPB/BPC are not the original file's fixed storage width. Table 3 also uses reversible detokenization to lessen differences introduced by benchmark preprocessing.
Various Experiments
The authors conducted experiments on various tasks, including language modeling, machine translation, question answering, text summarization, and text generation.
Here's a summary table to quickly understand GPT-2's performance on various tasks:
| Test Name | Purpose | Test Method | Results |
|---|---|---|---|
| Children's Book Test (CBT) | Check model performance on different word categories. | Choose the missing word from 10 candidates on the validation set, which had no significant WebText overlap. | 93.3% accuracy on common nouns, 89.1% accuracy on named entities. |
| LAMBADA | Test modeling long-range dependencies. | Predict a sentence's final word. | Prior perplexity 99.8 falls to 8.6, and unfiltered accuracy rises from a prior 19% to 52.66%. A stopword filter gives 63.24%, a different setting. |
| Winograd Schema Challenge | Measure resolution of text ambiguity. | Compare candidate interpretations. | 70.70% on only 273 examples; the paper cautions against overinterpreting the small sample. |
| Reading Comprehension (CoQA) | Answer questions that depend on dialogue history. | Generate answers given a document and conversation history. | 55 F1 on the development set, matching or beating three of four supervised baselines, but below stronger supervised systems. |
| Summarization | Test summarization ability. | Add TL;DR: after an article, sample with top-k=2, and take the first three generated sentences. | Average ROUGE is 21.40, only slightly above 20.98 for three random sentences; generated summaries sometimes confuse details. |
| Translation | Test translation ability. | Use English-French sentence translation. | Achieved 5 BLEU on English-French test set; 11.5 BLEU on French-English test set, lower than the best unsupervised methods' 33.5 BLEU. |
| Question Answering | Test factual short-answer generation. | Prompt with example Q&A pairs; evaluate Natural Questions exact match. | 4.1% overall, answering 5.3 times as many questions as the smallest model. Accuracy is 63.1% on the top 1% by confidence, still far below contemporaneous retrieval-plus-extraction systems' 30–50%. |
Conclusion
This study explores what unsupervised task learning might do for NLP: can GPT-2 carry out different tasks directly, without supervised adaptation or a task-specific model change?
The results suggest that a large language model trained on sufficiently varied text can perform well across many domains and datasets, and can begin to handle tasks without explicit task supervision. The seven then-best results in Table 3 are for language-model transfer across datasets; translation, summarization, and question answering are still much weaker. The authors also found a small but consistent benefit from WebText/test-set overlap.
These findings opened up new possibilities for unsupervised learning and further improvements to language models. They also give us a reason to keep checking which abilities actually appear when we describe a task in text.