Nodes/ComfyUI_agilly1989_motorway/CLIPAttentionMultiply_motorway_edition
ComfyUI Node

CLIPAttentionMultiply_motorway_edition

Prompt-engineering voodoo, keyed in

By agilly1989·Created 2 years ago·Updated about a year ago· 7
CLIPAttentionMultiply_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
INPUT_clip_keyclip
q1.00
k1.00
v1.00
out1.00
OUTPUT_CLIP_keyCLIP

This one is a straight-up lab experiment wearing a node costume. CLIPAttentionMultiply is a core ComfyUI node that lives under _for_testing/attention_experiments, and it does what the name says: it multiplies the query, key, value and output projections inside the CLIP text encoder's attention layers. The _motorway_edition just re-wires that for agilly1989's Motorway pipe, so the CLIP comes out of the Motorway by key, gets fiddled with, and goes back in under a key you name.

If you don't already know why you'd want to scale attention projections in a text encoder, this isn't the node that's going to convince you. It's the kind of thing people tinker with when they're probing how the prompt encoder attends to words - an attention-modification experiment in the same spirit as the old "attn-mod" prompt-hacking tricks - and its results are as much vibes as science. The honest review: most people will never need it, and that's fine.

How it works

The wrapper pulls one thing out of the Motorway and writes one back:

  • INPUT_clip_key - key for the CLIP to modify (default clip)
  • q, k, v, out - four float multipliers, each default 1.0, range 0–10. 1.0 means "leave this projection alone"; anything else scales it.
  • OUTPUT_CLIP_key - where the modified CLIP goes (default CLIP)

The node instantiates the real core CLIPAttentionMultiply, applies your four multipliers to the attention projections, stores the modified CLIP under your output key, and returns the Motorway. Downstream, any CLIPTextEncode-family node that reads the CLIP key now encodes with the tweaked attention.

The four knobs are a lot of degrees of freedom with very little guidance attached - this is genuinely experimental territory. The useful approach is to change one multiplier at a time and compare. Changing all four at once tells you nothing about which one did what.

Motorway specifics

MOTORWAY 🚌💨 is required. The defaults assume your chain stored the CLIP under clip and want the result under CLIP - note those are different keys, which is intentional: the original is preserved and the modified version lands somewhere new. If you reuse the same key for input and output, the modified CLIP overwrites the original, since keys overwrite as they flow down the chain. A key that was never written throws the signature 'MotorwayClass' object has no attribute 'hash_' error, which just means you mistyped or read before anything wrote.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart, or find "ComfyUI_agilly1989_motorway" in ComfyUI Manager. No pip deps, no model downloads.

Fine print

The pack is an explicitly-beta side project - README opens "BIG BROKEN WITH ASYNC WILL FIX WHEN I GET THE TIME/MOTIVATION" - and the current hotfix release has the _motorway_edition clone generation commented out of __init__.py, so on the newest main these nodes may not load at all. If a workflow references them and they come up missing, that's the why. The README also flags that nodes with custom JS or output behavior are the least reliable members of the generated family; this one's an experimental node on top of that, so temper expectations. GitHub issues are the right channel; the author has said Discord DMs get ignored.

Categoryagilly1989 Nodes/Motorway-ed/_for_testing/attention_experiments

Inputs (7)

NameTypeDefaultDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨
INPUT_clip_keySTRINGclip
qFLOAT1.000–10
kFLOAT1.000–10
vFLOAT1.000–10
outFLOAT1.000–10
OUTPUT_CLIP_keySTRINGCLIP

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨