Nodes/Adaptive Guidance for ComfyUI/PerpNegAdaptiveGuider
ComfyUI Node

PerpNegAdaptiveGuider

Negative prompts without the bleed, and it still knows when to quit

By asagi4·Created 2 years ago·Updated about a year ago· 67
PerpNegAdaptiveGuider
  • model
  • positive
  • negative
  • empty_conditioning
  • GUIDER
threshold0.9900
cfg8.0
neg_scale1.00
uncond_zero_scale0.00
cfg_start_pct0.00

Negative prompts are blunt instruments. Type "painting" into the negative and the sampler pushes away from everything that correlates with paintings - the texture, the color palette, the composition - not just the unwanted paint look. That bleed is where the gooey, over-processed artifacts come from. Perp-Neg is the fix that predates all the modern attention-based stuff: it decomposes the negative push into the part parallel to the empty conditioning and the part orthogonal to it, and applies only the orthogonal part, scaled by neg_scale.

PerpNegAdaptiveGuider is that mechanism bolted onto the same adaptive engine as the pack's plain AdaptiveGuider. It's a GUIDER for SamplerCustomAdvanced that runs three model passes per step while CFG is active - positive, negative, and a reference "empty" conditioning - combines them with the Perp-Neg formula, and keeps watching the cosine similarity between the positive and negative predictions. Once similarity crosses threshold, it flips to CFG 1.0 for the rest of the schedule, which in ComfyUI means the unconditioned pass is skipped outright. That's not just a speed bonus here; it's what stops a three-pass-per-step node from costing you 3x all the way to the end.

The inputs are AdaptiveGuidance's plus one. You still get model, positive, negative, threshold (keep it 0.99–1.0) and cfg. The addition is empty_conditioning, which is required - wire a CLIPTextEncode with an empty string (or ConditioningZeroOut) into it. That's the reference point Perp-Neg projects against. neg_scale (default 1.0, range 0–100) controls how hard the orthogonal negative push lands; the received wisdom from Perp-Neg discussions is to dial it down if the effect reads too strong. The same two optional knobs carry over: cfg_start_pct and the unstable uncond_zero_scale.

The GUIDER output plugs into SamplerCustomAdvanced alongside BasicScheduler, KSamplerSelect and RandomNoise, exactly like its sibling. The pack's example workflow renders one branch with AdaptiveGuider and one with this node so you can A/B them.

Install is identical - ComfyUI Manager, search "Adaptive Guidance for ComfyUI", or:

cd ComfyUI/custom_nodes
git clone https://github.com/asagi4/ComfyUI-Adaptive-Guidance

then restart. No model files, no pip dependencies; it pulls comfy_extras.nodes_perpneg from core ComfyUI, so there's nothing extra to download.

Fair warnings, because this node has real costs:

  • It's three passes per step while CFG is on. Even Perp-Neg's own community reception noted roughly 3x slower rendering at CFG > 1, and a well-worn skeptic take is that Perp-Neg often trades one kind of artifact for another. The adaptive flip mitigates the speed problem, but the quality question is genuinely model- and prompt-dependent. Test before you trust.
  • If your negative prompt is short and your artifacts are mild, plain AdaptiveGuider is the better default. This node earns its complexity when you have a strong negative and can see the bleed.
  • For negatives at CFG 1 specifically (distilled models, Flux), this isn't the modern answer - that's NAG, Normalized Attention Guidance, which works in attention space. This is a CFG-mechanism tool; it needs real CFG to do anything.

It's a specialist node from a one-person research pack, and the impressions count (zero, at the time of writing) reflects that. But if you're on SDXL with a heavy negative prompt and artifacts you can't prompt your way out of, this is one of the few places Perp-Neg is actually convenient.

Categorysampling/custom_sampling/guiders

Inputs (9)

NameTypeDefaultDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
empty_conditioningCONDITIONING
thresholdFLOAT0.99000.9–1
cfgFLOAT8.00–100
neg_scaleFLOAT1.000–100
uncond_zero_scaleoptFLOAT0.00
cfg_start_pctoptFLOAT0.00

Outputs (1)

NameTypeDescription
GUIDERGUIDER