Nodes/ComfyUI Lackluster Nodes/Lackluster Model Attention Backend (All)
ComfyUI Node

Lackluster Model Attention Backend (All)

Pick a different attention kernel per model, without restarting ComfyUI

By LacklusterOpsec·Created 5 months ago·Updated 5 days ago· 1
Lackluster Model Attention Backend (All)
  • model
  • model
attention

The "All" in this node's name is doing real work. Most attention-switcher nodes hardcode a couple of kernels. This one builds its dropdown live from ComfyUI's attention registry, so whatever backends are actually registered in your install - stock or third-party - show up on their own. No version of the node to wait for when a new one ships.

It's a MODEL-patch node from the ComfyUI Lackluster Nodes pack: you feed it a loaded model, pick an attention backend, and get a patched clone back. The whole point is per-model control. ComfyUI's stock attention is fine, but SageAttention and friends are meaningfully faster and leaner on VRAM, so a lot of people force one globally with launch flags or env vars. That works great until it doesn't. Sage Attention, for instance, is known to corrupt specific models - Z-Image Base famously outputs patchy, matrix-code garbage with Sage enabled, while its Turbo sibling is fine. The community answer is "disable Sage globally, re-enable it per workflow." This node is that answer, generalised to every registered backend.

How it works

Under the hood it reads REGISTERED_ATTENTION_FUNCTIONS from comfy.ldm.modules.attention at startup and orders the dropdown (pytorch, sage, sub_quad, split, plus anything else registered, like flash, xformers, or comfy_kitchen_int8). When you queue, it clones the model and calls set_model_optimized_attention() - ComfyUI's official model-level attention override, added in PR #15479. It even validates your choice against the live registry at queue time and tells you exactly what's available if the backend you picked has vanished. It's clean, defensible code that leans on ComfyUI's own API rather than reaching into internals.

What you're choosing between, roughly:

  • pytorch - the default, always present, no surprises.
  • sage - SageAttention: the speed king, but it needs Triton, which is a genuinely painful manual install on Windows, and it can break specific models.
  • sub_quad - ComfyUI's memory-saver that splits the sequence into sub-quadrants; the pick for long sequences and video when you're VRAM-hungry.
  • split - the older split/quad implementation, mostly legacy.

The inputs that matter

There are only two, and you'll set one of them. model takes any MODEL - from a checkpoint loader, an unet loader, wherever. attention is the dropdown of registered backends. That's it. The single model output wires straight into your KSampler or whatever sampler node you're using.

Installing it

It ships in a grab-bag pack, so install the whole thing:

cd ComfyUI/custom_nodes
git clone https://github.com/LacklusterOpsec/ComfyUI-Lackluster-Nodes.git
cd ComfyUI-Lackluster-Nodes
pip install -r requirements.txt

Or in ComfyUI Manager, search "ComfyUI Lackluster Nodes" and hit Install, then restart. The pack's requirements are just requests and numpy - this node adds no heavy dependencies. What it does not do is install the backend for you. If you want Sage in that dropdown, SageAttention itself is a separate install, and you'll need a recent ComfyUI build that has set_model_optimized_attention().

Where people get burned

Two traps. First, the dropdown is generated when ComfyUI starts, so install a new backend plugin and you must restart before it appears. Second, a backend can be registered at startup but unavailable at queue time (a plugin didn't fully load, or you moved installs) - that's when you'll see the RuntimeError listing what's actually registered. Read that list; it's the truth about your environment. And remember the Sage caveat: fast for most models, corrupted output for a few. If a workflow suddenly looks broken after you switched backends, switch back to pytorch before you blame the sampler.

CategoryLackluster/Model

Inputs (2)

NameTypeDefaultDescription
modelMODEL
attentionCOMBO4 options: pytorch, sage, sub_quad, split

Outputs (1)

NameTypeDescription
modelMODEL