Nodes/ComfyUI-DonutNodes/Donut Krea2 Prompt Weight
ComfyUI Node

Donut Krea2 Prompt Weight

1.4) — This Node Makes It Bite

By DonutsDelivery·Created 2 years ago·Updated 2 days ago· 27
Donut Krea2 Prompt Weight
  • clip
  • model
  • conditioning
  • model
  • conditioning
◄text►
◄strength1.00►

If you came from SDXL, the first thing you tried on Krea 2 was (fog:1.4), and the first thing you noticed was that nothing happened. That's not you. Krea 2's text encoder is Qwen3-VL, an actual language model, and ComfyUI's CLIP wrapper loads LLM encoders with weighting disabled - so your parentheses and colons go to the model as literal punctuation inside the instruction. Worse than deleting them.

Donut Krea2 Prompt Weight is the workaround, and a decent one. It reads (phrase:weight) out of your prompt, strips the markup before the encoder sees it, and does the weighting where an LLM-encoded model can feel it: inside the transformer's attention, per token.

There's no per-token weight vector to reach into at the encoder stage - that's a CLIP-era hook, and Krea 2's 28 blocks only take attention-level nudges. Which is why the July 2026 workflow post driving camera distance and lighting purely through weights drew a top reply saying the same thing: not native, needs nodes.

How it actually works

The node is adapted straight from kijai's KJNodes model_optimization_nodes.py under GPL-3.0 - the math is upstream's, not invented here. Donut's changes are the wrapper, an optional conditioning passthrough, and no-op guards.

From the source: it strips (phrase:number) pairs so the encoder gets clean prose; tokenizes each phrase, finds that subsequence inside the user-prompt span of the Qwen3-VL tokenization, and maps each hit to a position in the conditioning tensor; then clones the model and patches the forward of every block's attention with a version that reads a krea2_token_weights list from transformer_options.

A weight below 1 multiplies that token's value vector down - at (fog:-1) with strength 1 the factor is zero, which is what "remove this concept" means mechanically. More negative flips the sign, i.e. subtract it. Above 1 it adds a bias to the token's attention logit, so more of the image attends to it. That second path forces the block onto plain PyTorch attention, so emphasis is looser and slightly slower than removal - matching the author's tooltip: removal is the reliable direction.

The inputs that matter

  • text - your prompt with weights inline. (smile:1.5) to push, (fog:-1) to kill, (rain:0.6) to soften. Plain text is 1.0.
  • strength - 0–4 global multiplier, default 1. This is the dial you'll touch when a render starts breaking up; drop to 0.5–0.7 before rewriting the prompt.
  • clip - the Qwen3-VL encoder loaded for Krea 2 (CLIPLoader, type krea2). Anything else and it refuses.
  • conditioning - optional. Feed existing conditioning and it reuses that instead of re-encoding, preserving upstream transforms. Only from the same cleaned text and encoder, or the positions won't line up.

Outputs are model and conditioning, and you wire both: patched model into the sampler, conditioning into positive. Missing either is how people conclude it's broken.

A prompt that exercises both directions:

a woman standing on a cliff at dawn, (fog:-1), (smile:0.6), (wind in her hair:1.5), thin cirrus clouds

Set the sampler to CFG 1.0

The tooltip says it, the docs say it, and it isn't superstition. At exactly CFG 1 ComfyUI skips the unconditional pass entirely - samplers.py gates on math.isclose(cond_scale, 1.0). Those positions belong to your prompt's tokenization; you don't want them landing in a second pass with a different token sequence. Turbo is CFG 1 anyway, so most people never notice. On Raw at CFG 3.5, treat the result as approximate.

Installing it

ComfyUI Manager, search DonutNodes, install, restart, hard-refresh. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/DonutsDelivery/ComfyUI-DonutNodes.git donutnodes
cd donutnodes
python -m pip install -r requirements.txt

Use the interpreter that launches ComfyUI. The pack's requirements.txt is mostly for other nodes (opencv-python-headless, scipy, matplotlib, psutil, tqdm, requests); this one runs on torch and einops. No model downloads - just the three files Krea 2 always needs: checkpoint, Qwen3-VL encoder, Qwen-Image VAE.

Where people get burned

Nothing happens, and there's a console warning. The node looks your phrase up as a literal token subsequence. Not found, and it logs phrase 'x' not found in prompt; skipped. Case, punctuation and word order all matter; the parser also excludes : and parentheses, so never put those inside a weighted phrase.

"Krea2 prompt weights require the Qwen3-VL text encoder." Your CLIP isn't loaded as krea2. Check the CLIPLoader type.

It goes ugly. Past a certain weight the render breaks: artifacts, split compositions, blown contrast. That's the model, not a bug - the danger zone is around 3–4. Lower strength, then the weight.

A ComfyUI update broke it. The node is flagged EXPERIMENTAL upstream and patches block-internal attention (blocks[i].attn.wq, qknorm). If ComfyUI reshapes that class you get an AttributeError until Donut or kijai catches up. Keep one workflow saved with the node bypassed so a render can still finish.

Nice property: strength at 0 with a conditioning input wired is a clean passthrough. No bypass needed to A/B it - zero the dial and re-run.

CategoryDonut/conditioning

Inputs (5)

NameTypeDefaultDescription
clipCLIP—
modelMODEL—
textSTRINGPrompt with per-token weights in parentheses, e.g. (word:-1) removes/represses a concept, (word:2) emphasizes it, plain text = 1.0. Works on Krea2 where ComfyUI's normal (word:weight) does nothing (the Qwen3-VL LLM encoder ignores it). weight<1 scales the token's attention VALUE (subtracts/removes at <0); weight>1 boosts how much the image ATTENDS to the token (adds more of it). Set sampler CFG to 1.0.
strengthFLOAT1.000–4Global multiplier on the weighting effect. Effect compounds over all 28 blocks; lower if results break up, raise for a stronger effect. Removal (weight<0) is the reliable direction; emphasis (weight>1) works but is looser.
conditioningoptCONDITIONING—

Outputs (2)

NameTypeDescription
modelMODEL—
conditioningCONDITIONING—