Stanford CME 295 Independent interactive companion
CME 295 Transformers &
Large Language Models
Visit the course website
CME 295 / Interactive cheatsheet

Transformers &
Large Language Models

A concise guide to the ideas behind modern language models. Explore the English cheatsheet, then bring the equations to life with interactive illustrations.

Cheatsheet by Afshine Amidi and Shervine Amidi.

From tokens to contextConceptual illustration
The attention mechanism Token embeddings are projected into query, key and value vectors. Attention uses query-key scores to form a weighted mix of values, producing a contextual representation. tokensbecomevectorswithcontext Token embeddings QKV Scaled dot-product attention Contextual representation
Queries compare with keys. Attention weights mix the values.
English reference / Nine chapters

The cheatsheet

Explore a diagram. Read a concept. Quiz yourself.

Continue learning

Course and reference materials

This independent companion presents selected chapter summaries, interactive diagrams and 108 chapter-quiz questions. The source PDF contains the complete cheatsheet.