CFG-Zero* (Fan et al. 2025)
The one people actually install for Wan and Flux
- model
- MODEL
Most of the nodes in this pack are research curiosity. CFG-Zero* is not. It shows up in Wan 2.2 settings threads, in Flux quality discussions and in the "how do I make my video stop looking mushy" genre of post, usually as a checkbox you're told to enable without explanation. Here's what the checkbox does, and it's a genuinely different idea from the rescale-and-cap family.
Why flow models need a different fix
On SDXL, the unconditional prediction u is at least the right kind of thing - a noise estimate
of an image. On a flow-matching model at high noise levels, u is close to a pure noise direction.
Subtracting it with w = 7 does something geometrically silly: you're extrapolating along a vector
that was never pointing at an image in the first place. That's a big part of why the first few steps
of a Flux or Wan render at high CFG go wrong.
CFG-Zero* (Fan, Zheng, Yeh & Liu, arXiv 2025) fixes the first of those two problems before it
applies guidance. It solves a tiny least-squares problem per step: find the scalar s* that makes
s* · u closest to c, i.e. s* = <c, u> / ||u||². Then guide from the scaled unconditional
prediction: s* u + w (c - s* u). When u is mostly noise and c points elsewhere, s* comes out
small and the unconditional term stops dragging the result toward hash. When the two predictions
broadly agree, s* is close to 1 and you're back to ordinary CFG.
The asterisk half of the name is the second trick: zero-init. On the first step or two, instead of applying any guidance at all, the latent is left where it is. On flow models the very first prediction is dominated by noise, so a guidance push there mostly injects error - starting from zero lets the model establish structure first. It's a one-or-two-step delay you won't see in the output and will see in the reduced early-step artifacts.
Inputs
- model - from the loader, before the sampler.
- scale (default -1) -
-1takes the KSampler's/guider's cfg. - zero_init_steps (default 1) - how many opening steps leave the latent unmoved. The paper uses 1
on flow models;
0switches it off, which is what you want when you're testing whether thes*correction alone is doing the work. - space -
autopicks this method's own space, which on a flow model means the velocity prediction. This node is nonlinear, so changing the space changes the image.
Output: a MODEL, into KSampler, KSamplerAdvanced, or SamplerCustomAdvanced's model input.
Install
# ComfyUI Manager: search "CFG Megapack" -> Install -> restart
# or:
comfy node install comfy-cfg-megapack
# or by hand:
cd ComfyUI/custom_nodes && git clone https://github.com/AbstractEyes/comfy-cfg-megapack
No dependencies, no downloads. Needs ComfyUI ≥ 0.38 (it uses the newer node API). The pack's templates under Workflow > Browse Templates > Custom Nodes > comfy-cfg-megapack include comparison graphs, and it's worth running one for this method rather than trusting a random "enable CFG-Zero*" comment.
What to watch out for
The pack's flow-model support is real but young. Anima (Cosmos-Predict2 architecture, Qwen3 0.6B text encoder, Qwen-Image VAE) and the other Cosmos-Predict2 transformers are supported throughout, and the pack handles the frame axis and the 16-channel latent for you. But its own docs note that the space conversions run in float64 while plain CFG runs in float32 - so a supposedly "neutral" comparison can differ by rounding. It's invisible on SDXL; on Anima at low resolution the pack measures up to a mean of 2.6 levels out of 255 on GPU where the model is bf16. Not a reason to avoid it, but a reason not to chase pixel-perfect A/B pairs.
Its cost is the unconditional pass. The pack installs its hook with disable_cfg1_optimization
set, so the second forward pass always runs - a rule that needs u can't dodge that. If you were
running CFG 1 on a distilled model specifically for the speed, adding this node gives that back to
you as render time.
One CFG function per model. If another pack's CFG node is chained after this one, that one wins and CFG-Zero* is dead weight. The pack notes that pre/post-CFG nodes from other packs (its own list: CFGZeroStar, CFGNorm, APG, TCFG, PAG, SAG, SLG) compose with the shared slot, whereas true CFG-function replacements (RescaleCFG, Mahiro, RenormCFG) overwrite each other. Check the order before you conclude the method didn't help.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| scale | FLOAT | -1.0-1–100 | The guidance scale w for this rule. -1 uses the sampler's cfg value. |
| zero_init_steps | INT | 10–10 | The first N steps leave the latent unmoved (0 = off). |
| space | COMBO | auto (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)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |