DiffSynth: Quantization Config
Quantization Config — what it takes to fit a 20B at home
- quant_config
The models this pack carries are big. Qwen-Image is 20B, MiniMax H3 is 33B, LTX-2 runs 19B to 22B, and none of that was designed around a 12GB card. Quantization is how the community has been shoving that class of model onto consumer hardware since GGUF did it for Flux in 2024, and this is the pack's knob for it.
It's a config node - it doesn't quantize anything by itself. You wire its output into a ModelConfig's quant_config input, and that particular file gets quantized as it loads.
The two fields you'll actually pick
method has fourteen options, and they cluster into three families. bitsandbytes_nf4 and bitsandbytes_fp4 are the bitsandbytes path - NF4 is the 4-bit format everyone knows from QLoRA, and it's the sane default. The torchao_* entries (int8_w8a16, int4_w4a16, fp8_w8a8, mxfp4_w4a4, nvfp4_w4a4 and friends) are weight/activation recipes with different speed/accuracy tradeoffs; the w8a8 ones quantize activations too, the w4a16 ones leave activations in higher precision. comfy_kitchen_int8_w8a8 / comfy_kitchen_fp8_w8a8 are the Comfy-side kernels. If you're new to this: start with bitsandbytes_nf4, and only go exploring when you have a specific problem.
mode is dynamic or dequant_once, and the difference is worth understanding rather than guessing. dynamic keeps the weights compressed and dequantizes on the fly during each forward pass - smallest memory, some per-step overhead. dequant_once decompresses up into full precision at load and never touches the quantized copy again: faster sampling, much bigger footprint, which can defeat the entire point if your model was already at the edge of fitting.
The optional fields
target_modules- a comma- or newline-separated list of module names to quantize. This is how you quantize selectively. The pack's own Qwen-Image-Edit + Lightning workflow uses a curated list (img_mod.1,txt_mod.1,norm_out.linear,img_in,txt_in,proj_out,timestep_embedder.linear_1,...) - the input/output projections and modulation layers rather than the attention maths, which buys most of the memory saving while leaving the expensive part alone.exclude_modules- the inverse. Useful when your target glob is broad and one layer refuses to quantize cleanly.load_prequantized- flip this on when the file itself is already 4-bit, which is the case for repos likeDiffSynth-Studio/MiniMax-H3-NF4. Getting this wrong is the difference between loading a quantized checkpoint and quantizing a full-precision one at load.
Install, and the part people skip
The base pack install doesn't include quantization backends:
pip install "diffsynth[quant] @ git+https://github.com/modelscope/DiffSynth-Studio.git"
ComfyUI Manager search DiffSynth-ComfyUI covers the node itself. The extras are separate, and if you skip them you'll get an import error the moment a quantized ModelConfig executes - bitsandbytes and torchao are not optional extras at that point, they're the implementation.
Where people get burned
Quantizing everything is slower than quantizing the right things. A broad target_modules list touching every linear layer means more layers to dequantize per step. Selective lists like the one above are usually the better trade.
dequant_once on a model that barely fits. You'll watch VRAM climb during load and OOM before sampling starts. Switch to dynamic.
Quantization is not a quality switch you can flip back. It's applied at load. Changing the config re-executes the ModelConfig and loader, which means re-reading (and re-quantizing) the weights.
Don't expect GGUF-style file swapping. There are no ready-made Q4_K_M files to drop in here - you're choosing a runtime quantization scheme over the repo's weights, or loading a repo that already shipped prequantized files.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| method | COMBO | bitsandbytes_nf4 | 14 options: bitsandbytes_nf4, bitsandbytes_fp4, torchao_int8_w8a16, torchao_int4_w4a16, torchao_fp8_w8a16, torchao_int8_w8a8, +8 |
| mode | COMBO | dynamic | 2 options: dynamic, dequant_once |
| target_modulesopt | STRING | — | |
| exclude_modulesopt | STRING | — | |
| load_prequantizedopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| quant_config | DIFFSYNTH_QUANT_CONFIG | — |