Nodes/ComfyUI-CNS-Sampler-CHENGOU/CNS Sampler (Colored Noise) | CHENGOU
ComfyUI Node

CNS Sampler (Colored Noise) | CHENGOU

The CNS colored-noise sampler for Flux

By IIs-fanta·Created 3 months ago·Updated 3 months ago· 8
CNS Sampler (Colored Noise) | CHENGOU
    • sampler
    s_churn0.50
    power_gamma0.75
    gamma_divider1.73
    energy_scale0.980
    alpha_tilt_start0.15
    alpha_tilt_end-0.50
    alpha_use_fnormtrue
    alpha_exp_interptrue
    alpha_exp_sharpness0.75
    num_freq_bins32
    use_bundled_gamma_matrixtrue

    Every ancestral sampler throws white noise at your latent, one fresh dollop per step. The Colored Noise Sampler from CHENGOU implements a recent paper idea: the noise shouldn't be white at all, but colored, shaped so each step feeds energy to the frequency bands the image still hasn't finished building. Early steps push low frequencies (structure), late steps push high frequencies (detail). Same model, same step count, just a smarter noise budget - a plug-and-play sampler swap that's currently most interesting on flow-matching models like Flux.

    What this node actually is

    CNSSampler_CHENGOU is a port of the "Colored Noise Diffusion Sampling" paper (arXiv 2605.30332, Davidson et al., May 2026) to ComfyUI's SAMPLER interface. It's not a full transplant of the authors' SiT training code - the README is upfront about that. It's the paper's frequency-domain noise scheduling grafted onto an Euler-style sampling loop. It outputs one thing: a SAMPLER, which means it plugs into SamplerCustomAdvanced, not KSampler.

    Where it came from sets expectations. The paper showed consistent FID gains, but only on FLUX, and this node was tested on FLUX.1 dev. FID is a statistical average over thousands of images, not a promise about the one you're rendering, and nobody has proven the gains generalize beyond that architecture. Think of it as a free experiment - costs nothing to swap in - not a new permanent default.

    How it works

    The sampler runs a plain Euler step, then adds a shaped-noise term:

    d = (x - denoised) / sigma
    x = x + d * (sigma_next - sigma)          # Euler ODE step
    x = x + colored_noise * sigma_up          # CNS stochastic term
    

    sigma_up is scaled by s_churn, so that one knob is the master switch: set it to 0 and the CNS term vanishes, leaving you with plain Euler. At each step the node builds a radial frequency grid over the latent's H/W, reads a gamma value per frequency bin from a matrix, computes residual = (1 - gamma / gamma_divider), applies an alpha tilt (exp(alpha * f_norm) * residual), raises it to power_gamma, then uses the result as a per-frequency FFT filter on fresh white noise. The filtered noise is normalized to unit std, scaled by energy_scale, and injected. That's the whole trick: same noise energy, different frequency distribution.

    The gamma matrix is the heart of it. The bundled gamma_matrix_scaled.pt (250 steps × 32 frequency bins, values 0→1) is the official unguided matrix, resized to your workflow's step count. If it's missing or you disable use_bundled_gamma_matrix, the node falls back to a sigma-schedule approximation - fine for booting a workflow, not the real thing.

    The inputs that matter

    All eleven inputs are required, but the defaults are the official unguided settings, so most people change almost nothing. Three things to actually touch:

    • s_churn (default 0.5) - the CNS noise strength. This is the first thing to experiment with, and the only way to turn the effect off.
    • use_bundled_gamma_matrix (default on) - leave it on unless you're swapping in the official guided matrix.
    • num_freq_bins (default 32) - matches the official matrix; leave it alone.

    For guided/high-CFG work the author's README offers a second preset: power_gamma 0.5, gamma_divider 25.0, energy_scale 0.998, alpha_tilt_start -0.1, alpha_tilt_end 0.03, and alpha_exp_interp off. If you go that route, ideally replace the bundled matrix with the official guided one.

    Install and wire it up

    There's no requirements.txt - the node uses only torch, comfy.samplers, and tqdm, all of which ship with ComfyUI. So installation is just cloning the pack (or search "CNS Sampler" in ComfyUI Manager) and restarting:

    cd ComfyUI/custom_nodes
    git clone https://github.com/IIs-fanta/ComfyUI-CNS-Sampler-CHENGOU
    

    The gamma_matrix_scaled.pt (33 KB) comes with the repo, so there's nothing else to download. The node lives under sampling / custom_sampling / samplers, and the wiring is:

    BasicScheduler → CNS Sampler → SamplerCustomAdvanced → VAEDecode
    

    Where people get burned

    The number one mistake is feeding the SAMPLER output into a KSampler and finding the slot doesn't exist. SamplerCustomAdvanced is the intended path - the README says so, the code is built for it. Second: testing with s_churn = 0 to "see what it does" tells you nothing, because that's just Euler with extra steps. Third, if you ever see [CNS] gamma_matrix_scaled.pt not found in the console, the fallback is running and you're not actually testing CNS. And note the sampler needs at least a 4D latent - the code throws a clear ValueError if the last two dimensions aren't spatial, which can bite on unusual model latents.

    The name's a lie, sort of - "colored" here is physics-speak for "not white," and it's a genuinely clever idea that's still new enough to be unproven outside FLUX. Give it a couple of renders at low step counts on a complex prompt; that's where it seems to help most. Worst case you spent five minutes and learned why your default sampler is actually fine.

    Categorysampling/custom_sampling/samplers

    Inputs (11)

    NameTypeDefaultDescription
    s_churnFLOAT0.500–2SDE noise strength. 0 disables the stochastic CNS term.
    power_gammaFLOAT0.750.1–3Power applied to the residual energy. Official unguided setting: 0.75.
    gamma_dividerFLOAT1.730.1–50Divides gamma before residual energy is computed. Official unguided setting: 1.73.
    energy_scaleFLOAT0.9800.5–1.5Applied after FFT filtering and unit-std normalization. Official unguided setting: 0.98.
    alpha_tilt_startFLOAT0.15-2–2Frequency tilt at the first step. Positive values favor higher frequencies.
    alpha_tilt_endFLOAT-0.50-2–2Frequency tilt at the final step.
    alpha_use_fnormBOOLEANtrueUse normalized radial frequency for alpha tilting, matching the official published settings.
    alpha_exp_interpBOOLEANtrueUse exponential interpolation between alpha_tilt_start and alpha_tilt_end.
    alpha_exp_sharpnessFLOAT0.750.1–10Sharpness for exponential alpha interpolation. Official unguided setting: 0.75.
    num_freq_binsINT328–128Number of radial frequency bins. Official matrices use 32.
    use_bundled_gamma_matrixBOOLEANtrueLoad gamma_matrix_scaled.pt from this node folder. Disable to use the sigma-schedule fallback.

    Outputs (1)

    NameTypeDescription
    samplerSAMPLER