Nodes/zhangp365/ComfyUI-utils-nodes/ReferenceLatentSwitch
ComfyUI Node

ReferenceLatentSwitch

A/B test a reference-image edit without rewiring your graph

By zhangp365·Created 2 years ago·Updated 5 months ago· 135
ReferenceLatentSwitch
  • conditioning
  • latent
  • CONDITIONING
enabledtrue

Reference-latent conditioning is the mechanism behind a lot of 2026's image-editing workflows - it's how a sampler gets told "here's an existing image, treat it as the starting point" alongside your text prompt, the trick that models like Qwen-Image-Edit and Flux Kontext lean on. ComfyUI ships a plain ReferenceLatent node for this. ReferenceLatentSwitch is that same node with one addition: a toggle that lets you skip it entirely without touching a single wire.

What it's for

The node's own description says it plainly: "ReferenceLatent with switch. When disabled, returns conditioning directly." That's the whole feature, and it's more useful than it sounds. Comparing "with reference latent" against "without" is a genuinely common thing to want to check while building an edit workflow - does the reference actually help, or is your prompt alone doing the work - and normally that means physically rerouting a wire or swapping nodes. This one turns that comparison into flipping a boolean.

How it works

When enabled is true, it behaves exactly like the official ReferenceLatent node: it folds your latent input into the conditioning, giving the sampler that "here's what already exists" signal. When enabled is false, it bypasses that step entirely and passes conditioning straight through unmodified - as if the node weren't there at all.

The inputs and outputs that matter

  • conditioning (CONDITIONING, required) - your existing text conditioning, from a CLIPTextEncode or equivalent.
  • enabled (BOOLEAN, default true) - the switch. Flip it off to disable the reference-latent injection without disconnecting anything.
  • latent (LATENT, optional) - the reference image's latent, typically from a VAE-encode of the image you want the sampler to treat as the existing state. Only used when enabled is true.

Output: a single CONDITIONING - either the reference-augmented version or the untouched passthrough, depending on the switch.

How to install it

Via ComfyUI Manager: search "ComfyUI-utils-nodes," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes

Restart ComfyUI. No models, no extra dependencies - this is a thin wrapper around a node ComfyUI already ships, so install is trivial.

Common issues & troubleshooting

This is one of several *Switch nodes this pack ships - the same pattern shows up wrapping ImageCompositeMasked, VAEEncoder, and a handful of the official loaders. If you're already using one of those elsewhere in your graph, this one will feel immediately familiar; the toggle behavior is consistent across the family.

The thing to actually get right is what "disabled" means here: it doesn't zero out or neutralize the reference - it removes the reference-latent step from the conditioning path entirely, so your sampler falls back to being driven by text conditioning alone. If your workflow depends on some form of reference always being present and you just wanted to swap which reference latent feeds in, this switch isn't the right tool - you'd want to change what's wired into latent instead of disabling the node. And since latent only matters when enabled is true, double-check it's actually connected before you go looking elsewhere for why a reference-guided edit isn't behaving the way you expect - a flipped switch with nothing wired to latent will quietly behave like it's disabled either way.

Categoryutils/switch

Inputs (3)

NameTypeDefaultDescription
conditioningCONDITIONING
enabledBOOLEANtrue
latentoptLATENT

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING