Nodes/ComfyUI_Fill-Nodes/FL Batch Align
ComfyUI Node

FL Batch Align

Shared attention so a batch stops looking like six artists

By filliptm·Created 3 years ago·Updated about 9 hours ago· 628
FL Batch Align
  • model
  • MODEL
share_norm
share_attn
scale1.0

Ever run a batch of 4–8 images off the same prompt and get wildly different lighting, palette, and composition on every one? FL_BatchAlign patches your model so images generated together in the same batch share attention statistics with each other, pulling them toward a consistent shared look - without a LoRA, an IPAdapter reference image, or a fixed-seed trick.

How it works

This is a ComfyUI implementation of the shared-attention idea behind Google Research's StyleAligned technique - the same general approach community members have been building standalone "StyleAligned node for ComfyUI" implementations around since late 2023. During sampling, the self-attention layers' queries and/or keys (and optionally values, too) get shared or blended across every image in the batch instead of each image attending purely to itself, and normalization layers get similarly shared (AdaIN-style) so overall color and contrast statistics match across the set. Composition still varies per image - this isn't producing four copies of the same picture - but palette, lighting, and general "vibe" pull toward a shared style, which is genuinely useful for things like a consistent set of character-sheet poses or a coherent multi-shot sequence, without training anything.

The inputs and outputs that matter

It's a model patcher: model in, patched model out - sample from the output exactly as you would from any other model.

  • share_norm - both / group / layer / disabled. Which normalization layers share statistics across the batch. both gives the strongest pull toward a consistent look; disabled turns this half of the effect off.
  • share_attn - q+k / q+k+v / disabled. Sharing just queries and keys nudges style while composition stays freer; sharing values too (q+k+v) is a stronger, more literal pull - closer to "these are variations of one underlying image" than "these share a palette."
  • scale (default 1, -2 to 2) - the overall strength dial. Bring it down toward 0 if consistency is overpowering the per-image variation you actually wanted. Pushing it negative is an unusual, more experimental case (actively working against consistency) rather than the typical use.

How to install it

ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes

then restart. This node has no special dependencies beyond torch - it's a pure attention/normalization patch on your existing model, no downloads, no API keys, unlike a lot of its packmates in this particular pack.

Common issues & troubleshooting

All images in the batch come out nearly identical. That's q+k+v sharing plus share_norm: both plus a high scale, all compounding - each independently pulls images together, and stacked at maximum strength they can flatten the per-prompt variation you were trying to keep. Back off to q+k and/or lower scale first.

No visible effect at all. Check share_norm and share_attn aren't both set to disabled - that combination is a no-op regardless of scale.

It "does nothing" on a single image. This node only makes sense with a real batch - the effect is defined relative to other images in the same batch, so it earns its keep specifically when your latent input is a genuine batch (4, 8, whatever you're generating together), not a batch size of 1.

Category🏵️Fill Nodes/experiments

Inputs (4)

NameTypeDefaultDescription
modelMODEL
share_normCOMBO4 options: both, group, layer, disabled
share_attnCOMBO3 options: q+k, q+k+v, disabled
scaleFLOAT1.0-2–2

Outputs (1)

NameTypeDescription
MODELMODEL