AI Glossary

What is a transformer?

Also known as: Transformer architecture, Transformer model

Definition

A transformer is a neural network architecture, introduced by Google researchers in the 2017 paper 'Attention Is All You Need', that uses a mechanism called attention to weigh how every part of an input relates to every other part. It underpins nearly all modern large language models.

The transformer, from a 2017 Google paper, is the design behind ChatGPT, Claude, Gemini and most modern AI. You don't need the maths, but it explains tokens, context windows and why these models are so good with language.

The transformer is the architecture — the blueprint for how the neural network is wired — behind ChatGPT, Claude, Gemini, Llama and nearly every other large language model. It’s the “T” in GPT. If modern AI is a building, the transformer is the steel frame.

How it works

Before transformers, language models mostly read text one word at a time, in order, which made them slow to train and forgetful over long passages. The transformer, introduced in the 2017 Google paper Attention Is All You Need, changed two things:

  1. Attention. For every token, the model computes how strongly it should “attend” to every other token. In “The trophy didn’t fit in the suitcase because it was too big,” attention helps the model link “it” to “trophy.” Many attention “heads” run in parallel, each picking up different relationships — grammar, references, topic.
  2. Parallelism. Because attention looks at the whole sequence at once rather than step by step, training can be spread across thousands of chips. That made it practical to train enormous models on enormous datasets, which is what unlocked today’s capabilities.

Stack dozens of these attention layers, train on a vast corpus, and you get a model that captures remarkably subtle patterns in language.

An analogy

Older models read a sentence like someone listening to a long voicemail, struggling to remember the start by the end. A transformer reads like someone with the whole page in front of them, highlighter in hand, drawing lines between every word and the other words that explain it.

Why it matters for your work

You don’t need to implement attention to make money with AI. But knowing what a transformer is helps you:

  • Cut through hype. Most “revolutionary new AI” products are transformer models from a few major labs, wrapped in an interface — see AI wrapper.
  • Understand limits. Attention cost grows quickly with input length, which is part of why context windows have limits and long inputs cost more.
  • Follow the field. Variants like mixture of experts and techniques like quantization are all about making transformers cheaper and faster.

Examples

Text: GPT, Claude, Gemini, Llama. Images: vision transformers used in computer vision. Generation: many diffusion image and video models now use transformer backbones. Science: transformer-based models have been applied to predicting protein structures.

Tools that use it

ChatGPT

AI Writing
9.2/10

Write, research, make images, talk by voice and run agents from one chat box, made by OpenAI.

Claude

AI Writing
9.3/10

Get the strongest long-form writing and the most careful reasoning among the consumer AI assistants, from Anthropic.

Gemini

AI Writing
8.6/10

Ask Google's assistant about your Gmail, Docs and Drive, and get help inside the Google apps you already use.

Free plan · $4.99/mo

Questions people ask

What does the 'T' in GPT stand for?

Transformer. GPT stands for Generative Pre-trained Transformer.

What is attention in a transformer?

Attention is a mechanism that lets the model, when processing each token, look at all the other tokens in the input and decide how much each one matters for understanding it. It's how the model knows what 'it' refers to in a long sentence.

Are transformers only used for text?

No. Transformers are also used for images (vision transformers), audio, video, protein structure prediction and as components inside many image and video generators.

← All AI terms