Attention is just matrix multiplication with a few extra steps

cneuralnetwork · x · 2026-11-09

cneuralnetwork walks through multi-head self-attention with a minimal numeric example: 4 tokens, embedding size 8, 2 heads. X (4×8) is projected to Q/K/V, split into heads (2,4,4), then QKᵀ is scaled by √4, softmaxed, multiplied by V, concatenated back to (4×8), and output-projected — one full attention layer, excluding residuals and normalization. The takeaway: attention is essentially matrix multiplication with a few extra steps.

Original post →

More from Research

Research channel →