Nodes/ComfyUI-UtilsCollection/Krea2 Token Attention Weight
ComfyUI Node

Krea2 Token Attention Weight

Phrase-level attention weights for Krea 2, not just prompt emphasis

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Krea2 Token Attention Weight
  • model
  • clip
  • image_inputs
  • visual_fusion_config
  • vae
  • MODEL
  • CONDITIONING
prompt
system_prompt
attention_weights
vlm_resolution384
strength1.00
formula
padding_methodzero-pad
vae_resolutionFast (1024)
ref_latent_modeoff
multiplier1.0
vae_dimension_multiple8

Prompt weighting on Krea 2 is a known pain point: the model uses a Qwen3-VL text encoder plus visual conditioning, and the usual (word:1.2) trick works inconsistently because it only nudges the text tokens. UC_Krea2TokenAttentionWeight goes further - it monkeypatches Krea 2's attention layers so you can weight individual phrases as attention odds, and it does it while re-encoding the full multimodal conditioning (text plus reference images). (arms:1.5) genuinely raises the attention those tokens command across the model's blocks, not just the emphasis on the token embedding.

If you've been fighting Krea 2 to obey a specific detail - "arms crossed", "red jacket", "the painting in the background" - this is the node for that fight.

How it works

You connect your Krea 2 model and the clip (the Qwen3-VL text encoder), write the prompt, and give attention_weights a space-separated list like (arms:1.5) (painting:0) (photo:2). The node patches the attention forward pass so those tokens' attention is scaled by the given odds - a value of 0 suppresses a phrase hard, 2 roughly doubles its pull. strength is a global multiplier on the whole effect, and per the tooltip it compounds over all blocks, so a little goes a long way - start at 1.0 and dial down.

The full input list is long because this is the heavyweight multimodal encoder: vlm_resolution (semantic image path, 384 default), vae_resolution (structural path via the VAE), ref_latent_mode (whether reference latents are appended to the main stream or run in a separate "parallel" stream to avoid overriding semantics), system_prompt, formula, padding_method, multiplier (a final overall scale on the conditioning vector), and the autogrowing image_inputs for your reference images. The optional visual_fusion_config input accepts a config from this pack's UC_VisualFusionConfig node to blend visual blocks spatially; when that's disconnected, padding_method and formula become the fallback controls.

Outputs: a patched MODEL (route this into your sampler) and a CONDITIONING (route into positive/negative conditioning).

What to know before you click

This is a genuine power tool with a real learning curve. The attention_weights syntax is (phrase:odds) pairs, space-separated, non-negative - and if a phrase in the weights doesn't appear in the prompt, it silently does nothing. The author also notes numbered multi-image inline placement is intentionally not supported here (use the fusion config path instead), and fusion only accepts image_input_fusion or image_input_1 for its single visual slot.

It's the non-TokenFusion variant of the node. This one does the attention weighting during a single conditioning encode; the ...TokenFusion sibling applies the weights after a token-first visual fusion pass. For most single-image, single-prompt work this is the one to reach for.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart (or ComfyUI Manager → search "ComfyUI-UtilsCollection"). Needs the full Krea 2 stack - checkpoint, Qwen3-VL text encoder (~8GB), Qwen-Image VAE - plus the pack's own opencv-python / typing-extensions. On a 16GB card you'll want to keep vlm_resolution at the Fast setting and watch VRAM; this node loads and patches real attention weights, it's not a string utility.

Categoryadvanced/conditioning

Inputs (16)

NameTypeDefaultDescription
modelMODELDiffusion model to apply the attention monkeypatch to.
clipCLIPCLIP/T5 dual text encoder reference.
promptSTRINGMain prompt. Fusion accepts image_input_fusion or image_input_1 for its single visual slot. Numbered multi-image inline placement is intentionally unavailable in this attention node.
system_promptSTRINGSystem prompt injected prior to user description.
attention_weightsSTRINGSpace-separated non-negative attention odds weights. Example: (arms:1.5) (painting:0) (photo:2)
vlm_resolutionINT3840–4096Equivalent-square VLM target from 256 to 3584. Values outside that range preserve original resolution.
strengthFLOAT1.000–4Global multiplier on the weighting effect. Effect compounds over all blocks.
formulaSTRINGOptional conditioning formula used only when visual fusion is off. Empty selects the first image pass.
padding_methodCOMBOzero-padAlignment method for images with different aspect ratios/resolutions. Active ONLY if visual_fusion_config is disconnected or set to 'off'.
vae_resolutionCOMBOFast (1024)Resolution of the reference latent encoded by the VAE (structural path).
ref_latent_modeCOMBOoffReference latent encoding mode. 'single'/'multi' append latents; 'parallel-single'/'parallel-multi' run them in a separate conditioning stream to prevent semantic override.
multiplierFLOAT1.0-1000–1000Overall multiplier applied to the final conditioning vector.
vae_dimension_multipleINT84–256Pixel multiple used to align reference images before VAE encoding.
image_inputsCOMFY_AUTOGROW_V3Multimodal images. Maps active inputs sequentially to variables (a, b, c, ...).
visual_fusion_configoptVISUAL_FUSION_CONFIGOptional spatial visual fusion configuration from UC_VisualFusionConfig. Blends isolated visual blocks without coordinate blur.
vaeoptVAE

Outputs (2)

NameTypeDescription
MODELMODEL
CONDITIONINGCONDITIONING