KV caching reduces repeated compute but consumes additional memory.
It does not reduce KV-cache memory — the cache stores keys and values for every prior token.
Attention-work comparison
Metric: Attention score multiplications only.
Not measured latency or FLOPs. Work uses query heads; independent of KV-head count.
Charts
KV-cache memory vs sequence length
Work per generation step (cached vs uncached)
Cumulative work (cached vs uncached)
MHA / GQA / MQA comparison
Same config except KV-head count. Attention-score work stays constant; cache memory scales with KV heads.