38/42
Part 6 of 6 · Follow-upsLearn

A narrower head keeps its full T × T grid

That's why more heads cost memory but not compute.

C = 768, T = 1,02412 heads24 heads
head size d6432
parameters2,362,3682,362,368
matmul FLOPssamesame
score grids, each T × T1224
score memory, fp3248 MiB96 MiB

A head does 4T2d4T^2d FLOPs for its two matmuls and stores T2T^2 scores. Narrow the head and its compute shrinks, but its score grid doesn't: 1,048,576 scores, 4 MiB in fp32 at T=1024T = 1024, whether dd is 64 or 32.

So going from 12 heads to 24 at the same CC keeps the parameters and the FLOPs, and doubles the score memory.