Nodes/advanced-cfg-controller/🌑️ Attention Modifier Single Layer Temperature
ComfyUI Node

🌑️ Attention Modifier Single Layer Temperature

Sharpen or soften one block

By FlareAI-StudiosΒ·Created 8 months agoΒ·Updated 8 months agoΒ· 1
🌑️ Attention Modifier Single Layer Temperature
  • join_parameters
  • Attention modifier
  • Parameters as string
β—„sigma_start1000.0β–Ί
β—„sigma_end0.0β–Ί
β—„block_nameInput Blocksβ–Ί
β—„block_number0β–Ί
β—„unet_attnBoth Attention Typesβ–Ί
β—„temperature1.00β–Ί

Attention temperature is the dial that sits between "too deterministic" and "too diffuse." Before the softmax, attention logits are divided by a temperature; below 1.0 the distribution sharpens (fewer, stronger attention targets - crisper, more focused), above 1.0 it softens (more diffuse mixing - smoother, less spiky). You almost never get to set that per layer. Attention Modifier Single Layer Temperature does exactly that: apply a temperature scaling to one attention layer's computation, for a chosen sigma window, and nothing else.

The inputs

The usual targeting trio, plus one number:

  • block_name - Input Blocks, Middle Block, or Output Blocks.
  • block_number - the block within that group (0–12).
  • unet_attn - Self-Attention Only, Cross-Attention Only, or Both.
  • temperature - the dial itself. 1.0 is no change (the tooltip is explicit: "<1.0 = sharper, >1.0 = softer"). A 0.85 on a block that's producing mushy anatomy, a 1.1 on one that's spiking artifacts - those are the realistic moves.
  • sigma_start / sigma_end - when it's active; keep it narrow to isolate the effect.
  • join_parameters (optional) - chain onto an existing ATTNMOD.

Outputs: the Attention modifier (ATTNMOD wire) and Parameters as string.

How it works, and the honest caveat

The node builds a payload whose expression calls a temperature_patcher(...) helper - a class that reimplements ComfyUI's basic attention with a temperature applied to the logits before softmax. If you've ever poked at comfy.ldm.modules.attention, the code will look familiar, because it's a copy of the basic path with the temperature baked into the scale factor.

Here's the part worth knowing before you build a workflow around it: in this early release, the temperature_patcher class lives in an experimental_temperature.py module that the pack doesn't actually import, and the modifier sub-system's expression handling is minimal. The upshot is this node is the roughest of a rough bunch - it can throw at generation time until the pack wires that helper in. If it does error, that's not your graph's fault, and there's no community to ask yet; this pack has zero footprint out in the wild. My take: it's a fun idea worth one afternoon of experimentation, but don't put it in anything you need to ship today.

When it works, the pattern is: feed the ATTNMOD into the Advanced CFG Controller (Expert) node's attention_modifiers_positive input, keep the sigma window tight, and watch what one block's sharpness does to your output. Install is the pack's usual git clone into custom_nodes plus restart - no models, no extra deps, node lives under model_patches/Advanced_CFG_Controller/attention_modifiers.

Categorymodel_patches/Advanced_CFG_Controller/attention_modifiers

Inputs (7)

NameTypeDefaultDescription
sigma_startFLOAT1000.00–10000Start applying temperature scaling at this sigma level
sigma_endFLOAT0.00–10000Stop applying temperature scaling 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 apply temperature scaling
temperatureFLOAT1.000–10000Temperature scaling factor (1.0 = no change, <1.0 = sharper, >1.0 = softer)
join_parametersoptATTNMODChain multiple attention modifiers together

Outputs (2)

NameTypeDescription
Attention modifierATTNMODβ€”
Parameters as stringSTRINGβ€”