Flux Attention Control
The node that actually enforces regional prompts on Flux
- model
- condition
- latent_dimensions
- region1
- region2
- region3
- model
- conditioning
This is the engine of the Flux Region pipeline. Everything before it - the masks, the boxes, the per-region prompts - is setup. This node is where the actual enforcement happens: it reaches into Flux's attention layers and overrides them so each region's prompt only acts inside its own area. It's the difference between "I described three regions" and "the model actually painted three regions."
Regional prompting always comes down to masking attention. The craft is which attention you mask and for how long - mask the text tokens and regions leak into each other; mask the image tokens and the bounds hold but regions stop being aware of each other. This node is ControlAltAI's take on doing that on Flux's transformer, and it's genuinely the technically deepest node in the pack.
How it works
It takes your model, the base condition, a latent_dimensions reference (so it knows the canvas size to build the attention mask against), and the region outputs from the Region Mask Conditioning node. Then it rewrites Flux's attention using those regions plus a feather radius per region, and passes a patched model and conditioning to your sampler.
The enabled toggle matters more than it looks: when it's off, the node just passes the base conditioning straight through to the sampler with no regional override at all. So you can A/B "regions on vs. regions off" by flipping one boolean.
Feathering is the pressure-release valve. Regions that touch or slightly overlap would otherwise produce hard seams; feather_radius (0-100) softens the boundary. The author notes feathering is also what quietly resolves the "regions must not overlap" rule the Validator enforces - a bit of overlap is fine because feather blends it.
The inputs and outputs that matter
region1(+ optionalregion2,region3) - the REGION objects from Region Mask Conditioning.number_of_regions- keep it consistent with the rest of the chain.enabled- your on/off for the whole regional effect.feather_radius1/2/3- soften region edges; raise it if you're seeing seams, keep it low for crisp separation.
Outputs: a patched model and a conditioning, both into your sampler (this pack's Flux Sampler works well here). Downstream you should also run the pipeline's Flux Attention Cleanup node, because this override has to be undone cleanly when you switch workflows.
How to install it
ComfyUI Manager → ControlAltAI Nodes → install → restart, or clone the repo. But the part that actually matters for this node: it requires XFormers, matched to your PyTorch version. This isn't optional. Check your torch version and install a compatible xformers - the repo ships an xformers_instructions.txt for exactly this. If XFormers is missing or mismatched, this node is where your pipeline falls over.
Common issues
The signature error is a tensor/attention shape mismatch - something like Invalid shape for attention bias: torch.Size([1, 24, 5264, 5264]) (expected ...). That's not a VRAM problem and there's no magic size limit; it's the attention matrix growing past what the architecture can align when your prompts are too long or your regions too many/too complex. The fix is to shorten prompts (each CLIP under ~80 tokens) and simplify regions, not to buy a bigger GPU.
The other one people hit: switching to a different workflow after running this and getting a tensor mismatch, because the attention override is still live. That's exactly what the Flux Attention Cleanup node is for - it restores Flux's original attention on a workflow switch without needing a manual model unload (which, per the author, doesn't even work here). Always keep Cleanup in the graph.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| condition | CONDITIONING | — | |
| latent_dimensions | LATENT | — | |
| region1 | REGION | — | |
| number_of_regions | INT | 11–3 | — |
| enabled | BOOLEAN | true | — |
| feather_radius1 | FLOAT | 00–100 | — |
| region2opt | REGION | — | |
| feather_radius2opt | FLOAT | 00–100 | — |
| region3opt | REGION | — | |
| feather_radius3opt | FLOAT | 00–100 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| conditioning | CONDITIONING | — |