Gemma 3n E2B shared-KV sliding window at 32K
Fields
kv-efficiency/gemma3n-e2b-shared-kv-swa-32kNotes
Closes the KV-sharing gap. The collection has sliding-window rows (Gemma 2, Gemma 3, Gemma 4, Mistral) but none where later layers reuse an earlier layers KV instead of allocating their own, and Gemma 3n is the catalog model that does it. TWO REDUCTIONS, KEPT SEPARATE. KV sharing alone is 30/20 = 1.5x, and it is the part that does not depend on context length. The sliding window on the 16 local layers is the rest: at 32,768 tokens the combined effective rate is 17,408 B/token against a naive 61,440, which is 3.53x overall. The window part grows with context and the sharing part does not, so quoting only the 3.53x would overstate the saving at short context. ABSOLUTE: the bf16 cache at 32K is 0.53 GiB instead of 1.88 GiB, which is what lets the E2B hold a 32K context on a 4-6 GB card next to its weights. The catalog model record lists kv_cache_bytes_per_token 61,440, the naive figure, so this row is the effective one. CAVEATS: the config is a mirror (the official file is gated), the first-20-layers reading of num_kv_shared_layers follows the field name and the model record rather than a profiler trace, and no quality cost is stated because both the window and the sharing are trained in. Googles own doc (model-fr-google-gemma-3n-doc) describes per-layer embeddings cached to fast storage, which is a weight-side saving and is not counted here.