Views
No views yet
NVFP4 (native FP4 on Blackwell)lm_headmodelopt)1vllm serve melcheikh/gemma-4-31B-it-qat-NVFP4-Blackwell \
2 --quantization modelopt \
3 --speculative-model melcheikh/gemma-4-31B-it-qat-assistant-NVFP4-Blackwell \
4 --num-speculative-tokens 3 \
5 --speculative-draft-limit 4RuntimeError: start (0) + length (8192) exceeds dimension size (4096).vLLM's MTP (Multi-Token Prediction) loader (gemma4_mtp.py) assumes that the assistant model is not quantized. Because of this, it initializes the MLP (Gemma4MLP) and attention projection (Gemma4MTPAttention) layers with quant_config=None, expecting full-sized weights (e.g., shape [1024, 8192]) instead of the ModelOpt quantized/packed weights (shape [1024, 4096]).vllm package file vllm/model_executor/models/gemma4_mtp.py in your environment:quant_config on the MLP layers:
Locate self.mlp = Gemma4MLP(...) around line 300 and change quant_config=None to quant_config=quant_config.1# Change this:
2self.mlp = Gemma4MLP(
3 hidden_size=self.hidden_size,
4 intermediate_size=text_config.intermediate_size,
5 hidden_activation=text_config.hidden_activation,
6 quant_config=None,
7 prefix=f"{prefix}.mlp",
8)
9
10# To this:
11self.mlp = Gemma4MLP(
12 hidden_size=self.hidden_size,
13 intermediate_size=text_config.intermediate_size,
14 hidden_activation=text_config.hidden_activation,
15 quant_config=quant_config,
16 prefix=f"{prefix}.mlp",
17)quant_config on the attention projection layers:
Locate self.q_proj and self.o_proj inside Gemma4MTPAttention.__init__ around line 185 and change quant_config=None to quant_config=quant_config.1# Change this:
2self.q_proj = ColumnParallelLinear(..., quant_config=None, ...)
3self.o_proj = RowParallelLinear(..., quant_config=None, ...)
4
5# To this:
6self.q_proj = ColumnParallelLinear(..., quant_config=quant_config, ...)
7self.o_proj = RowParallelLinear(..., quant_config=quant_config, ...)--max-num-seqs to 1 to avoid running out of VRAM (CUDA OOM) at longer contexts:1vllm serve melcheikh/gemma-4-31B-it-qat-NVFP4-Blackwell \
2 --quantization modelopt_fp4 \
3 --kv-cache-dtype fp8 --max-model-len 32000 --gpu-memory-utilization 0.97 --max-num-seqs 1 --spec-model melcheikh/gemma-4-31B-it-qat-assistant-NVFP4-Blackwell --spec-tokens 3