Nodes/pre_cfg_comfy_nodes_for_ComfyUI/Pre CFG merge negative channel
ComfyUI Node

Pre CFG merge negative channel

Your CFG dial is global — this one turns a single latent channel down

By Extraltodeus·Created 2 years ago·Updated about a year ago· 66
Pre CFG merge negative channel
  • model
  • MODEL
channel1
CFG_scale5.0
start_at_sigma15.00
end_at_sigma1.00
enabledtrue

Your CFG scale applies to the whole prediction, all at once. But a diffusion latent isn't one blob - it's a stack of channels, and on SDXL there are four of them. "Pre CFG merge negative channel" is a CFG dial that only touches one channel at a time.

Here's the trick. The sampler runs the model twice per step - once with your prompt (the "cond" prediction) and once with the negative (the "uncond" prediction) - and CFG is just uncond + scale * (cond - uncond). This node picks one channel, and instead of letting the sampler's global CFG decide how that channel mixes, it blends the uncond channel toward the cond channel using its own scale. The code does the math as new_scale = (CFG_scale - 1) / (cond_scale - 1) and rewrites that one channel as a weighted average of the two. Net effect: that channel behaves as if your CFG were CFG_scale instead of whatever the KSampler is set to.

Lower CFG_scale on a channel means less guidance pushing it - which is useful when a specific channel is the source of artifacts, oversaturation, or noise that you want to calm down without weakening prompt adherence everywhere. The author frames these nodes as a toolbox where "the order matters and depends on your needs," and this one pairs naturally with its sibling, "Pre CFG replace negative channel," which fully wipes the negative from a channel. Merge is the softer middle ground: you dial the channel's guidance down instead of zeroing it.

The inputs that matter:

  • model - your checkpoint's MODEL, wired in right after the loader, patched before it reaches the KSampler.
  • channel - which latent channel to target. This is where beginners trip: the max of 128 is generous, but SDXL and SD 1.5 latents only have 4 channels, Flux has 16. Pick beyond your model's count and the node prints WRONG CHANNEL SELECTED and does nothing. Channel 1 is the default.
  • CFG_scale - the effective CFG you want on that channel (default 5, min 2). Lower it to chill a channel, raise it to crack down on one that ignores your prompt.
  • start_at_sigma / end_at_sigma - raw sigma values, not step percentages. The defaults (15 down to 1) cover the full SDXL/SD 1.5 range, so leave them alone unless you have a reason not to.
  • enabled - on/off, handy for A/B testing.

Output is a single MODEL, same as every node in this pack. Installation is the same trivial story for the whole pack: ComfyUI Manager → search pre_cfg_comfy_nodes_for_ComfyUI, or:

cd ComfyUI/custom_nodes && git clone https://github.com/Extraltodeus/pre_cfg_comfy_nodes_for_ComfyUI

Then restart. No requirements.txt, no model downloads - the pack is one Python file riding on ComfyUI's existing imports.

One honest caveat: the author says he only tested these on SDXL, and every node in the pack quietly skips its work if there's no negative prediction to work with (which is what happens at CFG 1 on guidance-distilled models). On SDXL, with a real negative prompt, this node does what it says - and it's exactly the kind of fiddly, low-level tweak that makes sense once you've chased a color cast or texture artifact back to one specific channel.

Categorymodel_patches/Pre CFG

Inputs (6)

NameTypeDefaultDescription
modelMODEL
channelINT11–128
CFG_scaleFLOAT5.02–100
start_at_sigmaFLOAT15.000–100
end_at_sigmaFLOAT1.000–100
enabledBOOLEANtrue

Outputs (1)

NameTypeDescription
MODELMODEL