Nodes/ComfyUI/ModelAttentionBackend
ComfyUI Node Runs on cloud

ModelAttentionBackend

ModelAttentionBackend — Pick an Attention Engine Per Model, No Restart

By Comfy-Org·Created 4 years ago·Updated about 5 hours ago· 128,055
ModelAttentionBackend
  • model
  • MODEL
attention

Every big diffusion transformer spends most of its runtime - and most of its VRAM - inside attention. ComfyUI has a global default for how that math runs, but sometimes you want one model in the graph on a different engine without reconfiguring the whole install and restarting. That's this node: a per-model override that clones your model and swaps in the attention function you choose.

It sits exactly where you'd expect a model/patch node to sit - between the loader and the sampler - and it only changes the clone it outputs. The rest of your workflow keeps whatever backend it was using, which means you can run one model on the fast engine and another on plain PyTorch attention in the same session.

How it works

The mechanics are unglamorous: clone the model, then call set_model_optimized_attention() with the chosen function. Two backends exist:

  • pytorch attention - the reference implementation, always available, and the default.
  • comfy kitchen attention - int8 quantized Q/K attention from the comfy_kitchen project. 8-bit keys and queries mean less memory bandwidth per attention step, which usually reads as lower VRAM and faster attention on big video models, at the cost of a hair of precision.

Two things to know about the kitchen option. First, it only appears in the dropdown when the kitchen kernels are actually importable in your install - it's a conditional menu entry, not a grayed-out one. ComfyUI's "kitchen" builds bundle it; a stock build won't show it at all. Second, if you manage to select a backend that turns out to be unavailable, the node logs a warning and falls back to PyTorch attention silently rather than erroring - so a missing kitchen option is a sign you don't have a kitchen build, not a broken node.

The inputs

Just two:

  • model - the model whose attention you're swapping.
  • attention - the backend choice from the dropdown.

Output is a MODEL (the patched clone) to feed into your sampler. No model files to download, nothing to configure outside the graph.

Gotchas

  • If "comfy kitchen attention" isn't in the list, that's your answer - the node is telling you the kernel module isn't available. Don't go hunting for a node-level workaround.
  • Kitchen and Triton sometimes fight. The comfy_kitchen backend layer can disable Triton backends it detects, and there have been reports of users seeing disabled: True in their logs for Triton kernels after a kitchen build ships (a Reddit thread from January 2026 walks through exactly this, 1qjv9z2). If you're depending on SageAttention or Triton for a different model, glance at the console for "Found comfy_kitchen backend" lines before blaming a slowdown on this node.
  • It's a clone-and-swap, so the swap is per-model, not global. If you set a backend and don't see a difference in that model's numbers, check whether something downstream (a sampler, a different patch) is doing its own attention trickery.

How you get it

Ships with ComfyUI core - no install, no Manager. The node itself lives in nodes_model_advanced.py; the comfy-kitchen int8 option is the recent addition, landing in August 2026. If you're on a stock ComfyUI with a decent GPU and PyTorch attention is already fast enough, this node is a no-op you can ignore - reach for it when one specific model is eating your VRAM and you want to squeeze just that model.

Categorymodel/patch

Inputs (2)

NameTypeDefaultDescription
modelMODEL
attentionCOMBO1 options: pytorch attention

Outputs (1)

NameTypeDescription
MODELMODEL