NVFP4 QAT (Quantization-Aware Training) in verl
Last updated: 04/02/2026
verl supports NVFP4 Quantization-Aware Training (QAT), which applies fake quantization during training so the model learns to tolerate NVFP4 quantization error. At rollout time, weights are packed into real NVFP4 format for vLLM inference. This closes the precision gap between training and inference, preventing KL divergence explosion.
Training Backend |
Training Precision |
Rollout Precision |
vLLM Quant Method |
|---|---|---|---|
FSDP |
BF16 + fake quantization |
NVFP4 W4A16 |
|
Megatron |
BF16 + fake quantization |
NVFP4 W4A16 |
|
[!TIP] For ready-to-run scripts, environment setup, and experimental results, see the QAT recipe.
Key Configuration
FSDP Backend
Configured under actor_rollout_ref.actor.fsdp_config.qat:
actor_rollout_ref:
actor:
fsdp_config:
qat:
enable: true
mode: "w4a16"
group_size: 16
ignore_patterns:
- "lm_head"
- "embed_tokens"
- "re:.*mlp.gate$"
quantization_config_path: "recipe/qat/config/nvfp4_w4a16.json"
Parameter |
Description |
Default |
|---|---|---|
|
Enable QAT |
|
|
Quantization mode |
|
|
Quantization group size |
|
|
Layers to skip. Supports |
|
|
vLLM quantization config JSON path |
Required |
Megatron Backend
Configured under actor_rollout_ref.actor.megatron.qat:
actor_rollout_ref:
actor:
megatron:
qat:
enable: true
mode: "w4a16"
group_size: 16
ignore_patterns:
- "lm_head"
- "*mlp.gate"
quantization_config_path: "recipe/qat/config/nvfp4_w4a16_megatron.json"
Parameter |
Description |
Default |
|---|---|---|
|
Enable QAT |
|
|
Quantization mode |
|
|
Quantization group size |
|
|
Layers to skip. Uses |
|
|
vLLM quantization config JSON path |
Required |
Support Matrix
NVFP4 W4A16 (weight-only FP4 quantization)
Dense models and MoE models
FSDP and Megatron training backends
Full quantization and FFN-only quantization strategies
Verified on Qwen3-8B-Base and Qwen3-30B-A3B-Base
Notes
FSDP backend has scalability limitations for very large models. For large-scale training, use the Megatron backend.
FSDP uses
re:prefix regex forignore_patterns, while Megatron usesfnmatchglob syntax. The two are not interchangeable.