Skip to content
Nitmonk
Language Models

GPT (Generative Pre-trained Transformer)

How GPT predicts text, one token at a time.

GPT (Generative Pre-trained Transformer) — infographic explaining How GPT predicts text, one token at a time.
GPT (Generative Pre-trained Transformer) — visual explainer by Nitmonk.

GPT (Generative Pre-trained Transformer) is a type of LLM that is pre-trained on massive amounts of text and then prompted or fine-tuned to generate human-like text. It is not programmed with rules — it learns from data and predicts the most likely next word.

In simple terms

GPT reads billions of words, learns the patterns, then generates the next word, one at a time.

How it works

  1. 1Pre-training: learn patterns from massive text data.
  2. 2Transformer architecture: use self-attention to understand relationships between all words.
  3. 3Next-token prediction: predict the next word based on context.
  4. 4Generate: repeat the process to produce one word at a time.
  5. 5Human-like output: produce coherent, relevant, context-aware text.

Key points

  • GPT is a decoder-only transformer that generates text left to right.
  • It supports zero/few-shot learning — it can work from instructions alone.
  • It is general-purpose: one model handles many tasks.
  • It is the foundation for products like ChatGPT and code assistants.

Why it matters

GPT showed that a single, general text generator could write, explain, answer, summarise and code. It reframed AI from task-specific tools to one flexible model steered by prompts.

Frequently asked questions

What does 'pre-trained' mean?
The model first learns general language from huge text data, before being adapted or prompted for specific tasks.
What is self-attention?
A mechanism that lets the model weigh how much each word relates to every other word when predicting the next one.