Skip to content

Generative pre-trained transformer

Written by GPT-6 Luna from the web 22 of 81 sentences cited

An AI wrote this article, and it can be wrong.

A generative pre-trained transformer (GPT) is a type of language model that uses a transformer neural network, pre-trained to predict what token comes next in a sequence. The name describes both its generative objective and its training approach: the model first learns statistical patterns from text and can then be adapted or prompted to perform particular tasks. GPT models became influential because a single model trained this way can generate and transform text across many tasks, including ones it was not separately trained to perform.12

“GPT” can refer to the general decoder-only model design or, more narrowly, to a series of models developed by OpenAI. The term is also used more broadly for models with similar designs made by other organizations. GPT is not one fixed specification: later models have varied in their training, size, capabilities and supported input types, and some technical details have not been published.23

Origins

GPT’s architectural foundations lie in the transformer, introduced in the 2017 paper “Attention Is All You Need” by Ashish Vaswani and co-authors. The original transformer was an encoder–decoder system for sequence-to-sequence tasks such as machine translation, and used attention rather than recurrent neural networks to process sequences. GPT adapted the transformer for language generation by using a decoder-only design: it predicts each part of a sequence from the parts that come before it.41

OpenAI introduced its first GPT model in the 2018 paper “Improving Language Understanding by Generative Pre-Training.” The authors proposed learning from a large collection of unlabeled text, then adapting the resulting model to specific language tasks using labeled examples. They reported that their approach improved results on nine of the twelve benchmarks they studied, including textual entailment and question answering. The central contribution was a reusable pre-training and adaptation method, rather than a different, task-specific neural network for every problem.1

The first model used a 12-layer decoder-only transformer, with 12 attention heads and 768-dimensional states. Its training text was divided into tokens using byte-pair encoding, a method that can represent text as pieces smaller or larger than whole words. The model learned to estimate the likelihood of the next token given preceding tokens, then used those learned representations in task-specific fine-tuning. This design established the main pattern later associated with GPT, although individual implementations have changed.1

Model structure

A GPT model processes a token sequence through successive transformer layers. Within each layer, self-attention lets a token’s representation incorporate information from earlier tokens in the sequence; feed-forward computations further transform those representations. A causal mask prevents the model from using future tokens when predicting the next one. This arrangement makes the model autoregressive: it generates a sequence step by step, conditioning each new prediction on the preceding context.14

At generation time, the model calculates a probability distribution over possible next tokens. A decoding procedure selects or samples from that distribution, appends the selected token to the sequence, and repeats the process. The model’s output is therefore a continuation shaped by its prompt, learned parameters and decoding choices. It is not required to retrieve a stored answer from a database, although some applications combine language models with search or other external tools.12

The model’s context is the token sequence available to it at a given prediction step, including the prompt and any generated continuation still within its context window. Attention provides a way to relate tokens within that sequence, but it does not by itself make the model’s context unlimited. Implementations differ in their context limits and in the computational methods they use to handle longer sequences.25

Training

Pre-training teaches a GPT model to predict tokens across large text collections. During training, the model’s predictions are compared with the actual next tokens, and its internal parameters are adjusted to reduce prediction error. The training objective is general-purpose: it does not require the text to be labeled in advance as, for example, a question, a summary or a translation. The 2018 GPT paper used BooksCorpus, while later models were trained on larger and more varied collections.16

A pre-trained model can be adapted in different ways. In the original GPT approach, fine-tuning used labeled examples for a specific task, with small changes to how task inputs and outputs were presented to the model. Another approach, called in-context learning, puts a task description or examples directly into the prompt; the model then responds without changing its parameters during that interaction. GPT-3 demonstrated this approach at scale, using zero examples, one example or several examples in its prompt.12

Many conversational GPT systems also receive post-training intended to make their responses more useful to people. In the InstructGPT work, researchers used written demonstrations and human rankings of model responses, then trained models using reinforcement learning from human feedback. In the authors’ evaluations, human raters preferred outputs from a 1.3-billion-parameter InstructGPT model to those from the 175-billion-parameter GPT-3 model on their prompt distribution. This shows that model size alone does not determine how well a system follows instructions.7

Scaling and prompting

Successive GPT models demonstrated that increasing model size and training data could improve performance across a range of language tasks. GPT-2, introduced in 2019, had 1.5 billion parameters and was trained to predict text from a large collection of webpages. Its authors reported that the model could perform some tasks, including summarization and question answering, in a zero-shot setting, where the prompt contained no task-specific examples.6

GPT-3, described in a 2020 paper, had 175 billion parameters. The researchers tested it on tasks presented through text prompts, without fine-tuning its parameters for each task. Performance often improved when prompts included examples, but the results varied between tasks; the authors also documented weaknesses and methodological concerns, including possible overlap between training data and evaluation benchmarks.2

Research on scaling found that language-model loss tended to improve with increases in model size, dataset size and training computation, following empirical power-law trends over the ranges studied. Such findings helped motivate the development of very large models, but they do not establish that every capability improves at the same rate, or that increased scale removes limitations. The GPT-3 authors, for example, found that its generation could lose coherence over long passages and that performance remained weak on some tasks.82

Adaptation

The GPT design has been adapted for uses beyond producing a plain-text continuation. Instruction fine-tuning and human-feedback training are used to make some models respond more directly to requests and conversational prompts. Developers can also place GPT models inside larger systems that provide tools or external information. Such additions affect how an application behaves, but they are distinct from the underlying transformer’s next-token prediction objective.92

Later models have also extended the kinds of input they can process. OpenAI’s 2023 GPT-4 technical report described a model that could accept both text and images and produce text. The report identified GPT-4 as a transformer model pre-trained to predict the next token, followed by reinforcement learning from human feedback. It did not disclose the model’s size or further architectural details, citing competitive and safety considerations.3

The GPT-4.1 series, announced in April 2025, was presented as improving coding, instruction following and long-context performance; OpenAI said the models supported context windows of up to one million tokens. The announcement also described image-understanding capabilities. These examples illustrate that “GPT” does not specify a single immutable model: the name covers systems that retain a broad generative-transformer lineage while differing in features and implementation.5

Significance and debate

GPT’s importance lies partly in showing how one large pre-trained model could be applied to many tasks through prompts or relatively general fine-tuning. The GPT-3 study helped popularize few-shot and zero-shot prompting, while instruction-tuned models extended the approach to conversational assistants. These methods made it possible to use a general-purpose language model for tasks without building an entirely separate model for each one.27

The release of GPT-2 also drew attention to questions about publication and access. OpenAI initially released smaller versions in stages, saying it wanted time to assess the potential for misuse and the societal effects of more capable text generation. Its August 2019 update described the staged process and released a 774-million-parameter version; the episode became a prominent case in debates about whether AI developers should publish complete models immediately or limit release.1011

Criticism has focused on both social effects and what next-token prediction can establish about a model’s competence. The authors of “On the Dangers of Stochastic Parrots,” published at the 2021 ACM Conference on Fairness, Accountability, and Transparency, raised concerns about the environmental and financial costs of large models, opaque training data, and biases reflected in that data. They also questioned what coherent-sounding text demonstrates about a system’s understanding. These are arguments in a scholarly debate, not claims that all researchers interpret GPT systems in the same way. dl.acm.org

Limitations and current form

A GPT model can produce fluent text that is incorrect, inconsistent or unsupported. Because its basic objective is to predict likely continuations, a plausible-sounding answer is not, by itself, evidence that the answer is true. In their GPT-3 study, the model’s authors reported repetitions, loss of coherence in longer passages, contradictions and weak results on some language tasks. They also noted that benchmark contamination can complicate the interpretation of reported scores.2

Bias is another concern. The GPT-3 paper reported that its tests found stereotyped associations in model outputs, including a tendency for many tested occupations to be followed by male identifiers. The authors described their analysis as preliminary and limited in scope. More broadly, the ACM paper argued that large models can reproduce harms or biases present in their training data, and recommended greater attention to data curation and documentation.2

GPT is therefore best understood as a model family and design pattern, not as a guarantee of particular capabilities or behavior. The general pattern—transformer-based processing, pre-training on text and generation by predicting subsequent tokens—has persisted, while post-training, multimodal inputs, context length and implementation details have evolved. Public descriptions do not reveal every detail: in the GPT-4 report, for example, the developers withheld the model size, hardware and further architecture information.35

References

11 sources
  1. Language understanding papercdn.openai.com· cited 8×

  2. Language Models are Few-Shot Learnersarxiv.orgMay 28, 2020· cited 11×

  3. cdn.openai.com/papers/gpt-4.pdfcdn.openai.com· cited 3×

  4. 7181 attention is all you needproceedings.neurips.cc· cited 2×

  5. openai.com/index/gpt-4-1openai.com· cited 3×