ComfyUI Node

C2FG

C2FG turns CFG up in the last steps, where the detail actually gets decided

By pamparamm·Created 2 years ago·Updated a day ago· 274
C2FG
  • model
  • MODEL
◄growth_rate1.00►

CFG is one number for the whole render, which is a weird deal: step 1 decides composition, step 28 decides whether the eyelashes are right, and both get exactly the same amount of guidance. C2FG is a one-slider model patch that makes CFG climb as the image finishes - normal CFG at the noisiest step, then a smooth exponential ramp up to cfg × e^growth_rate by the last one. The pitch, straight from the C2FG paper it implements, is clearer structure plus better small detail: more push at the stage where small detail is actually being drawn, without cooking the big structural moves.

It ships in pamparamm's ComfyUI-ppm pack, the same grab-bag as NegPip, Attention Couple and the Guidance Limiter. If you've poked at that pack you know the pattern: small, opinionated, technically interesting nodes the ecosystem mostly ignores. C2FG is the least-discussed of the lot - essentially zero community chatter, so your own eyeballs are the benchmark.

The mechanism, in one line of maths

The node doesn't touch the weights at all. It registers a sampler_cfg_function - the same hook lane that RescaleCFG and Dynamic Thresholding use - which means it gets handed every step's conditioning pair and can change the scale before the guidance arithmetic runs.

At each step it converts sigma into a normalized timestep between the model's sigma_min and sigma_max, giving t running from about 1 at the start down to 0 at the end, then applies:

scale_t = cfg × exp(growth_rate × (1 - t))

So at the noisiest step the multiplier is exp(0) = 1 and you get exactly the CFG you typed into the sampler. By the last step it's exp(growth_rate). With the default growth_rate of 1.0 that's a 2.72× climb - CFG 6 ends up behaving like CFG 16 for the final steps. Set it to 0.0 and the node is a no-op, which is a handy way to A/B it without rewiring.

Because it rewrites the scale rather than the prediction, it costs zero extra compute and it stacks: if another hook is already attached (a post-CFG rescale, say), C2FG passes the ramped number down the chain.

Inputs and outputs

Two inputs, one of which you'll touch:

  • model - your checkpoint or LoRA-patched model, same as any model patch.
  • growth_rate - 0 to 1, default 1.0. The paper's best value is 1.0; start there, then go down, not up. The widget won't let you exceed 1 anyway.

The single MODEL output goes into KSampler's model input, or SamplerCustom / SamplerCustomAdvanced depending on which sampler node you're running. That's the whole wiring diagram: model → C2FG → sampler.

Installing it

ComfyUI Manager → search "ComfyUI-ppm" → install → restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/pamparamm/ComfyUI-ppm

No requirements.txt, no runtime dependencies, no models to download - the pack leans on what ComfyUI already ships. It does hijack the scheduler list globally to add ays, ays+ and gits, so your scheduler dropdown changes whether or not you use C2FG.

Where it bites

The ramp multiplies. If you normally run CFG 8 because that's what the checkpoint likes, C2FG at 1.0 hands the last steps something near 22 and it'll look deep-fried. Pick a base CFG you'd call slightly under-seasoned and let the schedule do the seasoning - or keep your CFG and drop growth_rate to 0.3–0.5. Same trap as every "why is my image burnt" post, except this CFG isn't visible in the sampler widget.

Two more:

It does nothing at CFG 1. The README says so plainly, and the reason is worth knowing. ComfyUI skips the unconditional pass entirely when cond_scale is 1.0 - the disable_cfg1_optimization gate - so the CFG function gets a zeroed uncond and the "guidance" becomes a straight multiplication of the cond prediction. On a distilled model (Turbo, Lightning, Z-Image Turbo, Klein distilled, ERNIE Turbo) that isn't detail, it's the model's own output scaled into mush. C2FG is for checkpoints that run real CFG: SD 1.5, SDXL and its finetunes, Anima.

Chain it last. Since it wraps whatever hook is already on the model, put C2FG as the final model patch before the sampler. A CFG node wired after it that doesn't wrap the previous function will silently replace your schedule.

If it's not working

  • Images look identical with and without it. Check growth_rate isn't 0, that sampler CFG isn't 1.0, and that the node is actually on the model branch feeding the sampler.
  • Oversaturated, crunchy, glowing edges. Your base CFG is already high. Drop CFG a point or two before touching growth_rate.
  • Faces and hands improve but backgrounds get busy. That's the known trade with late-step guidance, and the same thing users reported with this pack's Guidance Limiter - illustrative models tend to like it more than photorealism.
  • Errors or no output after a pack update. The README's standing advice: delete the node from the graph, re-add it, restart.
Categorymodel_patches/unet

Inputs (2)

NameTypeDefaultDescription
modelMODEL—
growth_rateFLOAT1.000–1—

Outputs (1)

NameTypeDescription
MODELMODEL—