ComfyUI Node

Flux Quant Node

Precision Cast, Analysis, and Save — But 'Quant' Oversells It

By MilitantHitchhiker·Created 2 years ago·Updated 11 months ago· 3
Flux Quant Node
  • model
  • STRING
precisionauto

The Flux Quant Node (class FluxQuantNode) does three things in one pass: converts a loaded model's tensors to a precision you choose, analyses the result, and saves it as a .safetensors file in ComfyUI's output directory. It sounds like a one-stop quantization shop, and that's exactly where you should pump the brakes. Read the dropdown and you'll see float8_e5m2, float8_e4m3fn, bfloat16, float16 - those are precision casts, not the GGUF Q4/Q8 ladder people usually mean by "quantization." It's a useful tool; it's just not the one you were picturing.

How it works

You feed it a loaded MODEL, pick a precision, and it converts every tensor in the diffusion model's state dict to that dtype, runs the same analysis the Model Analyser does (structure, size, blocks, dtypes), and saves the result. The auto setting picks for you: on an RTX 40-series or newer card (compute capability 8+) it chooses float8_e5m2; on older GPUs it falls back to float16; on CPU, float32. If your torch build lacks the float8 types, the node silently substitutes float16 rather than erroring.

The save uses safetensors - the format that replaced pickle-based .ckpt precisely because loading it runs no code. Filename is <model>_<precision>.safetensors, using model.ckpt_name if the loader exposed it, else unknown_model.

The inputs and output

  • model - a loaded MODEL.
  • precision - dropdown: auto, float32, float16, bfloat16, float8_e5m2, float8_e4m3fn. The real choices here are bfloat16 and the two fp8 variants; float16/float32 just re-save at the same size.

Output is STRING (the analysis JSON); the save status goes to the console, not the output.

Installing it

It's in the Switchblade Pack: ComfyUI Manager → search MilitantHitchhiker-SwitchbladePack → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/MilitantHitchhiker/MilitantHitchhiker-SwitchbladePack

Restart. It needs safetensors (ComfyUI ships it) and torch.

Where people get burned

Four traps, in order of how much they hurt:

  1. It saves the diffusion model only. Like the Model Analyser, it operates on model.model.state_dict() - no VAE, no text encoder. The file it writes is not a full checkpoint and won't reload through CheckpointLoader as one. If you were hoping for a drop-in quantized Flux, this isn't it.
  2. unknown_model filenames. Most ComfyUI loaders don't set a ckpt_name attribute on the model object, so you'll frequently get unknown_model_fp8.safetensors - two of them, if you run it twice.
  3. RAM, not just VRAM. It moves tensors to CPU before saving, so a 12B model at fp16 is ~24 GB sitting in system RAM. Watch your memory.
  4. Not GGUF. There's no Q ladder, no dequantization overhead tradeoff, no city96-style ecosystem compatibility. fp8 is a genuinely good call for 12GB-class cards - the KB's consensus is that fp8 is half the VRAM at near-zero quality loss - but for real GGUF quantization, install ComfyUI-GGUF instead. auto also picks e5m2, while e4m3fn is the variant the wider ecosystem standardizes on; on a modern card you probably want to set float8_e4m3fn explicitly.

Use this node for what it's good at: converting a model you already have to fp8/bf16 and getting a clear analysis of what you produced. For everything else, GGUF is the tool that actually does the job.

CategoryMilitantAI/Switchblade/Model Merging

Inputs (2)

NameTypeDefaultDescription
modelMODEL
precisionCOMBOauto6 options: auto, float32, float16, bfloat16, float8_e5m2, float8_e4m3fn

Outputs (1)

NameTypeDescription
STRINGSTRING