Files
ComfyUI-CFG-CTRL/nodes.py
Ethanfel fa21c01afc Fix: compensate cfg amplification + smooth tanh switching
Two remaining noise sources fixed:

1. CFG amplification: the return value is uncond + cond_scale * u_sw * sigma,
   so the noise-space correction is cond_scale * K per element. At cfg=12
   with K=0.2, that's 2.4 — far too large. Fix: K_eff = K / cond_scale,
   making the effective correction just K regardless of cfg scale.

2. Hard switching: even clamp(s/phi) creates sharp transitions at the
   boundary. Replace with tanh(s/phi) for a fully smooth correction.
   phi = std(s) normalizes the sliding surface to its natural scale.

Net effect: the noise-space correction is now bounded by K=0.2 per element
regardless of cfg scale, and varies smoothly across spatial positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 18:27:02 +01:00

5.2 KiB