Skip to content

Learning path · Transformers & Attention · 16

Transformers

Neural architecture using self-attention to relate all tokens in a sequence—foundation of modern LLMs and many multimodal models.

Why it matters

  • Explains why context length and attention cost dominate design discussions.
  • Clarifies encoder-only vs decoder-only roles in retrieval stacks.
  • Informs when separate embedding models beat generative models.

Key ideas

  • Self-attention
  • Parallel sequence processing
  • Layer stacks

Transformers replaced recurrent networks by letting every token attend to every other token in a layer—capturing long-range dependencies with trainable parallelism. Decoder-only stacks power autoregressive LLMs; encoder stacks produce dense vectors for search. Understanding transformers at a systems level helps you reason about latency (quadratic attention in full attention), memory, and why approximate attention and sliding windows appear in long-context models. You do not need to implement attention by hand, but you should know why doubling context length increases serving cost and memory pressure.

Updated 2026-08-09 · Full learning path