Donut ZiT Conditioning Rebalance
Crank prompt adherence without CFG
- conditioning
- CONDITIONING
Here's a Z-Image Turbo problem you'll hit your first week with it: it's a CFG-1 model. Negative prompts do nothing, and more importantly, you have no guidance dial - the whole "how hard should the model follow my prompt" knob is pinned. If your character comes out missing a requested feature or your composition drifts, there's no CFG slider to pull. DonutZitConditioningRebalance is the workaround: it scales the text embedding before it enters cross-attention, which is the input-side analog of guidance. It won't do everything CFG does - nothing can, at CFG 1 - but it's the control you're missing.
Why it works
Z-Image Turbo conditions on a single hidden state from its Qwen3-4B text encoder, a 2560-dim tensor. In ComfyUI's conditioning pipeline, that tensor becomes the cross_attn source verbatim - so scaling it is scaling what the model attends to. This node multiplies the conditioning by a multiplier: above 1, the embedding is louder, so prompt adherence strengthens; below 1, it softens.
The docstring is careful about the distinction, and you should be too: this is not CFG. CFG extrapolates between the conditioned and unconditioned branches in output space; this rescales the attention input on the positive branch only. It's a nonlinear temperature-and-value knob, closer to attention surgery than to guidance. It matters precisely because CFG-1 turbo models have no guidance, and it's the closest thing to an input-side guidance you can get.
The inputs
- conditioning - a standard CONDITIONING from a CLIP Text Encode. The node expects Z-Image Turbo conditioning (the single 2560-dim tensor); feeding it other models' conditioning mostly won't hurt but isn't the point.
- multiplier - global gain, default 1.0 (no change). The range goes to ±1000 but the honest zone is 1.0–3.0. >1 strengthens adherence; negative values are for the experimentally inclined.
- per_channel_weights - optional comma/semicolon list of gains spread as contiguous bands across the feature channels. That's the closest thing to per-layer weighting available on a single-layer conditioning, since Z-Image has no stack of encoder layers to reweight individually. Leave empty for a uniform boost.
One output: CONDITIONING, which you feed back into the sampler's positive (or negative, if you want a softened branch).
How to use it
The natural spot is right after text encoding:
CLIP Text Encode → DonutZitConditioningRebalance → KSampler (positive)
Start at multiplier 1.0 (it's a no-op, safe to leave in the graph), then nudge up to 1.2–1.5 when a prompt comes out under-adhered. Watch for two failure modes: crank it too high and you'll see over-saturation or "burnt" attention (the embedding saturates), and because there's only a positive branch, a too-strong boost can overshoot composition. If you need more surgical control than one number, per_channel_weights lets you raise specific channel bands - pair this with the pack's DonutZitLayerBlendEncode (which shapes which layers of the encoder feed the conditioning) and you have the full ZiT conditioning toolchain.
Install
Part of ComfyUI-DonutNodes: ComfyUI Manager → search "DonutNodes" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/DonutsDelivery/ComfyUI-DonutNodes.git donutnodes
cd donutnodes
python -m pip install -r requirements.txt
It's a tensor multiply - CPU-light, no model files, no special dependencies beyond the pack's shared ones (opencv-python-headless, scipy, matplotlib, psutil, tqdm, requests).
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| multiplier | FLOAT | 1.00-1000–1000 | Global gain on the text embedding fed to cross-attention. >1 strengthens prompt adherence; the input-side analog of guidance for CFG-1 turbo models. 1.0 = no change. |
| per_channel_weightsopt | STRING | Optional comma/semicolon list of gains spread as contiguous bands across the feature channels (e.g. 2560 dims). Empty = uniform. Multiplies on top of multiplier. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |