Files
ComfyUI-CFG-CTRL/nodes.py
Ethanfel 5f0bd6825d Fix: normalize to noise-prediction space before SMC
The previous fix (denoised space) still had the problem: K * cond_scale
produced a constant ±2.4 perturbation per element at cfg=12, destroying
the image at every step.

The paper's K=0.2 is calibrated for unit-variance noise predictions.
ComfyUI's cond/uncond are sigma-scaled (x - denoised ≈ sigma * epsilon).
Now we divide by sigma to recover epsilon-space, apply SMC there, then
multiply back by sigma. This gives natural dampening at late steps:
- sigma=14 (early): correction ±33 in latent space (image is noise anyway)
- sigma=0.01 (late): correction ±0.024 in latent space (negligible)

This matches the paper's behavior where the scheduler conversion
inherently dampens the noise-space correction at low sigma values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 17:43:07 +01:00

4.5 KiB