Nodes/ComfyUI-sonar/SamplerSonarEuler
ComfyUI Node

SamplerSonarEuler

A plain sampler with a memory

By blepping·Created 3 years ago·Updated 12 days ago· 49
SamplerSonarEuler
  • guidance_cfg_opt
  • SAMPLER
momentum0.950
momentum_hist0.750
momentum_initZERO
direction1.000
rand_init_noise_typegaussian

Most samplers are amnesiacs: every step starts from scratch, and the only thing guiding it is the current noisy latent. Sonar sampling gives Euler a short-term memory. It keeps a running history of where denoising has been heading and blends a little of it into each step, which is a cheap way to make generation less jittery without changing the underlying model. This is the plain, non-ancestral version - the one the pack's author calls "a bit boring compared to the ancestral version but it has predictability going for it."

The momentum idea came from the A1111 world, via Kahsolt's stable-diffusion-webui-sonar extension, which blepping (u/alwaysbeblepping, also of ComfyUI-bleh) ported to a ComfyUI custom sampler. If you already know Euler, this is the least surprising way to dip into the pack.

How it works

Each step, the sampler computes the normal Euler result, then blends it with a momentum history buffer. Two knobs control the blend:

  • momentum (default 0.95) - how much of the normal result to keep. 0.95 means 95% normal, 5% history. Set it to 1.0 and momentum is effectively off: you get plain Euler.
  • momentum_hist (default 0.75) - how much of the existing history survives each update. Keep 75%, mix in 25% of the new result.

Two more inputs shape the start of the run. momentum_init picks what the history begins as: ZERO, RAND (a random noise init), or SAMPLE/SAMPLE_NORM (seeded from the latent). If you go with RAND, rand_init_noise_type decides which noise family fills it. Be warned: the author says this sampler is very sensitive to the RAND init - if you try it, drop direction to something like 0.05 or -0.15 first. And direction is the sign flip: 1.0 is positive, -1.0 is negative, and fractional values are fair game. Normally you don't want momentum below 0.85, and the defaults are considered reasonable.

Using it

The output is a SAMPLER socket, so it slots straight into a custom sampling setup: SamplerCustomAdvanced (with a BasicScheduler feeding sigmas) or a CFGGuider + SamplerCustom. You don't even need the node - the pack registers sonar_euler in the normal sampler dropdown, but that locks you to defaults. The whole point of the node is the knobs, so use the custom route. For the full momentum mode behavior (classic, new, denoised), plug a SamplerConfigOverride into a companion chain - that's covered in its own article.

Installing it

Everything here ships in one pack:

cd ComfyUI/custom_nodes
git clone https://github.com/blepping/ComfyUI-sonar

or install "ComfyUI-sonar" through ComfyUI Manager and restart. No model files, no Python requirements beyond what ComfyUI already has. Two gotchas before you invest: the author openly says node inputs still change fairly often, so don't expect identical reproductions across git revisions, and seeds can shift between GPUs because noise generation is split between CPU and GPU. Both are "know it, move on" things, not bugs to fix.

When you'd actually use it

If you're on SD 1.5/SDXL and you want a converging sampler you can reason about, this is the on-ramp. Momentum is subtle, so A/B it on a fixed seed before believing it: run plain Euler, run this, compare. It's not going to reinvent your image - that's sort of the point of the non-ancestral version.

Categorysampling/custom_sampling/samplers

Inputs (6)

NameTypeDefaultDescription
momentumFLOAT0.950-0.5–2.5How much of the normal result to keep during sampling. 0.95 means 95% normal, 5% from history. When set to 1.0 effectively disables momentum.
momentum_histFLOAT0.750-1.5–1.5How much of the existing history to leave at each update. 0.75 means keep 75%, mix in 25% of the new result.
momentum_initCOMBOZEROInitial value used for momentum history. ZERO - history starts zeroed out. RAND - History is initialized with a random value. SAMPLE - History is initialized from the latent at the start of sampling.
directionFLOAT1.000-30–15Multiplier applied to the result of normal sampling.
rand_init_noise_typeCOMBOgaussianNoise type to use when momentum_init is set to RANDOM.
guidance_cfg_optoptSONAR_GUIDANCE_CFGOptional input for extended guidance parameters.

Outputs (1)

NameTypeDescription
SAMPLERSAMPLER