Region Attention
The node that actually does regional prompting on Flux
- model
- condition
- samples
- region1
- region2
- region3
- region4
- model
- condition
This is the node the whole pack exists for. Regional prompting - giving different parts of the image different prompts - has a long, architecture-specific history: Latent Couple and Regional Prompter on SD 1.5, Attention Couple and Forge Couple on Forge, and then a rebuild on every new model because the technique hooks directly into attention. Flux is a transformer-based DiT with 24 attention heads and a dual text encoder (CLIP-L plus T5-XXL), so none of the SD-era tools port over. RegionAttention is the Flux.1 answer: it patches Flux's attention in ComfyUI so each region's text only talks to the image area it owns.
You wire it like this. Your base prompt - the one that sets background and style - goes through a ClipTextEncodeFlux into condition. Each region's prompt gets its own ClipTextEncodeFlux, and that conditioning goes into either FluxRegionBBOX (a rectangle) or FluxRegionMask (a painted mask), whose REGION output lands in region1 (required) plus region2, region3, region4 (optional). samples takes your latent and sets the image size - the region masks are built at one-eighth of that. enabled defaults to true; flip it false and the node collapses to a plain passthrough, which is a handy way to A/B a region pass in one workflow.
Here's what actually happens when it runs, because it's clever and it's the source of the pack's quirks. RegionAttention concatenates each region's text embeddings onto the base conditioning, then builds an attention bias mask over the whole token stream - text plus image tokens. Within that mask, each region's text can only attend to image tokens inside its own area, image tokens from different regions are blocked from attending to each other, and overlapping intersections are zeroed out. It also scales each region's text tokens by the inverse of the region's area fraction, so a small region's prompt still pulls its weight instead of being drowned by a big one. Then it monkeypatches ComfyUI's Flux attention function to use that mask and returns the patched model plus the extended condition - feed both into your KSampler.
Two things you must know before you build around it.
First, the memory bill is real. The mask is expanded to [batch, 24 heads, L, L] in bf16, and L is the whole token stream plus all image tokens - at 1024×1024 that's a big square. The author is upfront: "This code is not optimized and has a memory leak. If you caught a OOM just try run a query again - works on my RTX 3080." That's not a joke. If you hit an out-of-memory error, rerunning genuinely often works, and on an 8–12 GB card you may need fp8 Flux to keep headroom.
Second, it overwrites Flux attention globally and doesn't reliably restore it. The author's own announcement called it "not a polished implementation that will break other workflows." Run this, then run a normal Flux workflow in the same session, and the patch can leak through. If your next generation comes out weird, restarting ComfyUI is the actual fix - keep this pack's workflow isolated or expect to relaunch.
One usage lever worth understanding comes straight from the README: the regional masking affects the T5-XXL embeddings, which is the part of Flux that understands full sentences. For the CLIP-L side you choose - feed the concatenated region prompts into the CLIP input of ClipTextEncodeFlux for stronger regional conditioning, or just the common prompt for weaker. Stronger holds regions apart better; weaker blends more naturally. Start with the concatenated prompt, dial back if you get seams.
Install is the standard two-step, same for the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/attashe/ComfyUI-FluxRegionAttention
then restart - or search "ComfyUI-FluxRegionAttention" in ComfyUI Manager. No model files to download; it works on the Flux.1 checkpoint you already have.
Troubleshooting, in order of likelihood: OOM → rerun, honestly. Region does nothing → mask all-black or box off-canvas. Visible seams or collaged look → regions overlapping, or you've hit this technique's known instability - it's train-free, so sometimes you just need different seeds or a reworded prompt. Per-region LoRAs are possible but the author reports only partial application ("simple masking doesn't work for some layers"). And note the hardcoded 24 heads: this is a Flux.1 (dev/schnell) tool, not a Flux 2 one. If you're on the newer architectures, this pack isn't for you - wait for someone to rebuild it, because somebody always does.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| condition | CONDITIONING | — | |
| samples | LATENT | — | |
| region1 | REGION | — | |
| enabled | BOOLEAN | true | — |
| region2opt | REGION | — | |
| region3opt | REGION | — | |
| region4opt | REGION | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| condition | CONDITIONING | — |