https://github.com/extraltodeus/negative-attention-for-comfyui-
Takes the difference in between the positive and negative conditioning at the attention.
https://github.com/extraltodeus/negative-attention-for-comfyui-
comfyui comfyui-nodes
Last synced: 12 months ago
JSON representation
Takes the difference in between the positive and negative conditioning at the attention.
- Host: GitHub
- URL: https://github.com/extraltodeus/negative-attention-for-comfyui-
- Owner: Extraltodeus
- Created: 2025-02-05T00:33:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T15:10:24.000Z (about 1 year ago)
- Last Synced: 2025-03-20T16:25:45.523Z (about 1 year ago)
- Topics: comfyui, comfyui-nodes
- Language: Python
- Homepage:
- Size: 4.07 MB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Negative-attention-for-ComfyUI-
Takes the difference in between the positive and negative conditioning at the cross attention.
This is an experiment.
Only tested with SDXL and SD 1.X.
Will not work with Flux (see bottom note).
This allows to:
- Get a negative influence without generating a negative prediction
- Let the unconditional prediction be unconditional
- Or doubling down by having the same done for the negative prediction (overblown results are to be expected unless using an anti-burn or low CFG scale)
In order to do this for now the negative conditioning is sneaked to the attention by being concatenated to the positive by using a special node.

They are then split at the half before the cross attention.
Like any model patcher, it is to be plugged right after the model loader:

An example workflow is provided.
## Example:
No modification:

Difference in positive and negative conditionings:

Difference in positive conditioning, negative conditioning empty:

No modification using empty negative conditioning:

## Note
I haven't managed to make this work with anything but SDXL / SD1.5
I did spend two hours looking for how to patch the equivalent of the cross attention for Flux but did not find how (like the keywords for the patch or something).
Any help appreciated!