ComfyUI Node

Conditioning Zero Out

The negative prompt that says nothing, on purpose

By r-vage·Created 23 days ago·Updated 3 days ago· 0
Conditioning Zero Out
  • conditioning
  • model
  • conditioning
◄max_tokens0►

Every workflow needs a negative conditioning socket filled. On models that barely use CFG - Flux at 1.0, most distilled turbo setups - the honest answer is "nothing," and an empty string still runs a full text encoding to produce a padded tensor of zero-ish embeddings. Conditioning Zero Out [SML2] replaces that with an actual zero tensor, and gives you a token-length dial while it's there.

What it does

It takes conditioning and returns a version where the embedding tensor is zeros and, if a pooled_output exists in the metadata, that's zeroed too. Nothing else is touched: dtype, device and the rest of the per-entry metadata dict are preserved, and the input conditioning isn't mutated, so you can use the original elsewhere on the same graph.

Why bother instead of an empty prompt? Two reasons. It's the canonical way to write "unconditioned" in ComfyUI, which is what models with CFG 1.0 effectively want. And it normalizes the token count: different prompts tokenize to different lengths, and an empty-prompt tensor isn't the same shape as the model's native conditioning length. Zeroing at the model's base token length is the shape the model was actually trained against.

The token-length mechanism

This is the part that makes the node worth more than a two-line core equivalent. max_tokens defaults to 0, and 0 means "work it out":

  • Model connected, architecture recognized → auto-detect the base token length and truncate the zeros to it. The map covers SD1.5/SD2/SDXL/Refiner at 77, SD3 at 154, Flux and FluxSchnell at 256, HiDream at 128, LTXV and Hunyuan Video at 128, and - where the installed ComfyUI has them - Wan 2.1 at 512, Cosmos at 512, Z-Image and Lumina2 at 256, CogVideoX T2V at 226.
  • Model connected but unknown type → no truncation, original length kept.
  • No model at all → pure zero-out at the original size.
  • max_tokens > 0 → that number wins, always.

One special case is deliberate and easy to miss: Krea 2 uses a variable-length text encoder, so the node detects it and explicitly does not truncate. Truncating a variable-token model to some fixed guess would be worse than doing nothing.

Truncation only shrinks. If the conditioning is already shorter than max_tokens you get a plain zero-out at the existing size, not padding.

Inputs and outputs

conditioning (required), max_tokens (required int, 0–4096), model (optional). One output: conditioning. Wire it into KSampler Pipe's negative, or into CFGGuider's negative when you're on a custom sampler.

Connecting model is optional but it's the whole reason to prefer this over the core node: grab it from IO Checkpoint Loader's model output, or from anything else that emits MODEL, and the truncation length comes along for free.

Installing it

Part of the pack. ComfyUI Manager → search Smart Model Loader Nova, or:

cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_SmartModelLoader_Nova.git
cd ComfyUI_SmartModelLoader_Nova
python -m pip install -r requirements.txt

ComfyUI's own Python, then restart. It reads comfy.supported_models to build its length map, which is why an older ComfyUI simply has fewer entries - the optional ones are feature-detected, not assumed. No extra dependencies.

Where people get burned

Expecting it to speed things up. It doesn't skip the sampling pass or save VRAM; it changes what the model is conditioned on. If you're chasing speed, this isn't the lever.

Setting max_tokens smaller than the prompt. Truncation happens after encoding, so a 77-token cut on a 256-token model's conditioning throws away most of what the encoder produced and can look like the model ignoring the prompt entirely. Auto-detect with a connected model is the safe default.

Zeroing the positive by accident. Same node, same output name, two sockets into the sampler. It happens, and the symptom is a model that appears to hallucinate composition out of nothing.

Assuming zero equals "no negative". For most modern models that's close enough, but some families do use negative conditioning meaningfully even at low CFG. If your images get worse with a zeroed negative, that's a signal about the model, not the node.

Variable-token models. If you're on Krea 2 and expected a fixed length, you won't get one - by design. Read the console log line if you want confirmation; the node logs which path it took.

Category🌒 Smart Model Loader Nova/ Conditioning

Inputs (3)

NameTypeDefaultDescription
conditioningCONDITIONINGThe conditioning to zero out.
max_tokensINT00–4096Max token length. 0 = auto from model (or keep original if no model). Overrides model detection when > 0.
modeloptMODELOptional model input to auto-detect base token length for truncation.

Outputs (1)

NameTypeDescription
conditioningCONDITIONINGZeroed-out conditioning.