Nodes/pre_cfg_comfy_nodes_for_ComfyUI/Pre CFG replace negative channel
ComfyUI Node

Pre CFG replace negative channel

Kill the negative on a single latent channel — when one channel is the problem

By Extraltodeus·Created 2 years ago·Updated about a year ago· 66
Pre CFG replace negative channel
  • model
  • MODEL
channel1
enabledtrue

Sometimes a channel in your latent is just misbehaving, and the fastest fix is to pretend its negative doesn't exist. "Pre CFG replace negative channel" does exactly that: it takes one channel of your negative prediction and swaps in the same channel from your positive prediction. Since CFG is uncond + scale * (cond - uncond), a channel where cond and uncond are identical contributes zero guidance - that channel runs at effectively CFG 1 while the rest of the image keeps its full guidance.

This is the nuclear option compared to its sibling "Pre CFG merge negative channel," which blends the channel toward your chosen scale instead of zeroing the difference entirely. Replace is for when a channel is producing a specific, localized artifact - noise texture, a color band, a weird structural wobble - and you want that channel's negative pressure gone, full stop. It's a blunt instrument for a specific problem, which is fine; that's the whole pack's ethos.

The inputs are minimal:

  • model - in, patched, out. Same as every node here.
  • channel - which latent channel. The cap is 128 but the real limit is your model: SDXL and SD 1.5 have 4 channels, Flux has 16. Past the real count, the node prints WRONG CHANNEL SELECTED. THE LATENT SPACE ONLY HAS {n} CHANNELS and does nothing. Channel 1 is the default.
  • enabled - flip off to A/B against the unpatched workflow.

There's no sigma window on this node - it acts on every step that has a negative prediction, and it silently no-ops if there isn't one (which is your CFG-1 / guidance-distilled / empty-uncond cases, same as the rest of the pack). The author only ever tested on SDXL, and honestly that's where this kind of channel surgery makes the most intuitive sense, since SDXL's four latent channels are loosely tied to different aspects of the image's structure and color. On a 16-channel Flux latent you're poking blind.

The workflow pattern is the same for the whole pre-CFG family: drop the node between your model loader and the KSampler, chain other pre-CFG nodes in whatever order you like (order matters, per the README), and tune. It's a debugging tool more than a daily driver - you'll reach for it when you've got a specific artifact you've traced to a channel and you want to test "what if this channel just didn't fight me."

Installation is the one-liner every article in this pack can share:

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

or ComfyUI Manager → search pre_cfg_comfy_nodes_for_ComfyUI → restart. No requirements, no model downloads. The whole pack is a single Python file hooking ComfyUI's own pre-CFG sampler function, so there's nothing to break and nothing extra to fetch.

Categorymodel_patches/Pre CFG

Inputs (3)

NameTypeDefaultDescription
modelMODEL
channelINT11–128
enabledBOOLEANtrue

Outputs (1)

NameTypeDescription
MODELMODEL