ComfyUI Node Runs on cloud

Unsampler

Running a sampler backwards to find an image's noise

By BlenderNeko·Created 3 years ago·Updated 2 years ago· 321
Unsampler
  • model
  • positive
  • negative
  • latent_image
  • LATENT
steps20
end_at_step0
cfg1.00
sampler_name
scheduler
normalize

Every sampler in ComfyUI does the same job: start from noise, walk it down to an image. Unsampler runs that walk in reverse. Hand it a clean image, a model, and a prompt, and it works out what noise - at whatever step you ask for - would produce that image if you sampled forward from there. That's not a party trick. It's a more controllable way to do img2img than a single "denoise" slider gives you, and it's the same family of idea behind the RF-inversion and FlowEdit tricks people now run on Flux and Qwen - this node was doing it years earlier, under a plainer name.

How it works

Diffusion models are trained by taking a clean image, adding noise to it in increasing amounts across a schedule, and learning to predict and remove that noise at each step. Unsampler runs that forward-noising process, but guided by your actual model and prompt rather than a fixed formula - so the noise it hands back isn't random static, it's specifically the noise consistent with your conditioning at that point in the schedule. Feed it back into a sampler at the same settings and you land close to your source image. Nudge the prompt on the way back down and you get something structurally similar to the original but shifted by whatever you changed - a manual, inspectable version of what a plain img2img node does silently at the top of the graph.

The inputs and outputs that matter

You're feeding it latent_image (the encoded source), positive/negative conditioning, and a model, same as any sampler. The settings worth understanding: steps and end_at_step decide how far back you rewind - end_at_step at 0 walks all the way to pure noise, higher values stop partway, which is what you want if you're splicing this into a two-sampler pipeline. cfg should sit near 1.0 if you actually want a faithful round trip; push it up once you understand the baseline. normalize matters if the output is heading into Inject Noise, which expects normalized noise - leave it off otherwise. Output is a single LATENT: not an image, the noise itself, ready to feed an Advanced KSampler (with add_noise disabled and matching steps) or straight into Inject Noise.

How to install it

Search "ComfyUI Noise" in ComfyUI Manager and install, or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/BlenderNeko/ComfyUI_Noise

Restart ComfyUI. No models to download and nothing heavy in the dependency list - it's pure math riding on top of the sampler you already have, so there's no VRAM tax beyond what a normal sampling pass costs.

Common issues & troubleshooting

The most common point of confusion, and it comes up in threads about this exact node, is matching end_at_step to the right value on the sampler downstream. Because Unsampler runs backwards, its end_at_step corresponds to your Advanced KSampler's start_at_step, not the other way round - set them equal and you're on solid ground before you start experimenting.

Second trap: forgetting to turn off add_noise and return_with_leftover_noise on the Advanced KSampler that receives this node's output. If you're supplying the noise yourself, the sampler shouldn't also be generating its own - leave both disabled or you'll double-dose the latent and get mush.

For a faithful reconstruction, keep cfg close to 1.0 and match steps between the unsample and the resample pass. Once you're past sanity-checking that round trip, this is also where people hit the real limitation: it's hard to change one specific thing about an image this way. Push the prompt hard and you either get the original back unchanged or lose the composition entirely - there isn't much middle ground for "same image, but the hat is different." Smaller prompt deltas and a non-zero end_at_step (so you're not unwinding to pure noise) keep more of the source intact while still giving the model room to move.

Categorysampling

Inputs (10)

NameTypeDefaultDescription
modelMODEL
stepsINT201–10000
end_at_stepINT00–10000
cfgFLOAT1.000–100
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
normalizeCOMBO2 options: disable, enable
positiveCONDITIONING
negativeCONDITIONING
latent_imageLATENT

Outputs (1)

NameTypeDescription
LATENTLATENT