Perp-Neg Guider (Armandpour et al. 2023)
A negative prompt that can't cancel what you asked for
- model
- positive
- negative
- null
- GUIDER
Ever put "blurry" in the negative prompt for an image where blur was doing useful work? Or noticed that a heavy negative silently deletes half of what your positive asked for? That's the problem Perp-Neg (Armandpour, Sadeghian, Zheng, Sadeghian & Zhou, arXiv 2023) was built to solve: it uses only the part of the negative's direction that doesn't overlap your positive prompt's.
The idea generalises, but the headline version is right there in the name - the perpendicular component of the negative.
How it works, and why it's different from everything else here
Plain CFG subtracts the negative's direction wholesale: whatever the negative says, the image moves away from it. Perp-Neg projects the negative's direction against the positive's first, keeps only the part that is perpendicular - the part the positive prompt doesn't already occupy - and guides away from that:
u + w ((c - u) - s · perp(n - u))
So a negative can't cancel something you explicitly asked for. If you want "a crowd of people" and your negative says "people", plain CFG fights itself; Perp-Neg keeps the part of that negative which points somewhere else entirely.
This is a guider, not a model patch - and that changes your workflow
This is the important practical difference, and it's where people get stuck. Every other node on this page patches the MODEL and drops in between the loader and a KSampler. Perp-Neg outputs a GUIDER, which means it plugs into SamplerCustomAdvanced instead:
Load Checkpoint ──┬─> CLIP Text Encode (positive) ─┐
├─> CLIP Text Encode (negative) ─┤
└─> CLIP Text Encode (empty) ────┤
├─> Perp-Neg Guider -> SamplerCustomAdvanced
SamplerCustomAdvanced needs noise, a sampler and sigmas
Wire it into a KSampler's model input and you'll get nothing useful - the KSampler wants a MODEL, and this gives you a GUIDER.
The inputs
model, plus three conditionings:positive,negative, andnull- the empty prompt, which the node needs because Perp-Neg measures the negative's direction from the true unconditional, not from your positive. Wire the same empty-prompt conditioning you'd normally hand the sampler.cfg- the guidance scale, default7. Note that SamplerCustomAdvanced has no cfg widget of its own; the guider carries it.neg_scale- the weight on the perpendicular negative, default1. The paper used1.5with a single negative, which is the value to try first if the negative is barely landing.space- defaultdenoised (x0), and unlike most nodes in the pack this one isn't free to change: the projection depends on the space, and ComfyUI's own built-in Perp-Neg works in denoised. You can point it elsewhere, but you're changing the method.
Output: GUIDER.
Install
ComfyUI Manager: search CFG Megapack, install, restart. comfy-cli: comfy node install comfy-cfg-megapack. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/AbstractEyes/comfy-cfg-megapack
Restart. No requirements.txt and nothing to download - torch and the standard library over ComfyUI's newer comfy_api.latest node API. Tested on ComfyUI 0.38.0 with torch 2.11, GPU and CPU-only. CFG_MEGAPACK_VRAM_FRACTION=0.6 before launch caps its VRAM share.
Traps
- It's often a no-op, and that's correct. When your negative doesn't overlap your positive, the perpendicular component is most of the negative anyway and Perp-Neg behaves like the plain negative prompt. The pack's own comparison makes this point: with a prompt that never asks for plants, the plants go, much as they would with a normal negative. Perp-Neg is for the conflict case, not an all-purpose upgrade.
- Three conditionings, and the null one is easy to get wrong. Feeding the negative into
nullas well turns the method into something else entirely. neg_scaleabove 2 makes the negative shout much louder than the projection was designed for; you're past the paper's territory.- This pack has five other guiders in the same family - composable negation, signed guidance from the null, a contrastive version, and a windowed negative prompt - all writing the same role. Pick one; they're alternatives, not layers.
- On a guidance-distilled 2026 model running at cfg 1, none of this is reachable: the negative prompt isn't evaluated at all, and a guider that needs a negative prediction has nothing to project. This is an SDXL and SD1.5 tool in practice.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| null | CONDITIONING | The empty prompt: the true unconditional. | |
| cfg | FLOAT | 7.00–100 | — |
| neg_scale | FLOAT | 1.000–5 | Weight of the perpendicular negative (paper 1.5 for one negative). |
| space | COMBO | auto (the method's own) | Where the rule is computed. Linear rules give the same image in any space; nonlinear ones do not. 'auto' uses the space the method was published in (noise for most, denoised for APG and the angle rule, velocity for flow models). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GUIDER | GUIDER | — |