ComfyUI Node

Switch Float

The tiny A/B tester for numbers that's too useful to be this simple

By loz2754·Created 8 months ago·Updated about 22 hours ago· 5
Switch Float
    • float
    float_10.40
    float_21.00
    booleanfalse

    ComfyUI lets you feed almost anything into a KSampler - including, if you wire it right, a boolean. Switch Float is the node that makes that pattern useful: you give it two float values and a boolean, and it outputs one or the other. Flip the boolean and your CFG, denoise, or strength value changes instantly. It's a two-value selector with a switch, and it's the quiet backbone of "high quality vs fast" toggles all over shared workflows.

    What it does

    Three inputs, one output. float_1 comes out when boolean is true; float_2 comes out when it's false. The defaults - 0.4 and 1.0 - are not random: 0.4/1.0 is a sensible denoise split, and the node's own description calls out conditional parameter control and A/B testing as its reason to exist. Set float_1 to your "premium" value, float_2 to your "fast" value, drive the boolean from a toggle, and one switch flips between two configurations.

    Inputs and outputs

    • float_1 - output when boolean is True (default 0.4, range 0–100).
    • float_2 - output when boolean is False (default 1.0, range 0–100).
    • boolean - the switch control. True picks float_1, False picks float_2. You can type it or wire it from any other boolean-producing node - that's where the real power is.
    • Output: float (FLOAT) - the chosen value, ready for a KSampler's CFG/denoise, a scale factor, a strength slider, anything that takes a float.

    How it works

    Two branches, no cleverness: if boolean: return float_1 else return float_2. That's the whole implementation, and it's exactly right. The node exists to be a reliable, legible switch - not a math node. If you need more than two options, the pack's text-index and random-select families scale up from here; if you need exactly two, this is as minimal as it gets.

    Where it fits

    The pattern that makes this node sing is boolean chaining. The AUN pack's bypass/mute controllers can emit booleans that reflect node state - and those booleans can drive switches like this one. So a single "high quality mode" toggle can flip your upscaler's denoise and your CFG and mute the fast path, all in sync. That's the kind of thing that turns a workflow from a pile of sliders into something you can operate with one switch.

    It's also just handy for experimentation: run the same seed at two CFG values by flipping a boolean, and your A/B comparison is one click instead of a slider hunt. For beginners it's a nice first taste of "data flows are programmable" - for veterans it's a reminder that the small nodes are the ones that keep a graph manageable.

    Installing

    It ships in the AUN ComfyUI Nodes pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/loz2754/AUN-ComfyUI-Nodes
    

    Restart ComfyUI, or use ComfyUI Manager (search "AUN"). No models, no heavy deps - pack-standard requirements only, auto-installed by Manager or via pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt for manual clones.

    The one habit worth forming: wire the boolean from a real switch rather than typing it, and keep the two values labeled by what they mean. A switch with "0.4 vs 1.0" is useful; a switch with "speed vs quality" is obvious. The node can't name itself - but one rename makes it self-documenting.

    CategoryAUN Nodes/Utility

    Inputs (3)

    NameTypeDefaultDescription
    float_1FLOAT0.400–100Float value to output when boolean is True.
    float_2FLOAT1.000–100Float value to output when boolean is False.
    booleanBOOLEANfalseSwitch control. True = output float_1 value, False = output float_2 value.

    Outputs (1)

    NameTypeDescription
    floatFLOAT