Transformer
A neural network architecture built around attention that powers many modern language and multimodal models.
What does “plate” mean in this sentence?
Compare “The printmaker inked the plate” with “The potter glazed the plate.” The word appears in the same position, but the surrounding words point toward different objects.
- Represent the tokens
The model starts from token representations and information about their positions. An implementation may split a word into more than one token.
- Mix information
Self-attention calculates interactions between representations. Information associated with “inked” or “glazed” can contribute differently to how “plate” is represented.
- Build further layers
Attention and other learned transformations repeat across layers. Which positions are visible to each other depends on the model’s attention mask.
What can you infer from an attention pattern?
A strong interaction in one head and layer is one part of a computation involving many components. To test whether the model distinguishes the two senses, evaluate its answers or representations on varied examples, including unfamiliar verbs and contexts.
What Makes Transformers Different
The key idea is self-attention. When the model reads a sequence, it learns how strongly each token should attend to the others. That helps it capture long-range relationships such as references, topic changes, code structure, or sentence meaning. Combined with many stacked layers, attention lets the model build increasingly rich internal representations of the input.
Transformers also scale well. Because much of the input can be processed in parallel, they are well suited to large training runs on modern hardware. That scaling property helped drive the rise of today's large language models, which rely on Transformers to learn from massive corpora of text.
Follow the idea
BERT (Bidirectional Encoder Representations from Transformers) · BERT uses a transformer encoder to read context on both sides.
Context Window · The context window limits how much material can be supplied together.
Related concepts
Examples in the AI guides
Related Yenra articles (3)
Source · Vaswani and colleagues’ original Transformer paper
Return to Transformer in the A–Z glossary