Lazy Switch | Deforum
The A/B switch that doesn't run the losing side
- on_false
- on_true
- *
Lazy Switch | Deforum is the A/B switch you reach for when you want one boolean to choose between two things - two model loaders, two prompt branches, two entirely different subgraphs - and you don't want the loser of that choice to run at all. It's the pack's simplest "lazy" node, and the laziness is the entire point.
The inputs are the three you'd write down before looking: switch (a BOOLEAN), on_false, and on_true. Both value inputs are wildcard-typed, so they can carry a model, a latent, a conditioning, a string - anything. The single output is whatever you pointed at: on_true when the switch is true, on_false otherwise. If you've read the ComfyUI node-plumbing lore, this is the textbook "A/B switch with a selector" shape from the docs, contrasted with the first-non-null fallback switches like rgthree's Any Switch. Those walk inputs and pass the first non-empty one; this one is a valve you actively turn.
What separates it from a hand-rolled core-node switch is lazy evaluation. The node marks both value inputs as lazy, meaning ComfyUI's engine asks it which inputs it actually needs before executing anything behind them. Only the selected branch is computed; the other one is never touched. Concretely: keep a full SD model and a Flux model in one workflow, flip the switch, and the unselected loader doesn't eat your VRAM or your time. In a per-frame animation loop driven by a boolean that changes frame to frame, you get real dynamic routing instead of a graph that re-runs everything.
The gotchas are the same family traits as the pack's other lazy logic. Because an unselected branch is never validated, a broken pipeline hiding behind on_false will sit silent until you flip the switch - expect that and treat it as a feature ("I can keep a half-built experiment wired in without it crashing every run"). Also note switch is a plain boolean socket; you can type a constant for a manual picker, or wire it from a comparison, a schedule, or another node's output. If you need more than two positions, Lazy Index Switch | Deforum (ten values by index) or Lazy Conditional | Deforum (ten if/elif/else branches) is the upgrade path, and all three share the same lazy engine.
Installation is the whole pack, not just this node: ComfyUI Manager → search "ComfyUI-Deforum" or deforum-comfy-nodes → install and restart, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/deforum-art/deforum-comfy-nodes
Restart ComfyUI. No model files, no extra Python dependencies - this is pure logic on top of ComfyUI's own runtime. The repo moved from XmYx/deforum-comfy-nodes to the deforum-art org, so old saved workflows may reference the earlier URL. For a first animation build, this is often the friendliest place to start playing with lazy routing: two inputs, one boolean, and the payoff is instantly visible in the console log of what did and didn't run.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| switch | BOOLEAN | — | |
| on_false | * | — | |
| on_true | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |