ComfyUI Node

CLIP Temperature

Turn the dial on how literally CLIP reads your prompt

By Extraltodeus·Created 2 years ago·Updated 2 years ago· 43
CLIP Temperature
  • clip
  • CLIP
Temperature1.00

Your text encoder has a temperature dial you never knew was missing. CLIP Temperature is a model patch from Extraltodeus's Stable-Diffusion-temperature-settings pack, and it does one thing: it rescales the attention inside your CLIP before your prompt becomes conditioning vectors. If you've ever touched the temperature slider on an LLM chat, you already know the intuition - it controls how decisive the model is. Same trick, applied to the network that reads your prompt.

Why you'd reach for it

ComfyUI runs your prompt through a CLIP encoder to produce the numeric conditioning the sampler uses. That encoder is a transformer, and like every transformer it has a fixed attention temperature baked in - a 1/sqrt(d) scaling on the attention logits. CLIP Temperature swaps that for a value you set. Lower it and attention concentrates harder on the tokens that matter most: stricter, more literal prompt adherence. Raise it and attention spreads out: the same words get interpreted more loosely, which is where the "creative" mode lives. The author's own demo, the prompt "a bio-organic living plant spaceship," shows the shift across 0.75, 1, and 1.25 - subtle at those settings, but real.

How it works

The mechanism is honest and small. The node clones your CLIP, then patches the transformer's forward pass with a scaled dot-product attention whose softmax scale is 1 / (sqrt(dim) * temperature) - that's literally scale=1/(math.sqrt(q.size(-1))*temperature) in the source. It patches both text encoders when both exist (SDXL's clip_g and clip_l) and the single clip_l on SD 1.x. Because it operates on a clone, your base model is never modified; delete the node and you're back to stock. That's the standard ComfyUI model-patch safety pattern, and this pack follows it.

The inputs and output

Two inputs, and only one is interesting. clip takes your CLIP model straight from the loader. Temperature is a FLOAT from 0 to 10 in 0.01 steps, default 1 - which is exactly stock behavior. At 1 you get the vanilla encoder (mathematically identical, just a bit of wasted compute), below 1 sharpens, above 1 loosens. There's exactly one output, CLIP, and you wire it into your CLIP Text Encode node. Nothing else to configure.

Installing it

Install is as painless as custom nodes get. In ComfyUI Manager, search for "Stable-Diffusion-temperature-settings" and install, or run:

cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/Stable-Diffusion-temperature-settings

Then restart ComfyUI. There's no requirements.txt and nothing to download - this pack depends only on torch and the ComfyUI API, so it won't drag in a conflicting dependency or a multi-gigabyte model file. It shows up under the model_patches/Temperature category.

Gotchas

Keep expectations in check, because this is a niche 2024 experiment more than a polished tool. At sensible values (roughly 0.7–1.3) the effect is subtle - it's a creative lever, not a quality booster, and the shipped node hits the whole encoder with no per-layer control. Push much past that range and output collapses into mush. Extraltodeus is a known custom-node author (CLIP-Token-Injection, sigmas tools, depthmap2mask, Patreon-supported), and his own framing is "see what happens." That's the right attitude. Budget 20 minutes of A/B testing on a prompt you care about - and feel free to forget it exists if you don't see a difference you like.

Categorymodel_patches/Temperature

Inputs (2)

NameTypeDefaultDescription
clipCLIP
TemperatureFLOAT1.000–10

Outputs (1)

NameTypeDescription
CLIPCLIP