LLMs, the whole thing
·
Part 7
Trainable self-attention: query, key, value, and a thermostat on the softmax
Section 3.4 of Raschka's book on six tokens with real PyTorch output: three shared learned matrices, eighteen private q/k/v vectors, why d_in is forced, why scores are divided by the square root of d_k, and why 'weights' now means two different things.
3 Sep 2026
·
12 min read
·62 views
LLMs, the whole thing
·
Part 6
Self-attention, from scratch: a context vector is a weighted average
The first attention mechanism in Raschka's LLM book, explained the way it finally clicked for me, a Java dev who bounces off dense maths: self-attention is just three operations, a dot product, a softmax, and a weighted average.
18 Aug 2026
·
9 min read
·138 views