Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn What Makes Up a Transformer Architecture | Understanding Transformer Foundations
Transformers for Natural Language Processing

bookWhat Makes Up a Transformer Architecture

Swipe to show menu

A Transformer is made up of two main parts: the encoder and the decoder. The encoder reads and summarizes the input text, capturing the meaning and context of each word in relation to the others. The decoder then uses this summary, along with its own attention to previously generated words, to produce the final output - such as a translation or summary. This design enables Transformers to handle a wide range of NLP tasks more efficiently and accurately than traditional approaches.

Note
Definition

Encoder: processes input sequences by summarizing their meaning and capturing relationships between words using self-attention and feed-forward layers.

Decoder: generates output sequences, such as translations or predictions, by attending to both previously generated outputs and the encoder's representations.

The attention mechanism is a core part of the Transformer architecture that allows the model to decide which words in a sequence are most important when processing or generating language. You can think of attention as a way for the model to "focus" on certain words while reading a sentence, much like you might pay extra attention to key words when trying to understand a complex instruction.

For example, in the sentence "The cat sat on the mat because it was tired," attention helps the model figure out that "it" refers to "the cat" by looking at the relationships between words. This process functions regardless of word position, making attention central to how Transformers understand language.

Below is a simplified diagram of the overall Transformer architecture, highlighting the flow of information between the encoder, decoder, and attention mechanisms:

You can see how input text is first embedded and positionally encoded before passing through the encoder stack. The output from the encoder is then fed into the decoder stack, which uses both its own self-attention and the encoder-decoder attention to generate the final output.

Transformers brought several innovations that power today’s most advanced NLP models:

  • Self-attention: captures relationships between all words in a sequence, so the model understands context regardless of word order;
  • Parallel processing: processes every word at the same time, making training and inference much faster;
  • No recurrence or convolution: avoids the limitations of RNNs and CNNs, resulting in a simpler and more scalable design;
  • Positional encoding: gives the model a sense of word order, enabling it to understand sequence structure.

These features make Transformers the backbone of state-of-the-art applications like machine translation and text summarization.

question mark

Which of the following are main components of the Transformer architecture?

Select all correct answers

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 1. Chapter 3
some-alt