Qm

Topic · Machine Learning & AI

← All topics

Transformers & Attention

37 articles · 6 checkpoints · 24 deeper reads · 7 reference notes

Every article, in reading order

plant a flag as you finish each

Read these first

  1. Every transformer-based model is built from the same attention block, but the choice of which tokens are allowed to see which other tokens splits models into three families with very different jobs: understanding, generating, and translating.

  2. A single attention lookup can only capture one notion of 'relevant' at a time. Multi-head attention runs several independent attention lookups in parallel, each free to learn a different kind of relationship, then combines what they each found.

  3. Before a language model can do anything useful, it has to be given a self-supervised game to practice on billions of times, the choice of game (guess a hidden word, guess the next word, or guess a missing chunk) shapes what kind of model comes out the other end.

  4. Attention lets a model look up relevant information from anywhere in a sequence, and it does that lookup with three learned projections of the same input: a query describing what you're looking for, a key describing what each item offers, and a value carrying what gets returned when there's a match.

  5. Generating text one token at a time would mean re-processing the entire sentence so far at every single step, unless the model remembers what it already computed, the KV cache is that memory, and it's the difference between a chatbot that's usable and one that isn't.

  6. RoPE tells a transformer where a word sits in a sentence by rotating its vector, so that the angle between two words' vectors after rotation encodes exactly how far apart they are, a trick that lets attention scores depend only on relative position.

Then the rest

Reference notes7 short entries