Jeonghyeon Kim

KV cache

What can a model safely reuse?

Caching follows from causality. Once you understand why an old state cannot see a newly appended token, you can derive the cache layout, position handling, and memory cost yourself.

Read the full explanation →

The article

03

KV cache: what can a model safely reuse?

Derive why old keys and values remain valid, inspect what each layer stores, and prove that cached decoding agrees with a full forward pass.

14 min readEquations and code

Related reading

02

Inside attention, one tensor at a time

Follow a complete decoder through Q, K, V, rotary positions, grouped-query attention, residual connections, and next-token logits. Every shape has a job.

22 min readEquations and code
04

Why modern attention has so many names

Separate head sharing, position, compressed memory, sparse selection, and GPU execution. Then read DeepSeek’s recent designs with those distinctions in mind.

13 min readEquations and code