What Sage Attention does and why you might want it

Sage Attention is an optimization that makes image generation faster and uses less memory in ComfyUI by changing how the model processes attention — the mechanism that decides which parts of your prompt matter most when building an image. If you run ComfyUI on a machine with limited VRAM (video memory), or if you want faster generation times, Sage Attention can reduce memory use by roughly 30 to 50 percent depending on your hardware and image size.

ComfyUI is a node-based interface for running Stable Diffusion and other image models locally. Sage Attention is one of several attention optimizations available — others include xFormers and Flash Attention — but it works on most GPUs without requiring extra compilation, which makes it simpler to install than some alternatives.

You do not need Sage Attention to use ComfyUI. It is optional. But if you have hit memory limits or wait times that frustrate you, installing it takes about five minutes and requires only a few terminal commands.

Key Takeaways

  • Sage Attention installs as a custom node in ComfyUI using git clone, then you enable it in the UI by selecting it from a dropdown menu.
  • You need git installed on your machine and a working ComfyUI installation; the process is the same on Windows, Mac, and Linux.
  • After installation, restart ComfyUI and look for "Sage" in the KSampler node's attention method dropdown to turn it on.
  • Sage Attention works best on NVIDIA GPUs; AMD and Intel support exists but may be slower or require additional setup.

Before you start: what you need

You need three things: ComfyUI already installed and running, git installed on your machine, and access to a terminal or command prompt. If you have never opened a terminal before, that is fine — the commands are short and you only type them once.

Check that ComfyUI works first. Open it, load a model, and generate one image to confirm everything runs. If you skip this step and something breaks during the Sage installation, you will not know whether the problem is Sage or something else.

To check if git is installed, open a terminal (Command Prompt on Windows, Terminal on Mac or Linux) and type git --version. If you see a version number, you have git. If you see "command not found" or similar, download git from git-scm.com and install it, then restart your terminal.

Installing Sage Attention as a custom node

ComfyUI loads custom nodes from a folder called custom_nodes inside your ComfyUI directory. Sage Attention lives in that folder as a git repository, which means you download it using a single git command rather than manually copying files.

Open a terminal and navigate to your ComfyUI custom_nodes folder. On Windows, if ComfyUI is in C:\Users\YourName\ComfyUI, you would type:

cd C:\Users\YourName\ComfyUI\custom_nodes

On Mac or Linux, if ComfyUI is in your home directory, type:

cd ~/ComfyUI/custom_nodes

Once you are in the custom_nodes folder, type this command:

git clone https://github.com/comfyanonymous/SageAttention.git

Git will download the Sage Attention files into a new folder called SageAttention. This takes less than a minute. When the download finishes, you will see your terminal prompt return.

Restarting ComfyUI and enabling Sage Attention

Close ComfyUI completely — not just the browser window, but the server itself. If you are running it from a terminal, press Ctrl+C to stop it. Wait a few seconds, then restart ComfyUI the way you normally do.

When ComfyUI restarts, it scans the custom_nodes folder and loads Sage Attention automatically. You do not need to do anything else to load it. Open the UI in your browser and load a workflow that uses KSampler (the node that actually generates images).

In the KSampler node, look for a dropdown labeled attn_method or attention method. Click it. You should see "Sage" as one of the options, along with "default", "xFormers", or others depending on what you have installed. Select "Sage".

Generate an image. If it works, Sage Attention is now active. If you see an error, check the terminal where ComfyUI is running — the error message there will tell you what went wrong.

Troubleshooting common installation problems

If you see "git: command not found" when you run the clone command, git is not installed or not in your system path. Download it from git-scm.com, install it, and restart your terminal completely (close and reopen it). Then try the clone command again.

If ComfyUI starts but Sage does not appear in the attention dropdown, the custom node did not load. Check that the SageAttention folder exists in custom_nodes by opening a file browser and navigating there. If the folder is empty or missing, the git clone command did not finish. Try running it again.

If you see an error when you try to generate an image with Sage selected, your GPU may not support it. This is rare, but it happens on some older NVIDIA cards and on AMD or Intel GPUs without the right drivers. Switch back to "default" attention and the error should stop. You can still use ComfyUI normally.

If ComfyUI crashes after you install Sage, restart it and check the terminal output. If the error mentions "CUDA" or "memory", your GPU may not have enough VRAM for Sage on your current image size. Try generating a smaller image, or switch to a different attention method.

How to uninstall Sage Attention if you need to

Uninstalling is simple: delete the SageAttention folder from custom_nodes, then restart ComfyUI. The attention dropdown will no longer show Sage as an option.

You can also disable it without deleting it by renaming the folder to something like SageAttention_disabled. ComfyUI will skip folders it does not recognize as valid custom nodes. Rename it back to SageAttention to re-enable it.

Frequently Asked Questions

Will Sage Attention work on my AMD or Intel GPU?

Sage Attention is optimized for NVIDIA GPUs and works best there. AMD GPUs may work but often run slower than the default attention method. Intel Arc GPUs have limited support. If you install it and generation is slower, not faster, switch back to default attention.

Do I need to update Sage Attention, and how?

Updates are rare, but if you want the latest version, open a terminal in the SageAttention folder and run git pull. This downloads any new changes. Restart ComfyUI after pulling.

Can I use Sage Attention with other custom nodes?

Yes. Sage Attention is just an attention optimization and does not conflict with other custom nodes. You can install and use it alongside ControlNet, IP-Adapter, or any other node.

What if I do not see a performance improvement?

Performance gains depend on your GPU, image size, and model. Smaller images or models that already run fast may show little difference. The main benefit is reduced memory use, which matters most if you were hitting out-of-memory errors before.

Is Sage Attention the same as xFormers?

No. Both are attention optimizations, but they work differently. Sage is newer and does not require compilation, while xFormers is older and faster on some setups but harder to install. You can only use one at a time in the attention dropdown.