Your current environment
The output of python collect_env.py
Use the builtin dockerfile to build & manually merge PR https://github.com/vllm-project/vllm/pull/39018 for turing devices base compatibility
Main commit hash:726efe177bf22874743d11dfdfef9247dbfb5ff0
🐛 Describe the bug
Gemma 4 fails to initialize in vLLM V1 when --kv_cache_dtype int8_per_token_head is enabled. The same issue also affects fp8_per_token_head.
The failure is caused by Gemma 4's hybrid attention layout using two different KV head dimensions:
- sliding/local layers use
head_dim = 256
- global/full-attention layers use
head_dim = 512
With per-token-head KV quantization, each KV head also stores scale metadata per token. That extra scale payload breaks the exact 2:1 page-size ratio between the 512-dim and 256-dim layers, so V1 KV page-size unification fails during initialization.
Minimal reproduction:
vllm serve <gemma4-model> \
--kv_cache_dtype int8_per_token_head
Observed result:
(Worker_TP1 pid=248) ERROR 04-19 14:16:08 [multiproc_executor.py:971] File "/usr/local/lib/python3.12/dist-packages/vllm/v1/core/kv_cache_utils.py", line 942, in unify_kv_cache_spec_page_size
(Worker_TP1 pid=248) ERROR 04-19 14:16:08 [multiproc_executor.py:971] raise NotImplementedError(
(Worker_TP1 pid=248) ERROR 04-19 14:16:08 [multiproc_executor.py:971] NotImplementedError: The page size of the layer is not divisible by the maximum page size. Cannot unify by adjusting block_size.
Why this happens:
- local layer page-size factor:
(256 * 1 byte * 2) + 8 = 520
- global layer page-size factor:
(512 * 1 byte * 2) + 8 = 1032
1032 is not divisible by 520, so the current page-size unification logic cannot reconcile the two layer types by changing block_size alone.
Relevant code paths:
vllm/model_executor/models/gemma4.py
vllm/model_executor/layers/attention/attention.py
vllm/v1/core/kv_cache_utils.py
vllm/v1/kv_cache_interface.py
vllm/v1/worker/gpu/attn_utils.py
vllm/v1/worker/gpu_model_runner.py
Environment
| Item |
Value |
| Commit |
726efe177bf22874743d11dfdfef9247dbfb5ff0 |
| GPU |
2× NVIDIA GeForce RTX 2080 Ti (22 GB, CC 7.5, Turing) |
| CUDA Driver |
580.126.18, CUDA 13.0 |
| Python |
3.12 (Docker) |
| Model |
Gemma4-31B AWQ 4-bit (google/gemma-4-31b-it), also reproduced with cyankiwi/gemma-4-31B-it-AWQ-4bit |
I'm still new to this project, so if this report doesn't match the community's preferred format or I've misunderstood something basic, corrections are very welcome.
Potential direction for a fix:
I want to post a temporary workaround PR later for reference later, which as I tested, can solve this problem. But it certainly needs more review and discussion.
Before submitting a new issue...
Your current environment
The output of
python collect_env.py🐛 Describe the bug
Gemma 4 fails to initialize in vLLM V1 when
--kv_cache_dtype int8_per_token_headis enabled. The same issue also affectsfp8_per_token_head.The failure is caused by Gemma 4's hybrid attention layout using two different KV head dimensions:
head_dim = 256head_dim = 512With per-token-head KV quantization, each KV head also stores scale metadata per token. That extra scale payload breaks the exact 2:1 page-size ratio between the 512-dim and 256-dim layers, so V1 KV page-size unification fails during initialization.
Minimal reproduction:
Observed result:
Why this happens:
(256 * 1 byte * 2) + 8 = 520(512 * 1 byte * 2) + 8 = 10321032is not divisible by520, so the current page-size unification logic cannot reconcile the two layer types by changingblock_sizealone.Relevant code paths:
vllm/model_executor/models/gemma4.pyvllm/model_executor/layers/attention/attention.pyvllm/v1/core/kv_cache_utils.pyvllm/v1/kv_cache_interface.pyvllm/v1/worker/gpu/attn_utils.pyvllm/v1/worker/gpu_model_runner.pyEnvironment
726efe177bf22874743d11dfdfef9247dbfb5ff0google/gemma-4-31b-it), also reproduced withcyankiwi/gemma-4-31B-it-AWQ-4bitI'm still new to this project, so if this report doesn't match the community's preferred format or I've misunderstood something basic, corrections are very welcome.
Potential direction for a fix:
I want to post a temporary workaround PR later for reference later, which as I tested, can solve this problem. But it certainly needs more review and discussion.
Before submitting a new issue...