Z-Image NVFP4 Efficient Inference: The 4-bit Quantization Revolution on Blackwell GPUs

7月 19, 2026

Z-Image NVFP4 Efficient Inference: The 4-bit Quantization Revolution on Blackwell GPUs

NVFP4 is NVIDIA's 4-bit floating-point format designed for high-performance inference on Blackwell architecture. Combined with Z-Image models, NVFP4 quantization can reduce VRAM usage by 60–70% and increase inference speed by 80–100% with virtually no quality loss. This comprehensive guide covers the principles, deployment methods, and performance data of Z-Image NVFP4 quantization.

What is NVFP4?

NVFP4 (NVIDIA 4-bit Floating Point) is a 4-bit floating-point quantization format introduced alongside NVIDIA's Blackwell GPUs. Using an E2M1 structure (1 sign bit + 2 exponent bits + 1 mantissa bit), it achieves an excellent balance between ultra-low precision quantization and numerical accuracy.

Format Comparison:

Format Bit Width VRAM Savings (vs BF16) Quality Loss
BF16 16-bit Baseline None
FP8 8-bit ~50% Minimal
GGUF Q8 8-bit ~50% Minimal
NVFP4 4-bit ~75% Minimal (cos ≈ 0.99)

Key Advantages

  • Dramatic VRAM reduction: Z-Image Turbo BF16 ~23 GB peak → NVFP4 ~10 GB
  • Resident memory: 7.5 GB resident, deployable on DGX Spark (GB10)
  • Double speed: FP4 kernels achieve ~2x throughput of FP8 on Blackwell
  • Quality preservation: ~0.99 cosine similarity vs BF16 baseline

Z-Image NVFP4 Model Variants

The community has released multiple NVFP4 variants offering different quality/size trade-offs:

Z-Image Base NVFP4 (by marcorez8 on HuggingFace)

Variant NVFP4 Layers BF16 Preserved Size Quality
Ultra 60 Attention + layers 0-4 & 25-29 ~8.0 GB ⭐⭐⭐⭐⭐
Quality 90 All Attention (qkv, out) ~6.5 GB ⭐⭐⭐
Mixed 180 Refiners, embedders, final layer ~4.5 GB
Full 204 Only critical embedders ~3.5 GB

Original BF16 model size: 12.3 GB

Key Insight: Attention layers (qkv, out) are significantly more sensitive to quantization than feed-forward layers (w1, w2, w3), which can be safely quantized to NVFP4 with minimal quality impact.

Performance Benchmarks

SECourses Benchmark Data (January 2026)

Tested on RTX 5090 and RTX 6000 Blackwell at 2048px resolution:

Model Precision Speed VRAM Quality
Z-Image Turbo BF16 Baseline ~23 GB ⭐⭐⭐⭐⭐
Z-Image Turbo GGUF Q8 87% faster ~12 GB ⭐⭐⭐⭐
Z-Image Turbo NVFP4 87% faster ~10 GB ⭐⭐⭐⭐
Z-Image Turbo FP8 Scaled 30% faster ~14 GB ⭐⭐⭐⭐⭐

NVFP4 achieves 87% speed improvement on Z-Image Turbo while reducing VRAM to 10 GB.

DGX Spark (GB10) Real-World Data

From the NVIDIA Developer Forums, a real deployment on DGX Spark:

Metric Value
Peak VRAM (NVFP4) ~10 GB
Resident memory ~7.5 GB
Inference time (1024², 8 steps) ~19 seconds
Quality (cos vs BF16) ~0.99
GPU NVIDIA GB10 (SM 12.1)
Software Stack PyTorch 2.11.0 + diffusers git + comfy-kitchen

Deployment Methods

Method 1: ComfyUI Direct Loading (Beginner-Friendly)

  1. Download the desired NVFP4 variant safetensors file
  2. Place in ComfyUI models/checkpoints/ directory
  3. Recommended settings:
    • Z-Image Base: Steps 28–50, CFG 3.0–5.0
    • Z-Image Turbo: Steps 8, CFG ~1.0

Method 2: Diffusers + comfy-kitchen (Advanced)

For users who need a ComfyUI-free environment with direct HuggingFace Diffusers integration:

# Environment setup
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install torch==2.11.0 torchvision --index-url https://download.pytorch.org/whl/cu130

# Install diffusers git main (native Z-Image support)
uv pip install "diffusers @ git+https://github.com/huggingface/diffusers"
uv pip install transformers accelerate safetensors

# Install comfy-kitchen (NVFP4 kernels)
sudo apt install -y python3.12-dev
uv pip install "setuptools>=61" wheel "nanobind>=2.0.0" cmake ninja
git clone https://github.com/comfy-org/comfy-kitchen
cd comfy-kitchen
PATH="$VIRTUAL_ENV/bin:$PATH" uv pip install -e ".[cublas]" --no-build-isolation

Weight Quantization Code:

from diffusers import ZImagePipeline
from comfy_kitchen.tensor import QuantizedTensor
import torch

# Load BF16 baseline
pipe = ZImagePipeline.from_pretrained(
    "Tongyi-MAI/Z-Image-Turbo",
    torch_dtype=torch.bfloat16
).to("cuda")

# Quantize each Linear layer to NVFP4
for name, module in pipe.transformer.named_modules():
    if isinstance(module, torch.nn.Linear) and hasattr(module, 'weight'):
        qw = QuantizedTensor.from_float(
            module.weight.data,
            "TensorCoreNVFP4Layout"
        )
        module.weight.data = qw

# Inference with dynamic activation quantization
img = pipe(
    "a grey heron at dusk",
    num_inference_steps=8,
    guidance_scale=1.0,
    height=1024,
    width=1024
).images[0]

Method 3: nunchaku Kernel (Blackwell 50-Series Optimized)

For RTX 5090/5080 users, nunchaku provides specially optimized FP4 kernels:

pip install nunchaku

This can reduce Z-Image Turbo generation time for 1024×1536 images from 30 seconds to approximately 6 seconds on 50-series GPUs.

Important Caveats

GGUF File Compatibility Trap

Pre-quantized GGUF files (e.g., leejet/Z-Image-Turbo-GGUF) will NOT load with diffusers. These files use the original Z-Image layout (dim 2160, fused qkv), while diffusers' ZImageTransformer2DModel uses dim 3840 with split to_q/k/v projections. Name mapping is correct but shape mismatches prevent loading.

Solution: Quantize native diffusers weights directly to NVFP4 rather than attempting GGUF conversion.

Hardware Requirements

Hardware NVFP4 Support Notes
NVIDIA Blackwell (RTX 5090, 5080, GB10, B200) ✅ Full Native FP4 hardware support
NVIDIA Hopper (H100, H200) ⚠️ Partial Falls back through cuBLASLt
NVIDIA Ada Lovelace (RTX 4090, 4080) ❌ Not supported Use BF16 or GGUF
Other GPUs ❌ Not supported Consider GGUF or AWQ quantization

Version Compatibility

Verified working versions (as of May 2026):

  • torch 2.11.0+cu130
  • diffusers 0.39.0.dev0 (git)
  • transformers 5.9.0
  • comfy-kitchen 0.2.10
  • nvcc 13.0.88

Conclusion

NVFP4 quantization represents the cutting edge of Z-Image model inference efficiency. For Blackwell GPU users, NVFP4 offers near-lossless quality, nearly double the speed, and only 40% of the VRAM usage compared to BF16. This makes running Z-Image on low-power devices like DGX Spark a reality, while also enabling RTX 5090 users to experience sub-second generation.

Whether you're looking to run models in a VRAM-constrained environment or maximize generation throughput, NVFP4 is a technology that every Z-Image user should consider in 2026.

Z-Image Team