Nodes/advanced-cfg-controller/⏭️ Attention Modifier Single Layer Bypass
ComfyUI Node

⏭️ Attention Modifier Single Layer Bypass

The scalpel modifier

By FlareAI-Studios·Created 8 months ago·Updated 8 months ago· 1
⏭️ Attention Modifier Single Layer Bypass
  • join_parameters
  • Attention modifier
  • Parameters as string
sigma_start1000.0
sigma_end0.0
block_nameInput Blocks
block_number0
unet_attnBoth Attention Types

Every once in a while the fix for a weird artifact is not more conditioning - it's less. A single attention layer is over-active, and its output is polluting the image. Attention Modifier Single Layer Bypass targets exactly one layer and one attention type and simply takes it out of the loop for a slice of the denoising run. Where the pack's Parameters node lets you rewrite attention with an expression, this one just turns the layer off. Simpler, and for a lot of experiments, that's what you actually want.

The three coordinates

Like every member of the family, it's a targeting exercise. The inputs are the coordinates:

  • block_name - Input Blocks, Middle Block, or Output Blocks (the UNet's three block groups).
  • block_number - which block within that group, 0–12.
  • unet_attn - Self-Attention Only (attn1), Cross-Attention Only (attn2), or Both.
  • sigma_start / sigma_end - when the bypass is active. This is the control that keeps the experiment sane: bypassing a layer for the whole run is heavy-handed, but gating it to high sigma (say 1000 → 5) only skips it during the early structure-forming phase.
  • join_parameters (optional) - append this onto an existing ATTNMOD chain.

Outputs are the usual pair: the Attention modifier (ATTNMOD wire) and a Parameters as string that shows what's actually in the payload.

The honest mechanics

Read the source and there's a telling detail: the bypass sets the attention expression to "q" - an expression that resolves to essentially "do nothing with attention here," which is the pack's way of stubbing the layer out. So "bypass" really means "patch this block's attention to a no-op," and like the rest of the attention-modifier sub-system it's young and lightly tested. The pipe dream is diagnosing artifacts by elimination - mute one layer, see what changes, repeat - which is a genuinely useful workflow when the model is doing something you can't explain. The reality is you'll spend a while hunting for the right block, because nothing about which layer is to blame is written anywhere.

One thing that's easy to get backwards: the ATTNMOD output does nothing until it reaches the Advanced CFG Controller (Expert) node's attention_modifiers_positive / _negative / _global inputs, and the bypass only matters if that controller is actually in your graph. And remember what you're not doing here - this doesn't touch CFG, it doesn't remove the layer's weights, it just skips its attention computation inside the sigma window you set. If your artifact is a composition-level thing, no single layer bypass will fix it; if it's a layer-level thing, this is the cheapest scalpel the pack gives you. Install is the same one-liner as the rest of the pack (git clone into custom_nodes, restart), and it lives under model_patches/Advanced_CFG_Controller/attention_modifiers.

Categorymodel_patches/Advanced_CFG_Controller/attention_modifiers

Inputs (6)

NameTypeDefaultDescription
sigma_startFLOAT1000.00–10000Start bypassing attention at this sigma level
sigma_endFLOAT0.00–10000Stop bypassing attention at this sigma level
block_nameCOMBOInput BlocksWhich UNet block type to modify
block_numberINT00–12Specific block number within the block type
unet_attnCOMBOBoth Attention TypesWhich attention layers to bypass
join_parametersoptATTNMODChain multiple attention modifiers together

Outputs (2)

NameTypeDescription
Attention modifierATTNMOD
Parameters as stringSTRING