Nodes/DiffSynth-ComfyUI/DiffSynth: Mixed Quantize Config
ComfyUI Node

DiffSynth: Mixed Quantize Config

Mixed Quantize Config — different bit-widths for different layers

By modelscope·Created about a month ago·Updated a day ago· 8
DiffSynth: Mixed Quantize Config
  • quant_config_1
  • quant_config_2
  • quant_config_3
  • quant_config_4
  • quant_config
◄load_prequantizedfalse►

One quantization scheme for a whole model is a blunt instrument. The attention blocks in a diffusion transformer are not the same animal as the modulation and MLP projections - they tolerate different amounts of squeezing, and they cost different amounts of VRAM. Mixed Quantize Config is the node that lets you stop treating them as one thing.

It takes up to four Quantization Config nodes and emits a single quant_config you wire into a ModelConfig, exactly like a plain scheme.

What it does under the hood

Each of the four inputs expects a DIFFSYNTH_QUANT_CONFIG - the output of a Quantization Config node, where you've set method (bitsandbytes_nf4, bitsandbytes_fp4, or one of the torchao variants), mode, and crucially your own target_modules / exclude_modules selectors.

quant_config_1 is required; 2 through 4 are optional. The node collects them, strips the per-config load_prequantized flag off each one (that setting doesn't make sense per-scheme), and wraps the set in one mixed config that carries its own load_prequantized boolean. That's the one boolean on this node, and it works the same way as on the single-scheme node: turn it on when the weights you're loading are already stored quantized.

When it's worth the hassle

The honest answer is: less often than you'd think. Reach for it when you have a specific asymmetry in mind.

  • Keep attention in a higher-precision scheme and squeeze the modulation/MLP layers harder. That's the classic split, and it's roughly the reasoning behind the curated target_modules list in the pack's own Qwen-Image-Edit workflow - protect the part that decides where things go, compress the part that just scales them.
  • Run different schemes across different files. Quantize the 33B transformer aggressively and leave a text encoder or VAE alone by simply not attaching any quant config to those ModelConfig nodes at all.
  • Test one layer group at a time. Build a mixed config with attention full precision and everything else NF4, compare against uniform NF4, and see whether you can actually spot it. Usually you can't. Sometimes you can, and then you've found the thing worth protecting.

If you have no specific answer to "which layers deserve more bits," you don't need this node. Use Quantization Config on its own; it's the same idea with one fewer thing to misconfigure.

Wiring

QuantizationConfig (attention, 8-bit) ─┐
QuantizationConfig (rest, NF4) ────────┼──→ MixedQuantizeConfig ──→ ModelConfig.quant_config
QuantizationConfig (excluded bits) ────┘

Because the schemes are matched by their module selectors, keep the target_modules lists disjoint. If two schemes can both claim the same layer, what happens next is not something you want to be debugging at 2am with a 30-minute load in front of it - one scheme per layer, decided up front.

Install and prerequisites

Same pack install as everything else - Manager search DiffSynth-ComfyUI - plus the quantization extras, which are a separate command and genuinely required:

pip install "diffsynth[quant] @ git+https://github.com/modelscope/DiffSynth-Studio.git"

The node itself will appear in the menu without the extras. It's the execution that fails, with a bitsandbytes or torchao import error, once the ModelConfig carrying the config tries to load.

Where people get burned

Four inputs and no list input means four schemes is the ceiling. If you find yourself wanting five, you're probably hand-tuning something that would be better served by one well-chosen target_modules list.

Worth keeping in mind generally: the config describes how weights are compressed at load time, so changing it re-runs the load - there's no cheap preview, and no way to un-quantize without reloading the pipeline.

CategoryDiffSynth/config

Inputs (5)

NameTypeDefaultDescription
quant_config_1DIFFSYNTH_QUANT_CONFIG—
load_prequantizedBOOLEANfalse—
quant_config_2optDIFFSYNTH_QUANT_CONFIG—
quant_config_3optDIFFSYNTH_QUANT_CONFIG—
quant_config_4optDIFFSYNTH_QUANT_CONFIG—

Outputs (1)

NameTypeDescription
quant_configDIFFSYNTH_QUANT_CONFIG—