SelfAttentionGuidance_motorway_edition
A subtle composition booster, Motorway edition
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
Self-Attention Guidance (SAG) is one of those "refiner" tricks that's easy to describe and hard to predict: it nudges the model to pay more attention to its own high-level structure during sampling. SelfAttentionGuidance_motorway_edition clones ComfyUI's built-in SelfAttentionGuidance (a _for_testing node), and it's a model wrapper - it takes a MODEL on the way in, wraps it in SAG logic, and hands back a MODEL you then use for sampling. No images pass through it; it modifies the model's behavior.
The mechanism, roughly: during each sampling step it masks out the image's own self-attention at the lowest-resolution level and compares the result with the unmasked one, using the difference to guide the denoiser. The practical effect is a nudge toward cleaner composition and detail - the kind of thing that can give slightly mushy outputs a bit more structure. The caveats are the usual for _for_testing: it adds compute per step, the effect is subtle, and whether it helps depends a lot on the model and sampler you're pairing it with. Some people swear by a light touch of SAG on SD 1.5/SDXL; others find it does nothing but slow rendering. It's a "try it on your own setup" node, not a "always on" one.
The widgets:
- scale (default 0.5, −2 to 5) - how strongly the self-attention discrepancy is applied. 0.5 is a gentle nudge; crank it and you'll see artifacts before you see "better."
- blur_sigma (default 2.0, 0–10) - the blur used on the masked self-attention map. Leave it at 2 unless you're tuning; it's the kind of knob you set once and forget.
Plumbing: it reads the model from the bus via INPUT_model_key (default model) and writes the wrapped model back under OUTPUT_MODEL_key (default MODEL). Wire that key into the rest of your sampling chain and you're sampling with SAG applied.
Installing it
Part of ComfyUI_agilly1989_motorway. ComfyUI Manager: search ComfyUI_agilly1989_motorway, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
No extra dependencies, no model files.
The catch
Standard pack caveats, plus one specific to this node. The clones ship disabled in release 1.1.7 - uncomment the two ClonedNodeMapping lines in custom_nodes/ComfyUI_agilly1989_motorway/__init__.py and restart. The README is a solo dev's honest beta ("BIG BROKEN WITH ASYNC WILL FIX WHEN I GET THE TIME/MOTIVATION" is the first line). And remember SAG itself is upstream's experimental code - the pack didn't invent it, so the "does it help?" question is one the wider community is still split on. Expect to spend an afternoon A/B-ing it before you decide if it's worth the extra seconds per image.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_model_key | STRING | model | — |
| scale | FLOAT | 0.50-2–5 | — |
| blur_sigma | FLOAT | 2.00–10 | — |
| OUTPUT_MODEL_key | STRING | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |