Nodes/CFG Megapack/Guidance Rescale (Lin et al. 2024)
ComfyUI Node

Guidance Rescale (Lin et al. 2024)

The fix for running cfg 12 without blowing out your colours

By AbstractEyes·Created 5 days ago·Updated 5 days ago· 3
Guidance Rescale (Lin et al. 2024)
  • model
  • MODEL
◄scale-1.0►
◄phi0.70►
◄spaceauto (the method's own)►

You know the trade. Push cfg from 7 to 12 on SDXL and the prompt gets obeyed - fingers appear, background objects show up - and the image turns into a lava-lamp, all clipped highlights and neon skin. Raise it more and you're generating abstract art with a face shape in it.

Guidance Rescale is the oldest fix for that, and still the one most people mean when they say "rescale CFG". It's Lin et al. 2024, it's in ComfyUI core as a stock RescaleCFG node, and this node is the paper's rule with the two knobs the stock version hides.

The mechanism

Plain CFG first: u + w (c - u), with u the unconditional prediction and c the conditional one. Then, per image, the result's standard deviation is pulled back toward the conditional prediction's:

x = phi * cfg * std(c) / std(cfg) + (1 - phi) * cfg

phi is how much of the rescaled version you keep. The intuition: a high scale doesn't just push the image toward your prompt, it inflates the spread of values in the latent - that's the saturation you see. Dividing by the inflated std restores the range while keeping the direction, so the prompt adherence stays and the colours come back.

It's per-image, not per-pixel, which is why it's cheap and why it sometimes kills genuinely bright images: one big specular highlight drags the std for the whole frame.

Inputs and output

  • model - the wire that goes loader → this node → sampler.
  • scale - the guidance scale w used by this rule. The default of -1 means "use the sampler's cfg", which is what you want 95% of the time.
  • phi - default 0.7. The paper worked in 0.5–0.75; 0 is plain CFG, 1 is the full correction. At 0.7 on cfg 12–14 the image usually keeps its detail and stops burning.
  • space - where the rule is computed. Left on auto (the method's own), which puts it in the space the paper published in. The tooltip is worth reading once: linear rules give the same image in any space, nonlinear ones don't, and this one is nonlinear (it's a ratio of standard deviations).

Output is a MODEL. Wire it into a KSampler, or before whatever else is in your chain.

Install

ComfyUI Manager → search CFG Megapack → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/AbstractEyes/comfy-cfg-megapack

No dependencies, no model downloads. It does want a reasonably current ComfyUI (comfy_api.latest, tested on 0.38.0) - on an older build the pack simply won't import and the node won't show up in the search.

Where people get burned

The slot conflict. ComfyUI has exactly one CFG-function slot, shared by every pack that does this: this node, ComfyUI's own RescaleCFG, Mahiro, RenormCFG and friends. The one chained last wins, and the others do nothing at all - silently. If your rescale stopped working after you added something else to the chain, that's why. (APG, CFGNorm, TCFG, PAG, SAG and CFG-Zero* style nodes that work pre- or post-CFG compose fine, with a chain order that matters less.)

Using it at cfg 7. Below about 8 this is a subtle-to-invisible knob. If you're at cfg 5 and applying rescale, you're paying 30% of your adherence to get back a colour range you never lost.

Expecting it to fix composition. It doesn't touch direction or structure, just magnitude. If your high-cfg images are structurally mushy rather than oversaturated, look at the direction rules instead - APG or TCFG in the same pack's papers folder.

phi too high. Push phi past 0.8 at very high scales and you can get a flat, washed look - you're pulling the spread back so hard the image loses its own contrast. 0.7 is the paper's value for a reason; the pack's own comparison images use exactly that.

One practical recipe: cfg 12–14 with phi 0.7 is the classic "high-scale, sane colours" setup, and it pairs well with a rising guidance schedule if you also want the early steps to stay calm.

CategoryCFG Megapack/papers/combining the two predictions

Inputs (4)

NameTypeDefaultDescription
modelMODEL—
scaleFLOAT-1.0-1–100The guidance scale w for this rule. -1 uses the sampler's cfg value.
phiFLOAT0.700–1How much of the rescaled result is used (paper 0.5-0.75; 0 = plain CFG).
spaceCOMBOauto (the method's own)Where the rule is computed. Linear rules give the same image in any space; nonlinear ones do not. 'auto' uses the space the method was published in (noise for most, denoised for APG and the angle rule, velocity for flow models).

Outputs (1)

NameTypeDescription
MODELMODEL—