Transformer architecture
The transformer is the design (architecture) behind almost every modern language AI. It was introduced by Google researchers in 2017 in a paper called "Attention Is All You Need", and it is the T in GPT. Its big idea is self-attention: instead of reading one word at a time, it looks at all the words together and works out which words relate to each other.
Everyday analogy
Older models read a sentence like passing a message down a line of people, where details get lost along the way. A transformer is like a meeting where everyone can hear everyone at once, so each word can directly check which other words matter to it.
Example
- Encoder part: understands text. Used by models like BERT (Google search understanding).
- Decoder part: writes text, one token at a time. Used by GPT, Claude and Gemini.
- The original 2017 transformer had both, for translation.
Self-attention in action: what does "it" mean?
Here "it" pays most attention to animal, because animals get tired.
Change one word and "it" now points to street, because streets are wide. Darker colour = more attention.
Inside a transformer, step by step
Try it yourself
About 10 minFind what attention links
- Write the sentence: The trophy didn't fit in the suitcase because it was too big.
- Ask an AI chatbot what it refers to. Then change big to small and ask again.
- Notice how one word changes the meaning of another.
What you should see: Transformers use attention to connect words across a sentence, which is how they work this out.
Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.