Skip to content
inference.academy

glossary/memory/cross-layer-kv-sharing

Cross-layer KV sharing

also cross-layer attention, layer-wise KV reuse, CSA2

Letting several transformer layers attend over one set of keys and values instead of each keeping its own, so the cache shrinks along the layer dimension the way grouped-query attention shrinks it along the head dimension. A layer in reuse mode inherits the previous layer's cache and its sparse selection outright; one in reindex mode inherits the cache but scores its own selection from it. DeepSeek-V4.1-Flash's CSA2 combines this with an encoder-decoder split, where the decoder's global KV is projected from the encoder state, and with 4-bit main KV, which is how it gets a million tokens of context into under a kilobyte per token.


890 B

Of global KV cache per token in HBM for DeepSeek-V4.1-Flash at 1M context, a quarter of V4-Flash's footprint, an eighth once the sliding-window cache is replayed instead of stored.


Related