The math behind Attention: Keys, Queries, and Values matrices @SerranoAcademy
The math behind Attention: Keys, Queries, and Values matrices  @SerranoAcademy
Uploaded August 2023 | Updated September 2026, 2 weeks ago
Check out the latest (and most visual) video on this topic! The Celestial Mechanics of Attention Mechanisms: youtube.com/watch?v=RFdb2rKAqFw

This is the second of a series of 3 videos where we demystify Transformer models and explain them with visuals and friendly examples.

Video 1: The attention mechanism in high level youtu.be/OxCpWwDCDFQ
Video 2: The attention mechanism with math (this one)
Video 3: Transformer models youtube.com/watch?v=qaWMOYf4ri8

If you like this material, check out LLM University from Cohere!
https://llm.university

00:00 Introduction
01:18 Recap: Embeddings and Context
04:46 Similarity
11:09 Attention
20:46 The Keys and Queries Matrices
25:02 The Values Matrix
28:41 Self and Multi-head attention
33:54: Conclusion
The math behind Attention: Keys, Queries, and Values matricesWill AI help us, or make us dependent? - A Tale of Two CitiesThe covariance matrixGRPO - Group Relative Policy Optimization  - How DeepSeek trains reasoning modelsReinforcement Learning with Human Feedback (RLHF) - How to train and fine-tune Transformer ModelsHow does Netflix recommend movies? Matrix FactorizationWhy do we divide by n-1 to estimate the variance? A visual tour through Bessel correctionMachine Learning: Testing and Error MetricsEigenvectors and Generalized EigenspacesRead papers with Luis - The Illusion (of the illusion) of thinkingWhen is a sequence periodic? The Discrete Fourier Transform will tell usLive chat with Luis Serrano!
Luis Serrano Academy |

The math behind Attention: Keys, Queries, and Values matrices

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER