A cost model for one transformer's attention. Change any field; numbers update live. Companion to the Attention Mechanisms curriculum.
Convention: a multiply-add = 2 FLOPs. d_h = d_model / n_heads. Softmax and normalization terms are the small non-matmul additions; MLP FLOPs are excluded (this tool isolates attention). Prefill = process all s tokens at once; decode = one new token attending to s cached keys.