Attention kernels, KV heads and long context
hard 6 minLong contexts increase both the work of mixing positions and the size of retained decoding state.
Where it shows up
The same pattern appears across everyday software.
Estimate the KV cache before doubling context
A single sequence is active. The model has 32 layers, 8 KV heads and head dimension 128. Stored cache elements use two bytes. Multiply positions by layers, KV heads, dimension, bytes and two for keys and values. Query head count is irrelevant to this particular cache shape. Doubling context doubles this payload. FlashAttention changes memory traffic for attention computation; it does not make stored history independent of length.