Transformer (machine learning architecture)
A transformer is a neural network architecture, introduced in 2017, that uses a mechanism called self-attention to process sequences of data—such as text—in parallel rather than step-by-step, making it the foundational design behind most modern large language models and many other AI systems.
The transformer is a type of deep learning architecture designed to model relationships within sequential data, most commonly text, but also images, audio, and even biological sequences like proteins. Unlike earlier approaches that processed data one element at a time, transformers use a mechanism called self-attention to weigh the importance of every element in a sequence relative to every other element simultaneously. This allows the model to capture long-range dependencies—such as how a pronoun early in a paragraph relates to a noun much later—more effectively and efficiently than prior methods.
Origins and Key Milestones
The transformer architecture was introduced in the 2017 paper "Attention Is All You Need," written by a team of researchers at Google (Ashish Vaswani and colleagues). The paper proposed discarding the recurrent and convolutional structures that dominated sequence modeling at the time—architectures like recurrent neural networks (RNNs) and long short-term memory networks (LSTMs)—in favor of attention mechanisms alone. This shift proved transformative for practical reasons as much as theoretical ones: because transformers process entire sequences at once rather than step by step, they are far better suited to parallel computation on GPUs and TPUs, allowing much larger models to be trained on much larger datasets in feasible timeframes. Subsequent milestones built rapidly on this foundation, including Google's BERT (2018), a bidirectional transformer for language understanding, and OpenAI's GPT series, which used transformers in a generative, autoregressive form. By the early 2020s, transformer-based models had also expanded beyond text, notably with the Vision Transformer (ViT), which applied the same attention-based approach to image classification.
How It Works
At the core of a transformer is the "attention" operation, which computes, for each element in a sequence, a weighted combination of all other elements based on learned relevance scores. In practice, transformers use "multi-head" attention, running several attention computations in parallel so the model can capture different types of relationships—syntactic, semantic, positional—simultaneously. Because attention itself has no inherent sense of word order, transformers add positional encodings to give the model information about sequence position. The original design paired an encoder, which builds a representation of an input sequence, with a decoder, which generates an output sequence; many later models, including most large language models, use only the decoder portion, trained to predict the next token in a sequence. Layers of attention and simple feed-forward networks are stacked, sometimes dozens or hundreds deep, with the scale of these stacks—along with training data and compute—driving much of the performance gains seen in successive generations of AI models.
Why It Matters
The transformer's significance lies in how directly it enabled the current era of large-scale, general-purpose AI systems. Its parallelizable design made it practical to train models with billions or even trillions of parameters, a scale previously unreachable with recurrent architectures. This scalability underlies the large language models—such as OpenAI's GPT series, Google's Gemini and PaLM lineages, Anthropic's Claude, and Meta's Llama models—that now power chatbots, coding assistants, search tools, and translation systems used by hundreds of millions of people. Transformers have also proven adaptable well beyond language: DeepMind's AlphaFold, which predicts protein structures with notable accuracy, incorporates attention mechanisms derived from transformer research, illustrating the architecture's reach into scientific fields far removed from text processing.
Broader Connections
Transformers sit at the center of the broader story of modern AI, connecting to concepts like machine learning, neural networks, and the "scaling laws" describing how model performance improves with more data, parameters, and compute. They also intersect with ongoing debates in computing about efficiency and cost: standard self-attention becomes computationally expensive as sequence length grows, since cost scales quadratically, motivating active research into more efficient variants such as sparse or linear attention. As AI systems increasingly rely on specialized hardware, cloud computing infrastructure, and enormous training datasets, the transformer architecture remains a common thread linking software design, hardware demand, and the wider public conversation about artificial intelligence's capabilities and limits.