liveBook · Manning

GPT model

As explained in Transfer Learning for Natural Language Processing

GPT is a family of autoregressive transformer language models developed by OpenAI.

GPT (Generative Pretrained Transformer) is a family of transformer language models developed by OpenAI. GPT uses a causal language-modeling objective: it predicts the next token from the tokens before it. This makes it useful for text generation, including chatbot applications. section 7.2 section 7.3

GPT combines self-supervised pretraining on a large text corpus with supervised fine-tuning on a target task. This transfer-learning approach has been used for natural language inference, question answering, semantic similarity, and text classification. section 7.2

The architecture stacks transformer decoders without an encoder or encoder-decoder attention. Masked self-attention prevents a token from attending to future tokens, preserving the causal ordering needed for next-token prediction. By contrast, BERT stacks encoders and uses a masked language-modeling objective. section 7.2.1 section 7.2

Figure 7.7 A high-level representation of the GPT architecture, showing stacked decoders, input embeddings, and positional encodings. The output from the top can be used for both text prediction/generation and classification.
07_07

Follow the stacked-decoder architecture from input embeddings and positional encodings to outputs used for generation or classification. section 7.2.1

Textual entailment

To test whether a premise implies a hypothesis, concatenate the two statements with a special delimiter token. The resulting single input can be classified by the same architecture, without changing its structure. section 7.2.1

GPT has evolved through successive iterations. GPT-2 had 1.5 billion parameters, while GPT-3 had 175 billion. Larger models bring resource considerations as well as potential for misuse; GPT-2 was initially not fully open-sourced because of abuse concerns. section 7.2

How Transfer Learning for Natural Language Processing covers it

How deep it goes
Explains decoder stacks, causal masking, and task input transformations, including a comparison with BERT.
Examples
Illustrates task adaptation with textual entailment and compares the parameter counts of GPT-2 and GPT-3.
What you can do after
Evaluate and understand how causal masking supports generation and how task inputs can adapt GPT to classification.
How it connects
Connects GPT to transformer decoders, self-attention, causal language modeling, transfer learning, and BERT.

Also explained in

Compare how 19 books explain GPT model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Transfer Learning for Natural Language Processing. The section links point to the parts of the book it draws on.