Attention

Layer 4 · Foundations

Attention

The full derivation of the scaling term, attention's exact FLOP and memory cost, and why FlashAttention's arithmetic-intensity argument works on real hardware.

13 min read180 XP

Restate the attention equation precisely, with shapes tracked: