RegionalAdaptiveSampling
The Regional Adaptive Sampling node
- model
- MODEL
Your Flux image is slow for a dumb reason. Every diffusion step runs attention over every token of the latent - including the hundreds of patches that haven't changed since step three and aren't going to. This node is the fix for that. It's a ComfyUI port of Microsoft's Regional Adaptive Sampling (RAS) technique, and it speeds up diffusion transformers by doing the obvious thing: only recomputing the parts of the image that are actually moving, and serving the rest from a cache.
Before you get excited, the name is doing a lot of work and "regional" doesn't mean what you think. This has nothing to do with regional prompting or conditioning regions. It means spatial regions of the image, judged by how much each patch's latent changed last step. And it's not a VRAM saver - the KV cache holds full tensors, so you're trading a bit of quality and some memory for attention compute, which is the real bottleneck for Flux at high res and for 14B video models like Wan.
How it works
On each step, the node looks at the model's output and computes the per-patch variance of the change. Patches with high variance are "live" - they're fed through the attention blocks as normal. Everything else gets its previous keys and values pulled from the cache, and its tokens are dropped from the actual attention computation. The first transformer block removes the dead tokens, the last one stitches the cached output back together. That's the whole trick, and it's a genuinely good one: attention cost is quadratic in token count, so halving the live tokens cuts way more than half the attention work.
It keeps a counter of how long each region has been starving for cached values and inflates the metric over time, which is what forces the model to eventually revisit the background. That's the starvation_scale knob below.
The inputs that matter
Wire a model in and a patched model comes out - the single MODEL output goes straight into your sampler's model input, exactly where the checkpoint loader would have gone.
- sample_ratio (default 0.5) - the fraction of tokens kept on a RAS pass. Below 0.3 the author flatly warns quality gets very bad. This is the main speed/quality dial.
- warmup_steps (default 4) - how many steps run without RAS at the start. Higher eats your speedup; too low and the composition degrades because the model never gets a clean early read of the scene.
- hydrate_every (default 4) - every N steps it does a full pass over every token to refresh the stale cache. Set to 0 to disable and run pure RAS everywhere.
- starvation_scale (default 0.1) - how hard the model rotates attention toward long-ignored regions. The README is honest: 0.1 is the paper's value, the author hasn't tried anything else, and cranking it up shifts quality from your subject to the background.
Install
ComfyUI Manager, search "ComfyUI-RegionalAdaptiveSampling", install, restart. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/Slickytail/ComfyUI-RegionalAdaptiveSampling
# restart ComfyUI
No model downloads, no GGUF, no separate checkpoint to fetch - it patches whatever model you hand it, in memory. It declares torch, einops, and diffusers as dependencies, which you already have if ComfyUI runs.
Where people get burned
This is v1.1.0, marked experimental, and it supports Flux (dev and schnell), HunyuanVideo, and some Wan variants. The author tested Wan2.1 VACE 1.3B T2I and Wan2.2 T2I 5B, and there are a lot of Wan variants out there - if yours doesn't work, that's a real bug, not you being dumb. Open an issue.
Three things to actually watch:
- No batch size > 1, and no CFG. The README lists both as unimplemented, likely forever, because the caching logic assumes one set of token indices per pass. Flux's default guidance path is fine, but any workflow that runs an actual CFG pass (the unconditional forward) will break or silently degrade. Keep CFG at 1.
- Apply it before your LoRAs. The source calls
unpatch_model()on a clone before wrapping, stripping existing weight patches. LoRAs applied before this node will silently vanish. Wire it right after the checkpoint loader and stack LoRAs downstream. - Don't treat it as free. Below ~0.3 sample ratio quality falls apart, and a low warmup hurts composition more than it helps your render time. The default 0.5/4/4/0.1 is a sane starting point - move one knob at a time.
Community signal is essentially zero right now: this pack is brand new, so you're on the frontier. But the technique is real, published Microsoft research, and for high-res Flux or video it's the kind of win that makes you wonder why every DiT doesn't ship with it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| sample_ratio | FLOAT | 0.500.05–1 | — |
| warmup_steps | INT | 40–100 | — |
| hydrate_every | INT | 40–100 | — |
| starvation_scale | FLOAT | 0.100.01–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |