Concept · one node in the graph
The Transformer
Attention Is All You Need · 2017
One idea, attention, replaced recurrence and became the architecture behind every modern LLM, vision model, and agent. Here is where it was born, how it works, what it became, and how it breaks.
Part of: PAPERS-01 · Transformers & Large Language Models, AIM-02 · Deep Learning, AIM-03 · LLMs & Transformers, PAPERS-02 · Computer Vision, How Machines Learned to See, AIM-05 · Reinforcement Learning, AIM-06 · Agentic AI, CYBER-01 · Security Foundations, LEAD-01 · Agentic AI, Foundations
Play it live
Interactive, in-browser playgrounds for this concept.
- Softmax: Turn raw scores into probabilities, and watch temperature sharpen or flatten the odds.
- Top-k & Top-p (Nucleus) Sampling: Chop the unreliable tail two ways, a fixed k, or an adaptive nucleus, and watch which keeps its head when the model gets unsure.
- Beam Search vs Greedy: Greedy grabs the top word and loses; widen the beam and find the better sentence.
- Beam Search Playground: Watch beam search decode a language model. Greedy grabs the single best word and gets stuck; beam search keeps several candidates alive, branching and pruning by total probability, and finds a more likely sentence greedy missed. Slide the beam width.
- Attention: See exactly which words a transformer “looks at” as it reads a sentence.
- Attention Playground: See the attention matrix that powers every transformer. Type a sentence and watch each word decide how much to look at every other word via scaled dot-product softmax. Hover a row; slide the temperature to sharpen the focus.
- RoPE Playground: See how Rotary Positional Embeddings give a transformer a sense of position by rotating query and key vectors by their position, no learned position table. The payoff, shown live: the attention score depends only on the RELATIVE distance between tokens, so move the query and the whole pattern slides with it.
- Mixture-of-Experts Playground: See how a Mixture-of-Experts model routes each token to a few specialist experts. A gating network picks the top-k per token, but left alone it overloads a few and starves the rest. Watch the routing grid + load bars, then slide load-balancing on to even it out.
- Speculative Decoding Playground: See how a small draft model makes a big model generate 2–4× faster, with provably identical output. The draft guesses the next few tokens, the target verifies them in one pass, and the emitted-token distribution locks onto the target's exactly, no matter how weak the draft. Dial draft quality and speculation length and watch the speedup.
- LoRA Playground: See why LoRA works: a full fine-tuning weight update ΔW is approximated by two skinny low-rank matrices B·A. Slide the rank to watch the reconstruction sharpen, and read the singular-value spectrum to see why real fine-tuning updates are low-rank, so a tiny adapter recovers almost all of ΔW at a fraction of the parameters.
The idea · Research
Where it was born, the 2017 paper that dropped recurrence for pure attention, and the work that led to it.
Learn it · Understand
The mechanics, one concept at a time, from tokens to the full transformer block.
- Attention (Intro) (primer, AIM-02-017-P)
- Tokenization (primer, AIM-03-001-P)
- Positional Encoding (primer, AIM-03-003-P)
- Self-Attention: Q, K, V (primer, AIM-03-004-P)
- Scaled Dot-Product Attention (primer, AIM-03-005-P)
- Multi-Head Attention (primer, AIM-03-006-P)
- The Feed-Forward Network (primer, AIM-03-007-P)
- The Transformer Block (primer, AIM-03-009-P)
Build it · Implement
Implement attention and a transformer block yourself, in the browser, no setup.
What it became · Lineage
The family it spawned, bidirectional (BERT), generative (GPT), few-shot, aligned (RLHF), vision (ViT), and agents.
When it breaks · Failure
Give a model text and tools, and text itself becomes a command surface. A real incident.
How we defend it · Recovery
The security discipline the transformer created, prompt injection, guardrails, and safe autonomy.
Distill it · Pattern
The one-page reference to keep.