Nodes/comfyui_overly_complicated_sampling/OCSNoise ImmiscibleReference
ComfyUI Node

OCSNoise ImmiscibleReference

Noise that repels from a reference

By blepping·Created 2 years ago·Updated 2 months ago· 30
OCSNoise ImmiscibleReference
  • custom_noise
  • reference
  • custom_noise_ref
  • custom_noise_blend
  • OCS_NOISE
factor1.000
size64
batchingchannel
normalize_ref_scale0.00
normalize_noise_scale0.00
maximizefalse
distance_scale0.10
distance_scale_ref0.10
blend1.00
blend_modelerp
normalize

Normal noise is lazy: its random values don't care about your image at all. Immiscible noise is the opposite - it's generated so that it's as different as possible from a reference, like oil and water refusing to mix. That's the idea behind the paper this node implements (arxiv 2406.12303), and OCSNoise ImmiscibleReference is the standalone version of it: generate noise, then reshuffle it so each piece sits far from (or close to) a reference latent. The README is careful to note the technique was designed for training, not inference - so think of this as an experimental flavor that sometimes gives sampling a useful kick, not a guaranteed upgrade.

What it is

A custom noise node (OCS_NOISE output) that takes a reference - either a LATENT or another noise generator - and produces immiscible noise from it. When a sampler requests noise for ancestral or SDE sampling, the node generates a batch of candidate noise and then optimizes the assignment so the noise is maximally (or minimally) distant from the reference. It's the "repelling" ingredient in the OCS noise kitchen.

The inputs that matter

  • reference (optional) - a LATENT to repel from. Attach this or custom_noise_ref, not both.
  • custom_noise_ref (optional) - an alternative reference source: use noise from another generator as the thing to repel from.
  • custom_noise (required) - the base noise being immiscibilized.
  • size (default 64) - number of batch repeats to generate for the matching. Setting it to 0 disables immiscible processing entirely, which makes this node a pass-through - handy for A/B comparisons.
  • batching (default channel) - what dimension gets matched: channel, batch, row, column, and the cycle_* variants. Column mode reshapes the input and can eat a lot of VRAM; row is slow but less brutal. Stick with channel to start.
  • maximize (default false) - false pushes noise away from the reference (the classic immiscible direction); true pulls it closer.
  • distance_scale (default 0.1) - the v1/v2 switch: 0 gives you the original (v1) immiscible behavior, non-zero enables the v2 mode that also scales the input noise. 0.1 is the README's suggested starting point.
  • blend (default 1.0) - how much of the output is immiscible noise vs. normal noise. custom_noise_blend lets you pick a different noise type for the normal side.

Output is OCS_NOISE, ready for a sampler's custom_noise input.

Why you'd bother

Immiscible noise in sampling is a "shuffle the noise to be maximally spread out relative to the current image" trick. Its biggest practical draw is in Restart sampling - the pack supports immiscible noise for restarts too, and some users report it changing how re-noised steps behave. It's genuinely experimental, so treat it as a sampler-flavor experiment: set it up, A/B against plain noise, and keep it only if it helps.

Installing and gotchas

Part of the pack - Manager search "Overly Complicated Sampling" or git clone https://github.com/blepping/comfyui_overly_complicated_sampling into ComfyUI/custom_nodes, restart. No models or mandatory deps. The blend_mode note: only slerp works well, and that requires installing ComfyUI-bleh. Set blend: 0 or size: 0 to quickly disable and compare.

CategoryOveryComplicatedSampling/noise

Inputs (15)

NameTypeDefaultDescription
factorFLOAT1.000-100–100Scaling factor for the generated noise of this type.
sizeINT64Number of batch repeats to use when generating Immiscible noise. Setting this to 0 disables immiscible noise. If the batching type is batch, then Immiscible noise is also disabled unless the size is 2 or higher. Note that this size is in batch repeats regardless of the batching mode. For example, if you are generating a batch of 2 and you set this to 2, then you will generate noise with batch size 4.
batchingCOMBOchannelDimension to maximize (or minimize) the noise with. Column mode requires reshaping the input and may require a lot of VRAM. Row mode is also fairly slow, but not as bad as column mode. Row and column modes have a very strong effect.
normalize_ref_scaleFLOAT0.00-10000–10000Controls whether the reference gets normalized. If set to 0, no normalization is done.
normalize_noise_scaleFLOAT0.00-10000–10000Controls whether the noise used as an input for immiscible noise is gets normalized first. If set to 0, no normalization is done.
maximizeBOOLEANfalseWhen enabled, maximizes the distance between the noise and the reference rather than trying to minimize it.
distance_scaleFLOAT0.10-10000–10000Multiplier on the input noise for v2 Immiscible noise. Set to 0 to use v1 Immiscible noise.
distance_scale_refFLOAT0.10-10000–10000Multiplier on the refence for v2 Immiscible noise. No effect if distance_scale is 0.
blendFLOAT1.00-10000–10000Percentage of immiscible noise to use. 1.0 means 100%. May not work very well with most blend modes.
blend_modeCOMBOlerpBlending function used when mixing immiscible noise with normal noise. Only slerp seems to work well (requires ComfyUI-bleh).
normalizeCOMBOControls whether the generated noise is normalized to 1.0 strength.
custom_noiseOCS_NOISE,SONAR_CUSTOM_NOISEInput for custom noise used during ancestral or SDE sampling.
referenceoptLATENTAttach either this or the custom_noise_ref input but not both.
custom_noise_refoptOCS_NOISE,SONAR_CUSTOM_NOISEOptional input that can be attached instead of the reference latent. When used, noise from this generator will be used as the reference.
custom_noise_blendoptOCS_NOISE,SONAR_CUSTOM_NOISEOptional input for blended noise (only used when blend is not 1.0). Can be used if you want to blend with a different noise type.

Outputs (1)

NameTypeDescription
OCS_NOISEOCS_NOISEA custom noise chain.