A transformer is a neural network architecture that processes entire sequences of text at once using a mechanism called attention, and it underlies nearly every modern large language model.
A transformer is a neural network design introduced by Google researchers in 2017 in the paper "Attention Is All You Need." Instead of reading text one word at a time in order, like older recurrent networks did, a transformer looks at an entire sequence simultaneously and learns which words matter most to each other, regardless of how far apart they sit in the text.
How the attention mechanism works
The core idea is the attention mechanism: for every word, the model computes a score for how relevant every other word in the sequence is to understanding it. That lets a transformer capture long-range relationships, such as a pronoun referring back to a name several sentences earlier, far more efficiently than previous architectures could.
Because transformers process a sequence in parallel rather than step by step, they train much faster on modern hardware like GPUs. That speed, combined with how well the architecture scales as models and datasets grow, is why transformers became the foundation for GPT, Gemini, Claude, and essentially every large language model built since.
While they started in language, transformers now power image generation, protein-folding models, and speech recognition — anywhere a system benefits from weighing relationships across a full input rather than reading it in strict order.