Apply Rave Attention
Temporal consistency without touching your latents
- model
- attn_override
- MODEL
This is the one node you actually need out of the ComfyUI-RAVE Attention pack. It's a zero-training temporal-consistency trick - a way to make a video, an AnimateDiff run, or an img2vid pass stop flickering and start borrowing coherent structure from its neighboring frames - and it does it by patching self-attention inside the UNet rather than by mangling your latents. That last part is the whole selling point, so let's start there.
RAVE, the paper, in one breath: "RAVE: Randomized Noise Shuffling for Fast and Consistent Video Editing with Diffusion Models," a CVPR 2024 Highlight from Ozgur Kara and colleagues. The idea is to shuffle noise across frames so a plain text-to-image diffusion model's self-attention can see spatio-temporal context - no extra training, no new weights. logtd's port implements it as a ComfyUI model patch, and it's the only node in the pack that does anything on its own.
How it works. Apply Rave Attention clones your model and patch-replaces self-attention (attn1) across the UNet's input, middle, and output blocks. Inside the replacement function, the batch of frames gets shuffled using your seed, then laid out as a grid - a contact sheet - with grid_size² frames per sheet. Self-attention then runs over the whole grid at once, so every spatial token attends across several frames in a single pass. The output gets split back apart and un-shuffled, restoring the original frame order. Crucially, the latent tensors themselves are never concatenated or resized - which is why this composes with AnimateDiff, ZeroScope/ModelScope, and FLATTEN, where implementations that stack frames into the latent break those tools. The README is explicit about that, and the source backs it up.
The inputs that matter:
model- your checkpoint's MODEL, straight out of CheckpointLoaderSimple.grid_size(INT, default 3) - the contact-sheet dimension. 3 means a 3×3 = 9-frame grid; 4 means 16. Bigger = more temporal context per attention pass, at the cost of VRAM and a tendency for frames to over-copy each other. Drop to 2 if you're bumping memory.seed(INT, default 0) - fixes the frame shuffle. Same seed, same neighbor relationships, reproducible output. Nudge it to get a different flavor of coherence.attn_override(optional) - theATTN_OVERRIDEsocket for the Attention Override nodes. Leave it empty and every block gets patched.
The single output is MODEL, and it replaces the checkpoint's model wire into your sampler. The pack's example workflow feeds it into both KSamplerAdvanced and ADE_UseEvolvedSampling (AnimateDiff), with the override unconnected.
Install. ComfyUI Manager, search "ComfyUI-RAVE Attention", or:
cd ComfyUI/custom_nodes
git clone https://github.com/logtd/ComfyUI-RAVE_ATTN
Restart ComfyUI. There's no requirements.txt and nothing to download - it runs on torch and einops, both already in ComfyUI.
Gotchas, earned from the source and the community:
- Frame count vs. grid. If your batch isn't a multiple of
grid_size², the code pads by duplicating random frames before gridding and crops them out after. It works, but duplicated frames can read as a tiny stutter. 16 frames at grid 3 is fine; 20 frames at grid 4 is not. Pad your clip to a multiple if you're fussy. grid_size1 is a kill switch - a 1×1 grid means each frame attends alone. Handy for A/B testing whether RAVE is doing anything at all.- It's a consistency tool, not a quality tool. People mostly reach for it to kill flicker - it shows up on r/comfyui as the fix for SD1.5 pipeline shimmer and as a relight first pass - so judge it by whether your video stops vibrating, not by whether individual frames get prettier.
- If nothing changes, check whether an override node is wired in and confirming the node actually sits between checkpoint and sampler.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| grid_size | INT | 31–10 | — |
| seed | INT | 00–18446744073709550000 | — |
| attn_overrideopt | ATTN_OVERRIDE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |