ComfyUI Node

SliderLatent

What SliderLatent actually finds

By chenbaiyujason·Created 2 years ago·Updated 2 years ago· 0
SliderLatent
  • clip
  • positive_formatter
  • negative_formatter
  • mediums
  • subjects
  • latent
  • word_distance
target_wordhappy
opposite_wordsad
iterations30
seed0

You want a dial for "sad." Not a prompt that mentions sad - an actual knob you can drag from sad to happy and stop anywhere in between. That's the promise of the latent-navigation trick this pack is built on, and SliderLatent is the node that does the hard half: it computes the direction.

This isn't a ComfyUI invention. It's a port of the latentnavigation-flux space on Hugging Face, which itself descends from a long line of "concept direction" work in text-embedding space. The idea is simple: encode a bunch of prompts containing "happy," encode the same prompts with "happy" swapped for "sad," and the average difference between the two sets of embeddings is a vector that points, in CLIP space, from sad toward happy. Add a little of that vector to your conditioning and the model leans happy. Subtract it and you get sad. That's your slider.

How it works

Under the hood, SliderLatent loops iterations times (default 30). Each pass it picks a random medium and a random subject from a pool, builds a {medium} of a {target_word} {subject} and the same template with the opposite word, tokenizes and encodes both with your CLIP, and subtracts. When the loop finishes it averages all the differences into a single direction tensor, plus the norm of that average as word_distance - a rough "how far apart are these two concepts in this encoder" reading.

The inputs that matter

  • target_word / opposite_word - the concept pair. "happy" and "sad", "cold" and "warm". Leave opposite_word empty and the direction runs from "no concept" toward the target; the author's own FLUX workflow does exactly that with "scary" against an empty string.
  • iterations - default 30. Each iteration is one text-encoder pass: cheap on a GPU, slow on CPU. 20 is plenty (the shipped workflow runs 20), and more mostly buys you a smoother average.
  • seed - torch.manual_seed(seed) is called before the loop, so the random medium/subject sampling is fully reproducible. Fixed seed, stable direction; change it and you get a differently-sampled direction for the same words.

The optional sockets are where the pack's helpers plug in: positive_formatter and negative_formatter from SliderPrompt override the template, and mediums / subjects from SliderObjectIn override the default vocabulary lists. Wire none of them and it uses its built-in pools (~20 mediums, ~70 subjects) and the default template.

Outputs

  • latent - the direction tensor. Wire it into CLIPSliderApply.latent_direction.
  • word_distance - a float, handy for comparing concept pairs, ignorable otherwise.

The pairing you have to get right

This is the non-pooled variant: it works on the per-token sequence embeddings, which is where SD 1.5 and SDXL live. So SliderLatent → CLIPSliderApply. For FLUX and SD3 you want SliderLatentPooled → CLIPSliderApplyPooled, because those models steer on the pooled vector instead. Mix the two and you get a shape mismatch or, worse, silently weak results.

Installing it

ComfyUI Manager → search "ComfyUI-CLIPSlider-SC", or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/chenbaiyujason/ComfyUI-CLIPSlider-SC

Restart ComfyUI. No model downloads, no heavy dependencies - requirements.txt lists only diffusers, and the code doesn't even import it. The real dependency is ComfyUI's own CLIP encoder. One honest warning: this is a niche fork with essentially no community footprint, so treat the workflow shipped in the repo (workflows/clipslidersc.json) as the manual, because the README is inherited from the original RhizoNymph project and documents almost none of these nodes.

Troubleshooting

  • No visible effect - the direction is paired with the wrong apply node, or slider_target is too small, or the words are so abstract your encoder can't separate them. SD 1.5's CLIP in particular struggles with vague emotional words.
  • Noisy, flip-flopping results - the direction averaged over too few samples, or the default vocab is pulling in too much. Bump iterations, set a fixed seed.
  • Shape errors - you wired a Pooled direction into the non-pooled apply node or vice versa. Check the pairing.
Categoryconditioning

Inputs (9)

NameTypeDefaultDescription
clipCLIP
target_wordSTRINGhappy
opposite_wordSTRINGsad
iterationsINT301–18446744073709550000
seedINT00–18446744073709550000
positive_formatteroptPROMPT_FORMATTER
negative_formatteroptPROMPT_FORMATTER
mediumsoptMEDIUMS
subjectsoptSUBJECTS

Outputs (2)

NameTypeDescription
latentLATENT
word_distanceFLOAT