AI fundamentals

← Back to notes & projects

Understanding Attention Is All You Need in 7 Diagrams

Seven diagrams connect matrix multiplication, Transformer encoding, attention, and token-by-token generation.

Matrix multiplication

Transformer overview

Input, embeddings and positional encoding

How attention combines information

Encoder and feed-forward network

Decoder, masking and cross-attention

Predicting the next token

The paper’s main contributions

Original post on Xiaohongshu

I’d read plenty of other explanations and could follow queries, keys, and values. But when I got to the paper, I suddenly found gaps everywhere. Every symbol looked like it was written in another language. It had been a long time since I’d felt so completely lost for lack of background knowledge.

Most of the work was filling in what the authors took for granted, their “common sense.” Those assumptions had so little in common with the way I already understood the world that I felt, deep down, that I didn’t get it.

Going from feeling that I understood none of it to feeling that I got it was really a process of building up the same common sense as the authors. I still need hands-on experience with training and have some details to fill in, but I now feel confident that I could write a tokenizer and a Transformer from scratch.

It reminded me of the moment I first understood how to generate a bias voltage in an analog circuit. It felt like pushing open a door. The world in textbooks and papers finally connected with my own. That moment was more than a decade ago, and it feels like yesterday.