Transformer Attention Explained: What Do Q, K, and V Do?
YUI Explains
0:00 / 0:00
Transformer Attention Explained: What Do Q, K, and V Do?
365 просмотров · 4 нед. назад
YUI Explains
14 подписчиков
365 просмотров · 4 нед. назад
What do queries, keys, and values actually do? Follow a sentence through the attention calculation, from dot products and scaled scores to attention weights and a weighted sum of values. Then compute every position in parallel, apply a causal mask, compare multiple heads, and place the complete calculation inside a GPT-style decoder.
English narration; separate English and Simplified Chinese captions.
CHAPTERS
00:00 Why attention needs Q, K, and V
01:41 How queries and keys produce weights
04:26 How values combine context
06:18 All positions and the causal mask
08:20 Multiple heads and the decoder
The example uses 6 teaching groups and hand-set 2D vectors and matrices. These groups are not a real tokenizer result. Attention weights describe this calculation's weighting of input positions; they are not next-token probabilities or proof of causal importance. The resulting context-vector coordinates are learned features, rather than fixed named meanings.
REFERENCES
Attention Is All You Need — Section 3.2
https://arxiv.org/abs/1706.03762
Language Models are Few-Shot Learners — GPT3 configuration, Table 2.1
https://arxiv.org/abs/2005.14165
Jay Alammar — The Illustrated Transformer
https://jalammar.github.io/illustrate...
Sebastian Raschka — Self-attention from scratch
https://sebastianraschka.com/blog/202...
CREDITS
Original mathematical diagrams and animation. The GPT lesson cover referenced in the opening is an original series graphic.
English narration: Chloe, a Xiaomi MiMo preset synthetic voice. No voice cloning.
Music: "Easy Lemon" by Kevin MacLeod (incompetech.com).
Licensed under Creative Commons: By Attribution 4.0.
https://creativecommons.org/licenses/...
Track: https://incompetech.com/music/royalty...
Music is looped, faded in and out, and lowered beneath the narration.
#Attention #Transformers #QKV