ComfyUI Node

Shape attention

Turn the volume up on SDXL's shape layer — or turn it all the way off

By Extraltodeus·Created 2 years ago·Updated about a year ago· 66
Shape attention
  • model
  • MODEL
scale1.5

Some attention layers in a diffusion model do more than others. In SDXL, input layer 8's self-attention is one of the heavy hitters for overall shape - how objects are composed, how the image's structure holds together. "Shape attention" is a single-purpose node that patches exactly that layer and scales its output. The README describes it in one line: "for SDXL, can turn off the input layer 8." You get a scale slider, and that's basically the whole node.

Mechanically, it's a model patch that wraps the self-attention function on the input block the author found most responsible for composition. Each forward pass through that layer multiplies the attention output by scale. Set it above 1 and that layer's influence is amplified - structure and composition get pushed harder. Set it below 1 and it's dampened. Set it to 0 and the attention output is zeroed, which is the "turn off the input layer 8" trick: the shape layer stops contributing entirely, which is a fascinating probe into what SDXL is actually doing and can produce deliberate, structure-relaxed compositions. Set it to exactly 1 and the node logs "Shape attention disabled" and passes your model through untouched - that's your neutral/off state.

The inputs:

  • model - MODEL in, patched MODEL out, wired between your checkpoint loader and KSampler.
  • scale - 0 to 10, default 1.5. Above 1 amplifies, 0 kills the layer, 1 disables.

Note there's no sigma window and no enabled toggle exposed (they're commented out in the source - the author kept the surface minimal). The patch applies every step, everywhere, for the whole run. If you want it only on part of the denoising, you'll need to chain a bypass or timer around it.

Now the honest part. This is a tinkerer's node, and it sits in the model_patches category rather than the "Pre CFG" family because it doesn't touch the cond/uncond predictions at all - it patches attention directly, on every pass. It's not the one you reach for to fix a specific problem; it's the one you reach for to understand SDXL, or to make a deliberate style decision about how rigid your composition is. Blowing past 2.5 on scale will start to warp images in interesting or ugly ways, and that's the point - explore.

It's also strictly SDXL-flavored by design: the author's whole testing story for this pack is SDXL, and "turn off input layer 8" is a claim about SDXL's architecture specifically. On other model families the same layer index won't mean the same thing, so don't expect the behavior to transfer.

Installation is the whole-pack one-liner:

cd ComfyUI/custom_nodes && git clone https://github.com/Extraltodeus/pre_cfg_comfy_nodes_for_ComfyUI

or ComfyUI Manager → search pre_cfg_comfy_nodes_for_ComfyUI → restart. No dependencies, no model downloads. Start at the 1.5 default, then try 0 - turning off the shape layer entirely is the quickest way to see what this layer actually owns.

Categorymodel_patches

Inputs (2)

NameTypeDefaultDescription
modelMODEL
scaleFLOAT1.50–10

Outputs (1)

NameTypeDescription
MODELMODEL