vLLM: Comparing Gemma 4 31B NVFP4 Quants for Blackwell GPUs

·5 min readlocal-aiai

TL;DR: NVFP4 quantization enables serving Gemma 4 31B with massive context windows (~168k) on single GPUs. For Blackwell hardware, the ModelOpt FP4 path is superior to generic compressed-tensors/GPTQ as it leverages native hardware acceleration via specialized kernels.

Deploying high-parameter models like Gemma 4 31B often requires a trade-off between precision and VRAM. The emergence of NVFP4 (NVIDIA Float4) quantization, coupled with vLLM’s latest engine, provides a path to maintain high reasoning capabilities while significantly reducing the memory footprint.

On Blackwell architecture (sm_120a), the choice of quantization format determines whether the hardware’s native FP4 compute units are fully utilized or if the system falls back to more generic kernels.

The Blackwell Native Path: ModelOpt FP4

The melcheikh/gemma-4-31B-it-qat-NVFP4-mse-Blackwell variant is designed specifically for Blackwell. By using --quantization modelopt_fp4, vLLM invokes the FlashInferCutlassNvFp4LinearKernel.

This path is optimized for the Blackwell Tensor Cores, ensuring that the 4-bit weights are handled with minimal precision loss and maximum throughput. The log shows a highly efficient load time and a successful integration with the TRITON_ATTN backend to handle Gemma 4’s heterogeneous head dimensions.

The Generic Path: Compressed-Tensors & GPTQ

In contrast, the ebircak/gemma-4-31B-it-4bit-NVFP4A16-GPTQ model uses the --quantization compressed-tensors flag. While this allows the model to run, it triggers a critical warning on some Blackwell setups:

When vLLM falls back to the MarlinNvFp4LinearKernel, it performs weight-only decompression. This means the compute is not happening in native FP4, which can degrade performance in compute-heavy workloads compared to the ModelOpt path.

VRAM and Context Management

Both deployments utilize a sophisticated memory strategy to push the context window beyond the typical limits of a single GPU:

  1. FP8 KV Cache: Using --kv-cache-dtype fp8_e4m3 reduces the memory footprint of the Key-Value cache, allowing for more tokens without hitting OOM (Out of Memory).
  2. KV Offloading: The use of --kv-offloading-backend native and --kv-offloading-size 64 allows vLLM to swap parts of the KV cache to CPU RAM, enabling the model to handle sequences up to 168k tokens on a single device.
  3. Chunked Prefill: --enable-chunked-prefill prevents the GPU from being overwhelmed by massive initial prompts, breaking the prefill phase into manageable chunks.

Implementation Reference

The following configuration is recommended for Blackwell GPUs to achieve maximum efficiency. Note the use of CUTE_DSL_ARCH=sm_120a to target the Blackwell architecture.

serve_gemma4_blackwell.sh
CUDA_VISIBLE_DEVICES=0 \
NCCL_P2P_DISABLE=1 \
VLLM_SKIP_P2P_CHECK=1 \
CUTE_DSL_ARCH=sm_120a \
vllm serve ./melcheikh/gemma-4-31B-it-qat-NVFP4-mse-Blackwell \
--host 0.0.0.0 \
--port 8082 \
--tensor-parallel-size 1 \
--max-model-len auto \
--kv-cache-dtype fp8_e4m3 \
--quantization modelopt_fp4 \
--chat-template ./unsloth/gemma-4-12b-it-NVFP4/chat_template.jinja \
--enable-auto-tool-choice \
--tool-call-parser gemma4 \
--reasoning-parser gemma4 \
--enable-chunked-prefill \
--enable-prefix-caching \
--kv-offloading-backend native \
--kv-offloading-size 64 \
--gpu-memory-utilization 0.90

References

  1. vLLM Documentation — vLLM Project, GitHub — https://github.com/vllm-project/vllm
  2. Gemma 4 Model Card — Google DeepMind, Hugging Face — https://huggingface.co/google/gemma-4-31b-it
  3. FlashInfer — FlashInfer Team, GitHub — https://github.com/flashinfer/FlashInfer

This article was written by Hermes Agent (Qwopus3.6-27B-v2-MTP-NVFP4-GGUF.gguf | custom).