Nodes/ComfyUI-UtilsCollection/Attention Bias Encode
ComfyUI Node

Attention Bias Encode

1.3) does nothing: Attention Bias Encode

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Attention Bias Encode
  • clip
  • conditioning
text

Here's the modern prompting trap in one line: you're on a Flux, Klein, or Krea-2-style model, you type (detailed face:1.4) the way you did on SDXL, and nothing changes. The weights are silently discarded - the KB's own measurement calls it "inert on LLM-encoded models." That's because your prompt is now wrapped in a chat template and fed to a general-purpose LLM encoder; there's no attention-weight parser listening for parentheses anymore.

This node is an experimental attempt to give you some of that power back, using attention bias instead of prompt weights. The syntax is <word=strength> markers: a prompt like portrait of <eyes=2.5> a person tells it to emphasize "eyes" 2.5x relative to the rest. It's experimental (the author says so in the schema), it's aimed at the Qwen3-VL-style encoders these models use, and it's exactly the kind of edge-of-the-envelope tooling you expect from this pack's author - who's been living in VLM-conditioning land since long before H3 shipped.

How it actually works matters, because it tells you what the limits are. The node scans your text for <text=strength> markers, strips them out, tokenizes the clean text, and then adds the logarithm of each strength to the key columns of the conditioning's attention_mask for those tokens' range. Boosting attention keys rather than values is a deliberately conservative choice - it nudges the model to pay attention to those tokens without re-scaling the whole embedding. Two hard constraints fall out of the implementation: strengths must be finite and non-negative (a negative or NaN strength raises an error), and the node needs a clip that produces a real attention mask in its metadata, which is why it's coupled to the modern encoder pipeline. Text with no <, >, or = characters skips the whole bias machinery and just does a normal tokenize-and-encode, so it degrades gracefully.

Inputs are minimal: clip and a multiline text. Output is a single conditioning, wired straight into the same sampler positive input you'd use with any text encode. There's also a legacy alias AttentionBiasTextEncode that the pack still registers, so old workflows keep loading.

One fair warning: this is a niche tool with real tuning ahead of it. You won't find consensus on "what strengths to use" because almost nobody is running it yet - it's marked experimental for a reason. Start at strength 1.5–2.0 on one short phrase, compare against the same prompt without markers, and treat it as a scalpel, not a sledgehammer. If you're on a classic SDXL checkpoint, skip this entirely - plain (word:1.3) still works there and this node is aimed at the LLM-encoded generation models where that stopped.

Install is pack-standard: ComfyUI Manager search "ComfyUI-UtilsCollection", or git clone https://github.com/silveroxides/ComfyUI-UtilsCollection into ComfyUI/custom_nodes and restart. No models, no extra downloads - this one runs entirely on the CLIP/text encoder you already have loaded.

Categoryadvanced/conditioning

Inputs (2)

NameTypeDefaultDescription
clipCLIP
textSTRING

Outputs (1)

NameTypeDescription
conditioningCONDITIONING