SNR Quant (FP8/ BF16)
Shrink a 50GB diffusion model down to size — on your own machine
The moment you start running video models, this becomes the whole game. Wan 2.1's 14B fp16 file is pushing 30GB, Wan 2.2's 27B MoE clears 50, and your card is still 16. The usual fix is to go download a pre-quantized fp8 or GGUF build and hope whoever made it cut the model where you need it cut. SNR Quant is the other route: hand it a diffusion model you already own and a target size in GB, and it quantizes the file down to exactly that, in mixed FP8/BF16.
In plain terms, it's a DIY fp8 packager. ComfyUI already loves fp8 - it's the community's "just use it" default for Flux- and Wan-class models because half the size costs you almost nothing in quality. This node just means you don't wait for someone to package your weights; you pick the size yourself, and you can rerun it as your target changes.
How it works
The clever part is that it doesn't blindly cast everything to FP8. For every 2D weight layer it simulates what an FP8 round-trip would do (encode to float8_e4m3fn, decode back) and measures the signal-to-noise ratio in dB, plus an "outlier index" - max absolute weight over standard deviation, a rough proxy for layers whose extreme values FP8's limited range would mangle. High SNR, low outlier means safe to quantize; everything else gets left alone.
From that distribution it calls the model fragile, moderate, or robust and sets an adaptive outlier threshold: conservative (90th percentile) for fragile models, aggressive (50th) for robust ones, balanced (75th) in between. Then it greedily picks the safest layers, highest SNR first, until it's saved enough bytes to hit your target. If it still can't reach the target at the 50th percentile, it quantizes everything and tells you.
Two rules worth remembering:
- 1D layers (norms, biases) always stay BF16. FP8 is for 2D weights only.
- Re-quantization is safe. Layers already in FP8 are skipped, so rerunning never bloats the file back toward BF16.
The whole thing runs on CPU - no VRAM pressure, but also no speed. It loads the model into system RAM, computes per-layer stats, converts, saves.
Inputs and outputs
Two inputs, zero graph outputs, and that's the point - it's an output node that writes files:
- model_name - a dropdown of
.safetensorsfiles inComfyUI/models/diffusion_models - target_size_GB - a float, default 22.0, step 0.1. The floor is "everything FP8": if your target is below what the fully-quantized model would be, it warns and adjusts up to the minimum instead.
The result lands at ComfyUI/output/diffusion_models/quant_<model>_<size>GB.safetensors, alongside a CSV report (..._report.csv) listing every layer, its final precision, SNR in dB, outlier index, and whether it changed. Copy the safetensors into ComfyUI/models/diffusion_models/ and load it with the usual Load Diffusion Model node.
Install
Small pack, no model downloads, no exotic dependencies - just torch >= 2.1 (for FP8 support), safetensors, and numpy, all of which any working ComfyUI already has. Either clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/liconstudio/ComfyUI-SNR-quant
then restart ComfyUI, or try Manager → Install Custom Nodes → search "SNR-quant".
Where people get burned
- It only reads
.safetensors. Drop a.ckptindiffusion_modelsand it errors on load. - RAM, not VRAM. A 50GB fp16 model needs comfortably more than 50GB of system RAM to hold while it works - this is a "how much RAM do you have" tool, and on big Wan files it takes a while.
- The output lands in
output/, notmodels/. It won't appear in your loader until you move it, which makes it look like the node did nothing. - It's FP8, not GGUF. The floor is every 2D layer in FP8 - roughly half of BF16. If you need 4-bit levels for an 8GB card, this isn't the tool; that's GGUF territory.
Quality verdict: fp8 e4m3fn is about as close to lossless as quantization gets, and the per-layer SNR gating exists precisely to protect the few layers that aren't. For "fit a big video model onto a 16–24GB card without waiting for a packager," it's dead simple - set a size, run, move the file.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | Model from ComfyUI/models/diffusion_models | |
| target_size_GB | FLOAT | 22.0 | Target model size in GB (e.g., 22.0) |
Outputs (0)
No outputs