Run Unsloth Dynamic NVFP4 Guide | Unsloth Documentation
Blog

Run Unsloth Dynamic NVFP4 Guide | Unsloth Documentation

2026.07.16
·Web·by Homin.Lee
#LLM#NVFP4#NVIDIA#Quantization#Unsloth

Key Points

  • 1Unsloth Dynamic NVFP4 utilizes a W4A4 quantization format on NVIDIA Blackwell GPUs to achieve up to 2.5x faster inference speeds compared to traditional methods by selectively maintaining high-precision layers.
  • 2This approach outperforms standard MXFP4 by employing superior block sizing and FP8-based scaling factors, ensuring model accuracy is preserved across complex benchmarks for models like Gemma 4 and Qwen3.6.
  • 3Users can optimize deployment by leveraging vLLM or SGLang with recommended kernels like cute-DSL, while benefiting from FP8 KV cache calibration that facilitates significantly longer context lengths.

Unsloth Dynamic NVFP4 is an optimized quantization framework engineered specifically for NVIDIA Blackwell GPU architectures (e.g., B200, RTX 50-series) to facilitate high-speed, 4-bit model inference. By utilizing W4A4 (4-bit weights, 4-bit activations) rather than conventional W4A16 formats, this methodology leverages the Blackwell GPU's native FP4 tensor cores to achieve up to 2.5× faster inference speeds compared to standard 4-bit implementations.

Core Methodology

The framework moves beyond uniform quantization by employing "Unsloth Dynamic 2.0" quantization. Instead of enforcing FP4 across the entire model architecture, the system selectively preserves critical layers in FP8 (W8A8) or BF16 precision, while applying W4A4 to the remaining layers. This selective precision maintains model accuracy while maximizing hardware utilization.

The technical superiority of NVFP4 over the existing MXFP4 standard is attributed to two primary factors:

  1. Granularity: NVFP4 utilizes a block size of 16, whereas MXFP4 utilizes 32. Smaller block sizes allow for more effective isolation of outliers and provide scaling factors for smaller weight subsets.
  2. Scaling Logic: NVFP4 replaces the E8M0 (powers of 2) scaling used in MXFP4 with an E4M3 (FP8) scale, providing superior numerical representation for LLM weights.

The performance gains are grounded in the theoretical reduction of transistor space requirements for matrix multiplications. Given the mantissa bit-depth relationship, where space is related to the square of the mantissa (m2+em^2 + e), the model architecture reduces computational density requirements significantly compared to FP32:

  • FP32: 232+8=53723^2 + 8 = 537 units of space.
  • Bfloat16: 72+8=577^2 + 8 = 57 units of space (≈9×\approx 9\times reduction).
  • Float8: 32+4=133^2 + 4 = 13 units of space (≈41×\approx 41\times reduction).
  • Float4: 12+2=31^2 + 2 = 3 units of space (≈179×\approx 179\times reduction).

Performance and Implementation

Unsloth provides specific quantizations for models including Gemma 4 and Qwen3.6. These models incorporate MTP (Multi-Token Prediction) tensors and utilize FP8 KV cache calibration, which enables a 2× increase in context length capacity.

Inference performance is highly dependent on backend selection. The research highlights that standard kernels like Marlin exhibit significant performance degradation (up to 2.5× slower) for W4A4 operations. Users are instructed to rely on optimized backends such as cute-DSL, cutlass, or flashinfer_trtllm (auto-selected by vLLM or SGLang) to achieve the reported speed benchmarks. Additionally, specific configurations for DGX Spark systems (e.g., --moe-backend flashinfer_b12x) are required to prevent performance bottlenecks in MoE (Mixture of Experts) model variants.