Chapter 03
KV cache
Keep k and v. Drop q.
Same sequence, same layer. This time we keep what we compute.
01 / 10
Cache size, once
Per token, per sequence, the cache holds one and one for every head in every layer:
Llama-3-8B: bytes, so 128 KB per token, or about 1 GB for an 8k-token context. Grouped-query attention is why rather than the 32 query heads.