ComfyUI Node

CADS

Tired of getting the same image every time? CADS shakes the prompt

By asagi4·Created 3 years ago·Updated about a year ago· 42
CADS
  • model
  • MODEL
noise_scale0.25
t10.60
t20.90
rescale0.00
start_step0
total_steps0
apply_to
key
noise_type
seed-1

CADS is a one-node hack for a very specific kind of frustration: the prompt that keeps producing the same composition, same lighting, same everything, batch after batch. It's a ComfyUI port of the CADS paper - Condition-Annealed Diffusion Sampling (arXiv 2310.17347) - the same trick behind the A1111 sd-webui-cads extension, and its whole job is to add variety by corrupting the prompt conditioning early in sampling and letting it anneal back in as the image resolves.

It's not a quality tool. Nobody claims it makes images better. It makes them different - and on the right batch, that's exactly the win you need.

How it works

The node takes a MODEL in and returns a MODEL out; you wire it between your checkpoint loader and your KSampler. Under the hood it clones the model and installs a UNet function wrapper (it preserves any wrapper you already have, so order matters - put CADS after other wrapper nodes). Each denoising step it computes a gamma value from your t1/t2 pair and mixes the conditioning y with random noise:

y = sqrt(gamma) * y + noise_scale * sqrt(1 - gamma) * noise

At the start of sampling (t above t2 = 0.9 by default) gamma is 0, so the conditioning is basically pure noise; between t2 and t1 (0.6) it ramps linearly to clean; below t1 the prompt is untouched. That's why diffusion runs "backwards" here and t2 > t1. The upshot: composition and subject get decided while the model is being fed gibberish, so each run picks a different way to interpret the prompt, then the later detail steps see the real prompt and clean up after it.

The one input you'll actually reach for is noise_scale (default 0.25, range −5 to 5) - how aggressive the shake is. Negative values work too. Push it too far from zero and you get garbage, which is exactly what rescale is for: it renormalizes the noised conditioning back to the original mean/std and blends it in (0 disables it, 1 uses only the normalized value).

Everything else you can mostly leave alone:

  • start_step / total_steps - how the schedule is computed. Both at 0 (the default) means it reads the sampler's timestep instead, which is what you want.
  • apply_to (both/cond/uncond) and key (y / c_crossattn / both) - where the noise lands. Default is y, the regular conditioning; c_crossattn reproduces the original behavior, which the author now thinks was wrong.
  • noise_type - normal, uniform, or exponential distribution for the noise. Normal is fine.
  • seed - −1 uses the global seed; set it if you want to pin the noise itself.

Output: one MODEL, straight into the KSampler.

Install

No dependencies, no model downloads - the whole pack is a single file that only imports torch and math. Easiest path: ComfyUI Manager, search "ComfyUI-CADS", install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/asagi4/ComfyUI-CADS

then restart ComfyUI. The repo ships a CADScompare.json example workflow that runs two KSamplers side by side at the same seed - one through CADS, one not - so you can see what it's actually doing before you trust it.

The honest troubleshooting section

  • It's experimental, and the author says so, plainly. From the README: "The implementation might not be correct at all... I couldn't make it produce quite the same results as the A1111 node." It still seems to help with variety, but treat it as a wildcard, not a guarantee.
  • Mixed results are the norm. The A1111 crowd reports the same thing: sometimes it's the refresh you needed, sometimes a Lovecraftian nightmare tumbles out. When a batch goes sideways, drop noise_scale or flip it negative.
  • To actually test it, lock your seed. Compare CADS-on vs CADS-off at the same seed - that's the whole point of the example workflow. Randomize seeds while changing things and you can't tell what the node did, which is the classic debugging trap.
  • No effect at all? Check noise_scale isn't 0, and that the CADS model output - not the raw checkpoint - is the one feeding the sampler. Easy to wire wrong.

Where does CADS sit next to the other conditioning dials? It's the same family as CFG and negative prompts - all of them shape what the model is told at denoising time - but CFG makes the model obey harder while CADS deliberately makes it disobey a little. If your images are too obedient, this is the node. Just don't expect it to make them prettier.

Categoryutils

Inputs (11)

NameTypeDefaultDescription
modelMODEL
noise_scaleFLOAT0.25-5–5
t1FLOAT0.600–1
t2FLOAT0.900–1
rescaleoptFLOAT0.000–1
start_stepoptINT00–10000
total_stepsoptINT00–10000
apply_tooptCOMBO3 options: both, cond, uncond
keyoptCOMBO3 options: both, y, c_crossattn
noise_typeoptCOMBO3 options: normal, uniform, exponential
seedoptINT-1-1–4294967296

Outputs (1)

NameTypeDescription
MODELMODEL