ComfyUI Node

Sampler Switch

A/B/C/D/E test your prompts against one sampler chain

By jjmaden·Created 27 days ago·Updated about 6 hours ago· 0
Sampler Switch
  • set_1_pos
  • set_1_neg
  • set_1_latent
  • set_2_pos
  • set_2_neg
  • set_2_latent
  • set_3_pos
  • set_3_neg
  • set_3_latent
  • set_4_pos
  • set_4_neg
  • set_4_latent
  • set_5_pos
  • set_5_neg
  • set_5_latent
  • POSITIVE
  • NEGATIVE
  • LATENT
select_set1

This is the "Sampler Switch", and if you've ever built three variations of a prompt, wired all three to three separate KSamplers, and then realized you're comparing apples to oranges because the step counts drifted - this node is the cure. It's a five-way multiplexer for the three inputs a KSampler needs: (positive, negative, latent). Pick a set with one integer, and the chosen POSITIVE, NEGATIVE, and LATENT come out the other side, ready to feed a single KSampler chain.

The design is smarter than a plain switch, and the detail is worth understanding. Set 1 is special: it's the required, always-evaluated fallback. Sets 2–5 are lazy - wiring them up doesn't mean they execute on every queue. Only select_set's chosen set (plus set 1, as backup) is evaluated. So you can keep five full prompt/latent combinations wired in, and an A/B test costs you one queue, not five conditioning graphs running side by side.

Even better is what happens with an incomplete set. Say you pick set 3 but only wired set_3_pos and set_3_neg, forgetting set_3_latent. Rather than crashing or silently passing None into the sampler, the node falls back to set 1's value for the missing piece and prints a console warning naming the gap. It's the first-non-null fallback pattern from the plumbing layer of ComfyUI, applied to the inputs that actually matter.

What you actually see in the node:

  • select_set - integer 1–5, default 1. The only widget you change.
  • set_1_pos, set_1_neg, set_1_latent - required, always evaluated.
  • set_2_posset_5_latent - twelve optional, lazy sockets.
  • Outputs: POSITIVE, NEGATIVE, LATENT - wire straight into your KSampler.

One behavior change worth knowing if you drive ComfyUI through its API rather than the UI: select_set is validated to be 1–5 and raises a clear ValueError outside that range. That's intentional - an earlier version silently fell back to set 1 with only a console print when the API submitted an out-of-range value, which is the kind of silent failure that eats an hour of debugging.

Installation is the same as the rest of this pack:

cd ComfyUI/custom_nodes
git clone https://github.com/jjmaden/comfyui-jjmaden-random-nodes

Then restart ComfyUI, or use ComfyUI Manager and search "JJMaden Random Nodes". MIT license, zero Python dependencies beyond ComfyUI, no models to fetch. It's a personal utility pack (one author, jjmaden), so there's no big community around it - the README and the node's own description are your documentation.

Where it beats the alternatives: you can iterate on prompt variants in isolation without every untested combination's conditioning nodes burning VRAM on every run. That's the entire point, and it works. The one habit to form is keeping set 1 as a sane default, because that's what you'll fall back to whenever a set is incomplete. If you test a lot of prompt pairs, this is the switch you'll actually reach for.

Categoryutils

Inputs (16)

NameTypeDefaultDescription
select_setINT11–5
set_1_posCONDITIONING
set_1_negCONDITIONING
set_1_latentLATENT
set_2_posoptCONDITIONING
set_2_negoptCONDITIONING
set_2_latentoptLATENT
set_3_posoptCONDITIONING
set_3_negoptCONDITIONING
set_3_latentoptLATENT
set_4_posoptCONDITIONING
set_4_negoptCONDITIONING
set_4_latentoptLATENT
set_5_posoptCONDITIONING
set_5_negoptCONDITIONING
set_5_latentoptLATENT

Outputs (3)

NameTypeDescription
POSITIVECONDITIONING
NEGATIVECONDITIONING
LATENTLATENT