The transformer architecture – sometimes referred to as the transformer neural network or transformer model – is an architecture that endeavors to solve sequence-to-sequence tasks while easily handling long-range dependencies.
Understanding the transformer architecture
The transformer architecture was first proposed by a team of Google researchers in a 2017 paper titled Attention Is All You Need. These models are among the most powerful invented to date and are responsible for a wave of innovation in machine learning.
Indeed, in 2021, Stanford University academics believed transformers (which they called foundation models) had driven a paradigm shift in AI such that the “sheer scale and scope of foundation models over the last few years have stretched our imagination of what is possible.”
The transformer architecture is comprised of a neural network that understands context and meaning by analyzing relationships in sequential data. In the case of natural language processing (NLP), these data are the words in a sentence.
The architecture adopts an encoder-decoder structure. The encoder on the left-hand side of the architecture extracts features from an input sequence, while the decoder on the right uses those features to produce the output sequence.
Note that each step in a transformer model is auto-regressive. This means the previously generated labels are used as additional input to generate subsequent labels.
The evolution of NLP models
Machine learning models that process text must not only compute every word but also determine how the words assemble to form a coherent text. Before transformers, complex recurrent neural networks (RNNs) were the default NLP processors.
RNNs process the first word and then feed it back into the layer that processes the next word. While this method enables the model to keep track of the sentence, it is inefficient and too slow to take advantage of powerful GPUs used for training and inference.
RNNs are also ill-suited to long sequences of text. As the model wades deeper into an excerpt, the effect of the first words in the sentence fades. This is known as the vanishing gradient effect and is especially pronounced when two linked (related) words in a sentence are far apart.
The evolution of RNNs
To detect the subtle ways in which distant words influence and depend on each other in sentences, the transformer architecture utilizes a series of mathematical techniques called self-attention. These so-called “attention mechanisms” make it possible for transformers to track word relations across very long text sequences in both forward and reverse.
Importantly, transformers can also process data sequences in parallel. This enables the speed and capacity of sequential deep learning models to be scaled at rates believed to be impossible just a few years back. Today, around 70% of the AI papers published in Cornell University’s arXiv repository mention transformer models.
Where are transformer architectures used?
Transformer architectures can process speech and text in near real-time and are the foundations of OpenAI’s popular GPT-2 and GPT-3 models. Google and similar platforms also utilize them for user search queries.
Since their introduction in 2017, several transformer variants have emerged and branched out into other industries. Transformers are a critical component of DeepMind’s AlphaFold, a protein structure prediction model used to speed up the therapeutic drug design process.
OpenAI’s source-code generation model Codex is also underpinned by a transformer architecture and they have also replaced convolutional neural networks (CNNs) in the AI field of computer vision.
- The transformer architecture is an architecture that endeavors to solve sequence-to-sequence tasks while easily handling long-range dependencies.
- Machine learning models that process text must not only compute every word but also determine how the words assemble to form a coherent text. Before transformers, complex recurrent neural networks (RNNs) were the default NLP processors. But RNNs are inefficient and too slow to benefit from powerful GPUs.
- Transformers can take advantage of GPUs and process data sequences in parallel. This enables deep learning models to be scaled at rates that have made them useful in other applications such as medical research, source-code generation, and computer vision.
Connected AI Concepts
Deep Learning vs. Machine Learning
OpenAI Organizational Structure
Stability AI Ecosystem
Main Free Guides: