Transformer

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.

Key takeaways

  • Transformers were introduced in the 2017 paper "Attention Is All You Need."
  • The architecture's attention mechanism lets a model weigh how relevant every part of an input is to every other part.
  • Transformers process sequences in parallel, which made large-scale training on GPUs practical.
  • Nearly every modern large language model is built on the transformer architecture.
  • Transformers have since expanded beyond text into image, audio, and scientific applications.

What is a transformer in AI?

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.

Why transformers replaced earlier architectures

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.

Where else transformers are used

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.

Frequently asked

What is a transformer model used for?
Transformer models are used for tasks that involve understanding relationships across a sequence, most commonly language generation, translation, and increasingly image and audio generation.
Is a transformer the same as an LLM?
No. A transformer is the underlying architecture; an LLM is a large model built using that architecture and trained on massive text data.
Why is attention important in transformers?
Attention lets the model determine which words or tokens are most relevant to each other, which is what allows transformers to understand context and long-range dependencies in text.

Mentioned in the news