Krea2 Token Attention Weight
Phrase-level attention weights for Krea 2, not just prompt emphasis
- model
- clip
- image_inputs
- visual_fusion_config
- vae
- MODEL
- CONDITIONING
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.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Diffusion model to apply the attention monkeypatch to. | |
| clip | CLIP | CLIP/T5 dual text encoder reference. | |
| prompt | STRING | Main 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_prompt | STRING | System prompt injected prior to user description. | |
| attention_weights | STRING | Space-separated non-negative attention odds weights. Example: (arms:1.5) (painting:0) (photo:2) | |
| vlm_resolution | INT | 3840–4096 | Equivalent-square VLM target from 256 to 3584. Values outside that range preserve original resolution. |
| strength | FLOAT | 1.000–4 | Global multiplier on the weighting effect. Effect compounds over all blocks. |
| formula | STRING | Optional conditioning formula used only when visual fusion is off. Empty selects the first image pass. | |
| padding_method | COMBO | zero-pad | Alignment method for images with different aspect ratios/resolutions. Active ONLY if visual_fusion_config is disconnected or set to 'off'. |
| vae_resolution | COMBO | Fast (1024) | Resolution of the reference latent encoded by the VAE (structural path). |
| ref_latent_mode | COMBO | off | Reference latent encoding mode. 'single'/'multi' append latents; 'parallel-single'/'parallel-multi' run them in a separate conditioning stream to prevent semantic override. |
| multiplier | FLOAT | 1.0-1000–1000 | Overall multiplier applied to the final conditioning vector. |
| vae_dimension_multiple | INT | 84–256 | Pixel multiple used to align reference images before VAE encoding. |
| image_inputs | COMFY_AUTOGROW_V3 | Multimodal images. Maps active inputs sequentially to variables (a, b, c, ...). | |
| visual_fusion_configopt | VISUAL_FUSION_CONFIG | Optional spatial visual fusion configuration from UC_VisualFusionConfig. Blends isolated visual blocks without coordinate blur. | |
| vaeopt | VAE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CONDITIONING | CONDITIONING | — |