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.
Trace the example
Follow the evidence through each stage, then test a change in the case.
Estimate the KV cache before doubling context
Request budget
2,048 positions
A single sequence is active. The model has 32 layers, 8 KV heads and head dimension 128. Stored cache elements use two bytes.
The model has 32 query heads and 8 KV heads. Which count enters this cache estimate?
Size one sequence’s cache
32 layers, dimension 128 per head, two bytes per element and one active sequence. Allocator overhead is excluded.