Skip to content

skip kv cache allocation for kv-shared layers - #1012

Merged
copybara-service[bot] merged 1 commit into
google:devfrom
RaviTriv:skip-shared-kv-alloc
Sep 4, 2026
Merged

skip kv cache allocation for kv-shared layers#1012
copybara-service[bot] merged 1 commit into
google:devfrom
RaviTriv:skip-shared-kv-alloc

Conversation

@RaviTriv

@RaviTriv RaviTriv commented Sep 4, 2026

Copy link
Copy Markdown

Gemma4 has cross layer attention :). PR to reduce some memory allocation by skipping layers which will not need KV Cache allocated. Reducing allocation by 20 layers for Gemma4-2B , about 57% of KV cache

@RaviTriv
RaviTriv marked this pull request as ready for review September 4, 2026 02:36

@jan-wassenberg jan-wassenberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, makes sense.

@jan-wassenberg jan-wassenberg added the copybara-import Trigger Copybara for merging pull requests label Sep 4, 2026
@copybara-service
copybara-service Bot merged commit 1658f88 into google:dev Sep 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copybara-import Trigger Copybara for merging pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants