Skip to content
IJK

Gemma 3 KV Cache: Interleaved Local and Global Layers

By IJK ·

What a Hugging Face post says Gemma 3 does to manage the KV Cache, how it interleaves layers and what the memory savings cost.

How the KV Cache is managed

KV Cache management is optimized using Gemma 2’s sliding window interleaved attention. [1]

How layers interleave

Hyperparameters are tuned to interleave 5 local layers with 1 global layer (previously 1:1) and reduce the window size to 1024 tokens (down from 4096). [2]

tuned asgivesKV Cache managementoptimized using Gemma 2's sliding window interlea...5 local layers per 1 global layerwindow size reduced to 1024 tokens from 4096Memory savingsachieved without degrading perplexity
How does Gemma 3 save KV cache memory?

What the savings cost

Crucially, memory savings are achieved without degrading perplexity. [3]

Sources

  1. The Hugging Face source says: KV Cache management is optimized using Gemma 2’s sliding window interleaved attention. Welcome Gemma 3
  2. The Hugging Face source says: Hyperparameters are tuned to interleave 5 local layers with 1 global layer (previously 1:1) and reduce the window size to 1024 tokens (down from 4096). Welcome Gemma 3
  3. The Hugging Face source says: Crucially, memory savings are achieved without degrading perplexity. Welcome Gemma 3

Editorial (AI-assisted; automatically checked, not human-reviewed). Each statement is linked to its source; check the source before relying on a detail.

  • gemma 3
  • kv cache
  • attention
  • hugging face