Nodes/ComfyUI/UNetCrossAttentionMultiply
ComfyUI Node Runs on cloud

UNetCrossAttentionMultiply

Scaling your UNet's cross-attention, minus the LoRA

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,962
UNetCrossAttentionMultiply
  • model
  • MODEL
q1.00
k1.00
v1.00
out1.00

UNetCrossAttentionMultiply is the sibling of UNetSelfAttentionMultiply, and it targets the layer where your text actually gets into the image: cross-attention. In SD 1.5 and SDXL UNets that's the attn2 block - the one that attends to your prompt tokens. This node lets you scale its weights up or down with four floats, so you can make a generation lean harder on the prompt or stop listening to it, without touching CFG scale and without training anything.

Why would you reach for it? Cross-attention is where prompt adherence lives. LoRAs work by patching those same layers - the KB's concepts essay puts it plainly: "LoRAs work by applying lightweight adjustments to the checkpoint's cross-attention layers." This node is the blunt, untrained version of that idea. Crank k and v down and the model attends to the text less, which shows up as more compositional freedom and worse fidelity to what you actually typed. Push them up and it clings to the prompt more tightly. It's a global, coarse dial - every cross-attention layer at once - which makes it useless for the surgical, per-concept control a trained LoRA gives you, but genuinely useful when you want one consistent nudge across an entire pipeline.

How it works

Same machinery as its sibling: the node clones the model, walks the state dict, and registers a runtime patch on every key ending attn2.to_q, attn2.to_k, attn2.to_v, or attn2.to_out.0 (weights and biases). At inference the patch multiplies each weight by your factor - the same weight *= scale path that LoRA/ControlNet-style patches ride. Nothing is written to disk, and the base model file stays untouched.

The k and v projections carry the actual text information into the layer, which is why lowering those two is the classic "weaken the prompt" move. out controls how strongly the attended result writes back into the feature stream. q is subtler - it's the "what am I looking for" side, and scaling it changes the shape of attention without removing information.

Wire it like the other model-patch nodes:

Load Checkpoint → UNetCrossAttentionMultiply → KSampler

Output is a patched MODEL, and it stacks multiplicatively with LoRAs and other patches on the same keys.

The traps

The exact-suffix matching bites here just as hard as on the self-attention version. This node knows attn2.to_q naming and nothing else, so FLUX, SD3, and Wan models produce a silent no-op - an untouched clone, identical output, no error. It's an SD 1.5 / SDXL tool. And the effect is coarse: you're scaling every cross-attention layer by the same factor, which is a different animal from a ControlNet or a well-tuned LoRA. Expect subtle shifts, not miracles. Keep the values within a few percent of 1.0; below ~0.5 or above ~1.5 and the prompt stops meaning much of anything.

It ships with ComfyUI core - no install, no Manager entry. It's marked experimental, it's barely used (this page has zero impressions to its name), and honestly its best use is as a probe: dial k/v down a notch, render, and you'll learn something real about how much of your image was the prompt and how much was the model dreaming.

Categoryexperimental/attention_experiments

Inputs (5)

NameTypeDefaultDescription
modelMODEL
qFLOAT1.000–10
kFLOAT1.000–10
vFLOAT1.000–10
outFLOAT1.000–10

Outputs (1)

NameTypeDescription
MODELMODEL