ElemedexA pocket encyclopedia of AI architectures
No. 032

GPT-3

Generative Pre-trained Transformer 3

Few-Shot Model

Show it three examples in the prompt and it solves the fourth without changing a single one of its 175 billion connections. Nobody quite knows whether it is learning at that moment or just recognizing something it has seen before. Its own creators don't either: they said so in print.

Height
96 layers
Weight
≈ 350 GB (fp16)
Parameters
175 billion
Context
2048 tokens
Training data
300 billion tokens: Common Crawl, WebText2, Books1–2, Wikipedia
Year
2020
Generation
5 · Large language models
Creators
Brown, Mann, Ryder, Subbiah, Kaplan et al. (OpenAI)
Kind
Model

Base stats

Total
346

Approximate, ordinal scales meant for comparing species with each other; the hard numbers are in the data sheet.

Weaknesses

  • In long passages it repeats itself, loses coherence and contradicts itself.
  • It performs near chance on comparison tasks, such as deciding whether one sentence implies another.
  • It stumbles on commonsense physics: “If I put cheese into the fridge, will it melt?”
  • It reproduces the biases of its corpus, and a filtering bug left some benchmark data in its training set.

Habitat

It grew up on a filtered version of Common Crawl, WebText2, two book corpora and English Wikipedia, with the "high-quality" sources oversampled. Its weights were never released: it lived behind OpenAI's API, and its successor GPT-3.5 was the first engine of ChatGPT.

Moves

Abilities

In-context learning
It adapts its behavior to a task described or demonstrated in the prompt without updating any weights: everything happens within the forward pass.
Scale
175 billion parameters, ten times more than any previous dense language model, a size chosen in light of scaling laws.
Alternating attention
Layers alternate dense causal attention with locally banded sparse attention, saving compute without losing the full context.

Anatomy

GPT-3 is GPT-2's stack taken to 96 pre-normalized decoder blocks; layers alternate dense and sparse attention. The examples in the prompt change no weights: they only condition the prediction of the next token, which is appended and fed back in.

Evolution chain

032 GPT-3

GPT-3 is a 175-billion-parameter autoregressive generation language model, ten times larger than any previous dense model, released by OpenAI in 2020 (Brown et al., 2020, sec. 1). Its fame does not come from its architecture, which is essentially that of GPT-2, but from a behavior: solving new tasks from a handful of examples written into the prompt, without any fine-tuning.

How it works

It is a stack of 96 decoder blocks with a causal mask, 12,288-dimensional vectors and 96 attention heads; a context window of 2048 tokens; and layers that alternate dense and locally banded sparse attention (Brown et al., 2020, sec. 2.1; Alammar & Grootendorst, 2024, p. 96). It was trained on 300 billion tokens from a mixture in which the sources deemed higher quality (WebText2, Books1, Wikipedia) were seen two or three times, and the filtered Common Crawl and Books2 less than once (2020, sec. 2.2). The cost was about 3.14 × 10²³ FLOPs (2020, app. D).

The size was not a whim. Months earlier, the scaling laws of Kaplan et al. (2020) had shown that loss falls as a power law in parameters, data and compute, and that a budget is best spent mostly on bigger models (2020, sec. 1.1). GPT-3 followed that recipe: many parameters, relatively few tokens (Brown et al., 2020, fig. 2.2).

Learning without touching the weights

The paper defines three settings (2020, sec. 2). In zero-shot the model receives only an instruction; in one-shot, an instruction and one example; in few-shot, as many examples as fit in the window (typically 10 to 100). In none of them are gradients updated: the model simply continues the text. The authors call this in-context learning, and Alammar & Grootendorst (2024) present it as the idea of showing the task instead of describing it (2024, pp. 180–181).

Some results: 71.2% on TriviaQA without consulting documents, 86.4% on LAMBADA when the task is framed as a cloze test with examples, 100% on two-digit addition (Brown et al., 2020, secs. 3.1, 3.2, 3.9.1). In an experiment with about 80 people per model, accuracy at telling GPT-3's news articles from real ones was ≈ 52%, barely above chance (2020, sec. 3.9.4). The most interesting finding concerns shape: the gap between zero, one and few examples widens with model size, as if larger models were better "meta-learners" (2020, sec. 1).

What changed

With GPT-3 the prompt became a way of programming. That brought "prompt engineering" and its fragility: tiny changes in punctuation or wording alter performance (Buckner, 2024, pp. 278–279). It also made clear that a base model is not an assistant: it predicts continuations rather than following instructions, which is why its descendants went through instruction tuning and RLHF on the way to ChatGPT (InstructGPT) (Alammar & Grootendorst, 2024, pp. 26, 88).

Limits

The authors list their own (Brown et al., 2020, sec. 5): incoherence over long passages, near-chance results on comparison tasks such as WiC and ANLI, trouble with everyday physics, poor sample efficiency in pretraining, and the biases of the data. A filtering bug left some data contamination with benchmarks that could not be fixed because retraining was too expensive (2020, secs. 2.2, 4). And since weights and data stayed with OpenAI, studying it reproducibly was far harder than studying BERT (Buckner, 2024, pp. 279–280).

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., . . . Amodei, D. (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems (Vol. 33, pp. 1877–1901). Curran Associates. https://proceedings.neurips.cc/paper_files/paper/2020/hash/1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html §
  • Buckner, C. J. (2024). From deep learning to rational machines: What the history of philosophy can teach us about the future of artificial intelligence. Oxford University Press. https://doi.org/10.1093/oso/9780197653302.001.0001 §
  • Elhage, N., Nanda, N., Olsson, C., Henighan, T., Joseph, N., Mann, B., Askell, A., Bai, Y., Chen, A., Conerly, T., DasSarma, N., Drain, D., Ganguli, D., Hatfield-Dodds, Z., Hernandez, D., Jones, A., Kernion, J., Lovitt, L., Ndousse, K., . . . Olah, C. (2021). A mathematical framework for transformer circuits. Transformer Circuits Thread. https://transformer-circuits.pub/2021/framework/index.html §
  • Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., & Amodei, D. (2020). Scaling laws for neural language models (arXiv:2001.08361). arXiv. https://doi.org/10.48550/arXiv.2001.08361 §
  • Millière, R., & Buckner, C. (2024a). A philosophical introduction to language models—Part I: Continuity with classic debates (arXiv:2401.03910). arXiv. https://doi.org/10.48550/arXiv.2401.03910 §
  • Millière, R., & Buckner, C. (2024b). A philosophical introduction to language models—Part II: The way forward (arXiv:2405.03207). arXiv. https://doi.org/10.48550/arXiv.2405.03207 §