Apply Negapip
Negative prompt weights that actually push back
- model
- clip
- MODEL
- CLIP
You've probably typed (blurry: -1) into a ComfyUI prompt and gotten nothing, or mush. ComfyUI does parse negative weights, but its default handling is weak: the token's embedding gets nudged away from the empty-text embedding while the attention scores stay normal, so the thing still gets attended to. It doesn't repel, it just muddies. Apply Negapip is the fix. It's a port of hako-mikan's well-known sd-webui-negpip extension (shipped in laksjdjf's cd-tuner_negpip pack), and it makes negatively-weighted tokens genuinely push the image away.
What it is
Two inputs, two outputs, zero knobs. You drop it between your checkpoint loader and your prompt encoder:
CheckpointLoader → model ──→ Apply Negapip ──→ KSampler
→ clip ──→ ──→ CLIPTextEncode (positive)
The MODEL output goes to your sampler, the CLIP output to your positive-prompt encode. That's the whole graph change - no new text input, no settings to learn.
How it works
This is the clever part. Negapip hooks the CLIP text encoder's encode_token_weights and, for each token, encodes it twice: once as a key embedding using the normal prompt-weight math, once as a value embedding with the sign flipped for any negative weight. The two get interleaved into the token stream. Then it patches cross-attention (attn2) so keys are pulled from the even slots and values from the odd slots.
Net effect: a (word:-1) token still has its key in the attention calculation - the model recognizes the concept and attends to it normally - but the value that gets summed in is inverted, so it subtracts instead of adds. Attention logits stay sane; the output is actively steered away. That's "repel," and it's a real, visible difference from default ComfyUI weighting. Worth noting: this is a CLIP-era trick, and it only means anything while you're running real CFG - at CFG 1 there's no conditional push to fight, and the KB's negative-prompt panel will happily explain why.
Inputs and outputs
model(MODEL) - the checkpoint's model, straight from the loaderclip(CLIP) - the clip, straight from the loader- Outputs:
MODELandCLIP, wired to your sampler and positive encode
That's genuinely it. The negative weights live in your prompt text using syntax ComfyUI's parser already accepts: (word:-1), (word:-1.0), (phrase:-0.8).
Where it works (and where it won't)
It hooks encode_token_weights on the CLIP text encoders, so it's built for the SD1.5 / SDXL / Pony / Illustrious / NoobAI lineage - the world where prompt weighting and negative prompts still exist and still matter. It does nothing for Flux-style T5 encoders or the newer LLM-encoded models, where prompt weighting is silently discarded anyway. If you're on an anime SDXL checkpoint at CFG 5 and your negative prompt isn't pulling its weight, this is exactly the gap it fills.
Install
Search "cd-tuner" (or "cd_tuner") in ComfyUI Manager and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/laksjdjf/cd-tuner_negpip-ComfyUI
Then restart ComfyUI. There's no requirements.txt and no model file to fetch - pure Python, zero dependencies, which is refreshingly rare in this ecosystem.
Troubleshooting
- "It did nothing" - you're almost certainly on a checkpoint without real CLIP weighting (distilled or LLM-encoded), or your prompt has no negative-weight tokens. If every weight is 1.0 the hook falls back to normal encoding.
- The name. You'll see Apply Negapip under loaders even though the source file calls the class
Negpip- the pack registers it asNegapip. Same node, harmless. - Don't go overboard. Stack
:-1on half your prompt and the effect thins out; people who use negpip-style weights report negatives get ignored more easily as prompts get more detailed. Use it for the specific defect you can name.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| clip | CLIP | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CLIP | CLIP | — |