--- title: "Quantization" tag: "approx" metatags: description: "SGLang-Diffusion supports quantized transformer checkpoints. In most cases, keep the base model and the quantized transformer override separate." --- SGLang-Diffusion supports quantized transformer checkpoints. In most cases, keep the base model and the quantized transformer override separate. ## Quick Reference Use these paths: - `--model-path`: the base or original model - `--transformer-path`: a quantized transformers-style transformer component directory that already contains its own `config.json` - `--transformer-weights-path`: quantized transformer weights provided as a single safetensors file, a sharded safetensors directory, a local path, or a Hugging Face repo ID - `--quantization`: apply online quantization to unquantized models at load time (activations are quantized dynamically) - `--quantization-ignored-layers` layer name patterns to keep unquantized (e.g. `attention.to_`) Recommended example for pre-quantized checkpoints: ```bash sglang generate \ --model-path black-forest-labs/FLUX.2-dev \ --transformer-weights-path black-forest-labs/FLUX.2-dev-NVFP4 \ --prompt "a curious pikachu" ``` For quantized transformers-style transformer component folders: ```bash sglang generate \ --model-path /path/to/base-model \ --transformer-path /path/to/quantized-transformer \ --prompt "A Logo With Bold Large Text: SGL Diffusion" ``` NOTE: Some model-specific integrations also accept a quantized repo or local directory directly as `--model-path`, but that is a compatibility path. If a repo contains multiple candidate checkpoints, pass `--transformer-weights-path` explicitly. ## Quant Families Here, `quant_family` means a checkpoint and loading family with shared CLI usage and loader behavior. It is not just the numeric precision or a kernel backend.
| quant_family | checkpoint form | canonical CLI | supported models | extra dependency | platform / notes |
|---|---|---|---|---|---|
fp8 / mxfp4 (online quantization) |
Unquantized checkpoint (offline via AMD Quark coming soon) | --quantization {fp8,mxfp4} |
Z-Image-Turbo (validated), others likely work. More support coming soon. | MXFP4: aiter on ROCm |
MXFP4 requires ROCm and MI350+ (gfx95x). Weights quantized at load time, activations quantized to fp8 / mxfp4 dynamically. |
fp8 (offline quantization) |
Quantized transformer component folder, or safetensors with quantization_config metadata |
--transformer-path or --transformer-weights-path |
ALL | None | Component-folder and single-file flows are both supported |
modelopt-fp8 |
Converted ModelOpt FP8 transformer directory or repo with config.json |
--transformer-path |
FLUX.1, FLUX.2, Wan2.2, HunyuanVideo, Qwen Image, Qwen Image Edit | None | Serialized config stays quant_method=modelopt with quant_algo=FP8; dit_layerwise_offload is supported and dit_cpu_offload stays disabled |
modelopt-nvfp4 |
Mixed transformer directory/repo with config.json, raw NVFP4 safetensors export/repo, or full ModelOpt Diffusers repo |
--transformer-path for mixed overrides; --transformer-weights-path for raw exports; --model-path for full repos |
FLUX.1, FLUX.2, Wan2.2, Qwen Image, Qwen Image 2512, Qwen Image Edit, Qwen Image Edit 2511 | None | Mixed override repos keep the base model separate; full Qwen Image exports can be loaded directly as --model-path; raw exports such as black-forest-labs/FLUX.2-dev-NVFP4 still use the weights-path flow |
nunchaku-svdq |
Pre-quantized Nunchaku transformer weights, usually named svdq-{int4\|fp4}_r{rank}-... |
--transformer-weights-path |
Model-specific support such as Qwen-Image, FLUX, and Z-Image | nunchaku |
SGLang can infer precision and rank from the filename and supports both int4 and nvfp4 |
msmodelslim |
Pre-quantized msmodelslim transformer weights | --model-path |
Wan2.2 family | None | Currently only compatible with the Ascend NPU family and supports mxfp8, mxfp4, w8a8, and w4a4 |
| Quant Algo | Base Model | Preferred CLI | HF Repo | Current Scope | Notes |
|---|---|---|---|---|---|
FP8 |
black-forest-labs/FLUX.1-dev |
--transformer-path |
lmsys/flux1-dev-modelopt-fp8-sglang-transformer |
single-transformer override, deterministic latent/image comparison, H100 benchmark, torch-profiler trace | SGLang converter keeps a validated BF16 fallback set for modulation and FF projection layers; use --model-id FLUX.1-dev for local mirrors |
FP8 |
black-forest-labs/FLUX.2-dev |
--transformer-path |
lmsys/flux2-dev-modelopt-fp8-sglang-transformer |
single-transformer override load and generation path | published SGLang-ready transformer override |
FP8 |
Wan-AI/Wan2.2-T2V-A14B-Diffusers |
--transformer-path |
lmsys/wan22-t2v-a14b-modelopt-fp8-sglang-transformer |
primary transformer quantized, transformer_2 kept BF16 |
primary-transformer-only path; keep transformer_2 on the base checkpoint, and do not describe this as dual-transformer full-model FP8 unless that path is validated separately |
FP8 |
hunyuanvideo-community/HunyuanVideo |
--transformer-path |
lmsys/hunyuanvideo-modelopt-fp8-sglang-transformer |
single-transformer override, BF16-vs-FP8 video comparison, H100 benchmark, torch-profiler trace | HunyuanVideo uses different ModelOpt/diffusers and SGLang runtime module names; the converter maps those names before writing FP8 scale tensors and BF16 fallback ignores |
FP8 |
Qwen/Qwen-Image |
--transformer-path |
lmsys/qwen-image-modelopt-fp8-sglang-transformer |
single-transformer override, BF16-vs-FP8 image comparison, H100 benchmark, torch-profiler trace | shares the Qwen Image FP8 fallback preset; keep img_in, txt_in, timestep embedder, norm_out.linear, proj_out, img_mod/txt_mod, and img_mlp.net.2 in BF16 |
FP8 |
Qwen/Qwen-Image-Edit-2511 |
--transformer-path |
lmsys/qwen-image-edit-modelopt-fp8-sglang-transformer |
TI2I edit path, BF16-vs-FP8 image comparison, H100 benchmark | shares QwenImageTransformer2DModel with Qwen Image and uses the same Qwen Image FP8 fallback preset |
NVFP4 |
black-forest-labs/FLUX.1-dev |
--transformer-path |
lmsys/flux1-dev-modelopt-nvfp4-sglang-transformer |
mixed BF16+NVFP4 transformer override, correctness validation, 4x RTX 5090 benchmark, torch-profiler trace | use build_modelopt_nvfp4_transformer.py; validated builder keeps selected FLUX.1 modules in BF16 and sets swap_weight_nibbles=false |
NVFP4 |
black-forest-labs/FLUX.2-dev |
--transformer-weights-path |
black-forest-labs/FLUX.2-dev-NVFP4 |
packed-QKV load path | official raw export repo; validated packed export detection and runtime layout handling |
NVFP4 |
Wan-AI/Wan2.2-T2V-A14B-Diffusers |
--transformer-path |
lmsys/wan22-t2v-a14b-modelopt-nvfp4-sglang-transformer |
primary transformer quantized with ModelOpt NVFP4, transformer_2 kept BF16 |
primary-transformer-only path; keep transformer_2 on the base checkpoint; the default FP4 GEMM backend is flashinfer_trtllm |
NVFP4 |
Qwen/Qwen-Image |
--model-path |
lmsys/qwen-image-modelopt-nvfp4-sglang |
full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparison | full repo loaded directly; exported with ModelOpt PR #1706 SVDQuant NVFP4 (--format fp4, max calibration, block size 16) and BF16 fallbacks for attention-sensitive modules plus first/last transformer blocks |
NVFP4 |
Qwen/Qwen-Image-2512 |
--model-path |
lmsys/qwen-image-2512-modelopt-nvfp4-sglang |
full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparison, B200 CI case | same full-repo loader path as Qwen Image; this is the Qwen Image NVFP4 representative in multimodal-gen-test-1-b200 |
NVFP4 |
Qwen/Qwen-Image-Edit |
--model-path |
lmsys/qwen-image-edit-modelopt-nvfp4-sglang |
TI2I edit full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparison | full repo loaded directly with normal image-edit inputs; exported with the same ModelOpt PR #1706 NVFP4 recipe |
NVFP4 |
Qwen/Qwen-Image-Edit-2511 |
--model-path |
lmsys/qwen-image-edit-2511-modelopt-nvfp4-sglang |
TI2I edit full ModelOpt NVFP4 Diffusers repo, BF16-vs-NVFP4 B200 image comparison | full repo loaded directly with normal image-edit inputs; exported with the same ModelOpt PR #1706 NVFP4 recipe |
| checkpoint name fragment | inferred precision | inferred rank | notes |
|---|---|---|---|
svdq-int4_r32 |
int4 |
32 |
Standard INT4 checkpoint |
svdq-int4_r128 |
int4 |
128 |
Higher-quality INT4 checkpoint |
svdq-fp4_r32 |
nvfp4 |
32 |
fp4 in the filename maps to CLI value nvfp4 |
svdq-fp4_r128 |
nvfp4 |
128 |
Higher-quality NVFP4 checkpoint |
| filename | precision | rank | typical use |
|---|---|---|---|
svdq-int4_r32-qwen-image.safetensors |
int4 |
32 |
Balanced default |
svdq-int4_r128-qwen-image.safetensors |
int4 |
128 |
Quality-focused |
svdq-fp4_r32-qwen-image.safetensors |
nvfp4 |
32 |
RTX 50-series / NVFP4 path |
svdq-fp4_r128-qwen-image.safetensors |
nvfp4 |
128 |
Quality-focused NVFP4 |
svdq-int4_r32-qwen-image-lightningv1.0-4steps.safetensors |
int4 |
32 |
Lightning 4-step |
svdq-int4_r128-qwen-image-lightningv1.1-8steps.safetensors |
int4 |
128 |
Lightning 8-step |