Nodes/Nucleus-Image-comfyui-beta/Nucleus-Image CFG Rescale
ComfyUI Node

Nucleus-Image CFG Rescale

Tame Nucleus-Image's CFG oversaturation with a single float

By a180265·Created 4 months ago·Updated 4 months ago· 1
Nucleus-Image CFG Rescale
  • model
  • NUCLEUS_MODEL
cfg_rescale1.00

When CFG goes high, flow-matching models have a habit of oversaturating - colors get burnt, contrast gets harsh, and the image looks like it was tuned by someone who liked neon. Nucleus-Image CFG Rescale is the pack's answer to exactly that problem: a single float between 0 and 1 that controls how aggressively the CFG-combined prediction is pulled back to the scale of the conditional one.

What it actually does

Remember the standard CFG math: v = v_negative + cfg * (v_positive − v_negative). At cfg 4, the combined vector's magnitude ends up roughly five times larger than the conditional prediction's; at cfg 10 it's over thirteen times. That blow-up is what drives oversaturation and can even knock the denoising trajectory off course.

This node applies adaptive normalization to fix the drift. After combining, it rescales the result toward the magnitude of the positive prediction:

v_final = v * (||v_pos|| / ||v_comb||) * cfg_rescale + v * (1 − cfg_rescale)

Read the two ends:

  • 1.0 (default) - full normalization. This is the official pipeline's behavior, and the default is deliberately 1.0 so the pack matches the model's intended output out of the box.
  • 0.0 - pure CFG, no normalization. The author marks this experimental; expect possible oversaturation.
  • 0.5 - halfway, useful when you're running high cfg and want to back off the saturation without killing guidance entirely.

Inputs and output

  • model - required NUCLEUS_MODEL from the Transformer Loader (it can come through Model Shift first; the two chain cleanly).
  • cfg_rescale - optional FLOAT, default 1.0, range 0.0–1.0, step 0.01.

Output is a NUCLEUS_MODEL for the Sampler. The Sampler genuinely reads this value - I checked the wiring, and unlike some beta nodes in this pack, this one is plumbed through: the sampler applies the rescale formula during the CFG pass.

When you'd actually touch it

Honestly? Rarely. At the README's tested cfg of 4.0 with the default 1.0, you're already on the official behavior and there's nothing to fix. The node earns its keep the moment you start pushing cfg upward - say 6+ for stronger prompt adherence - and your colors start looking fried. Dial cfg_rescale down toward 0.5 and re-run; it's a gentler intervention than slashing cfg, because it keeps the guidance direction while taming its magnitude.

If you're the type who never tweaks CFG, this node is a wire you can simply skip. The Sampler falls back to the default 1.0 on its own.

Installing

Standard pack install - ComfyUI Manager (search "Nucleus-Image") or:

cd ComfyUI/custom_nodes
git clone https://github.com/a180265/Nucleus-Image-comfyui-beta

restart. It's a passthrough configurator, so no model files of its own. Same shared dependency story as the rest of the pack (torch 2.11+, diffusers 0.38+, transformers 4.57+ - all yours to install per the README).

One beta flag to keep in mind: like Model Shift and Block Swap, the author lists CFG Rescale as code-reviewed but not runtime-tested. The wiring checks out in the source, so it should work - but if your first run with a non-default value looks identical to the default, verify your clone is current before assuming you've hit the bug.

CategoryNucleus-Image

Inputs (2)

NameTypeDefaultDescription
modelNUCLEUS_MODEL
cfg_rescaleoptFLOAT1.000–1

Outputs (1)

NameTypeDescription
NUCLEUS_MODELNUCLEUS_MODEL