Skip to content

Transformer

The foundational architecture of all modern LLMs, based on the attention mechanism. Introduced in 2017 and has since changed everything.

Why Transformer Won

Before 2017, text was processed by recurrent networks (RNN, LSTM), which read words strictly in order — slowly and with loss of distant connections.

Transformer broke this order: it looks at the entire text at once and decides for itself which words to pay attention to.

Attention Mechanism

The key idea is Self-Attention. For each word, the model calculates how strongly it is related to all others.

"The cat drinks milk because it is hungry."

Attention will connect "it" specifically to "cat", not to "milk".

Architecture

Transformer consists of two types of blocks stacked together:

  • Encoder — understands the input (used in BERT, embedders);
  • Decoder — generates the output (used in GPT-like LLM).

Modern LLMs (GPT, DeepSeek, Llama) are decoder-only transformers.

What is Built on Transformer

  • all modern LLM;
  • multimodal models (partially);
  • embedders for RAG.

See Also

← All Terms