vllm - 💡(How to fix) Fix [Performance]: Massive increase (~10x) in KV Cache capacity for Gemma 4 in v0.21.0

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

The output of `python collect_env.py`
RAW_BUFFERClick to expand / collapse

Proposal to improve performance

No response

Report of performance regression

No response

Misc discussion on performance

Obersvation While testing Gemma 4 (specifically using cyankiwi/gemma-4-31B-it-AWQ-4bit) on an A100 80GB, I observed a massive increase in available KV cache capacity between vLLM v0.20.0 and v0.21.0.

Comparison Data Using the same args and --gpu-memory-utilization 0.9:

vLLM VersionGPU KV Cache SizeMemory Cost per Token
v0.20.0~55k tokensHigh
v0.21.0~525k tokensLow (~9.5x reduction)

Total available KV cache memory remained constant (~50 GB), indicating the efficiency gain is per token.

Technical Analysis Gemma 4 utilizes several advanced memory-saving features:

  1. Alternating Attention: Mix of local sliding-window layers (1024 tokens) and global full-context layers.
  2. Shared KV Cache: The last $N$ layers reuse KV states from earlier layers.
  3. Dual RoPE: Standard RoPE for sliding layers and pruned RoPE for global layers. (Source: Hugging Face Blog)

It appears that in v0.20.0, the memory profiler may have been treating all layers as global and non-shared, leading to massive over-allocation. In v0.21.0, vLLM seems to correctly recognize the sliding-window budget and shared KV states, unlocking the actual capacity of the architecture.

Request This is a massive win for performance and deployment density. I suggest documenting this improvement in the release notes or the model support page so users know to upgrade for Gemma 4.

Suggested wording

Users upgrading from vLLM v0.20.0 to v0.21.0 will notice a significant increase in available KV cache capacity for Gemma 4 (roughly 9.5x). This is due to optimized support for Gemma 4's unique architecture, including alternating sliding-window attention and shared KV states, which drastically reduces the memory cost per token.

Your current environment (if you think it is necessary)

The output of `python collect_env.py`

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING