UNetSelfAttentionMultiply
The volume knob on your UNet's self-attention that almost nobody turns
- model
- MODEL
UNetSelfAttentionMultiply is a volume knob for the self-attention layers inside your diffusion model. It multiplies the weights of those layers by a factor you pick, at inference time, without retraining or touching the model file on disk. It's one of four nearly-identical "attention multiply" nodes ComfyUI shipped back in April 2024, all marked experimental, and almost nobody uses them. If you've never heard of it, that's the correct level of fame.
Here's the honest pitch: self-attention is where the model decides how different regions of your image relate to each other - composition, texture coherence, whether the subject's two halves agree on what they're depicting. LoRAs, CFG, and ControlNet all pull on attention indirectly. This node pulls on one specific part of it, directly, with a single multiplier. It's a debugging tool and a teaching tool more than a workflow staple, but if you're chasing a specific composition quirk it's the surgical instrument for the job.
How it works
The node clones your model, then walks the state dict and registers a patch on every key that ends in attn1.to_q, attn1.to_k, attn1.to_v, or attn1.to_out.0 (both weights and biases). In SD 1.5 and SDXL UNets, attn1 is the self-attention block inside each transformer stage - the "attend to other pixels" block, as opposed to attn2, which is where your prompt gets in. The patch just multiplies the weight by your factor during the forward pass; it uses the exact same machinery that applies LoRAs, only instead of a trained delta it's a plain scalar. The model file on disk never changes.
That also means patches stack multiplicatively. Chain this with a LoRA or another multiply node and the effects multiply rather than add, so a 1.1 here on top of a 1.1 elsewhere gives you 1.21 of whatever you were doing.
The inputs that matter
All four are floats, range 0–10, default 1.0 (which is "no change"):
- q - query projection, the "what am I looking for" side of attention
- k - key projection, the "what do I contain" side
- v - value projection, the "what actually gets copied over" side
- out - the output projection that writes the attended result back into the feature stream
For a beginner, out is the one with the most visible effect, and q is the one that will surprise you. Drop out toward 0.7–0.8 and the image gets looser, less tightly structured; push it past 1.5 and things start falling apart. Stay within a whisper of 1.0 - this is a delicate instrument, not a slider you crank.
Wire it as Load Checkpoint → UNetSelfAttentionMultiply → KSampler. The output is a patched MODEL, same slot the checkpoint would occupy.
Where people get burned
The big one: this node matches keys by exact suffix, so it silently does nothing on architectures with different key layouts. Feed it a FLUX, SD3, or Wan model and you get a perfectly intact clone with zero patches applied - no error, no warning, identical output. It's built for the SD 1.5 / SDXL BasicTransformerBlock layout, full stop. If your result looks exactly like the input, that's not a bug, that's the node telling you it doesn't speak your model's language.
Otherwise, expect subtle effects. This is a coarse global knob, not a ControlNet. And because it patches the model for the whole run, it affects every image that pipeline produces - swap it out or set the knobs back to 1.0 to disable.
It ships with ComfyUI core, so there's nothing to install. Given the zero community footprint, treat it as an experiment - which is precisely what the "experimental" category is for.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| q | FLOAT | 1.000–10 | — |
| k | FLOAT | 1.000–10 | — |
| v | FLOAT | 1.000–10 | — |
| out | FLOAT | 1.000–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |