ComfyUI Node Runs on cloud

XY Input: CFG Scale

CFG Scale

By jags111·Created 3 years ago·Updated 4 months ago· 1,485
XY Input: CFG Scale
    • X or Y
    batch_count3
    first_cfg7.00
    last_cfg9.00

    CFG scale is one of the two or three settings most likely to make or break an image, and its right value is architecture knowledge, not taste - so it's a perfect thing to sweep. XY Input: CFG Scale runs your prompt across a range of CFG values and grids the results, so you can see where the model goes from "ignoring the prompt" to "obeying it" to "burnt and oversaturated." It's part of the Efficiency Nodes XY Plot system.

    How it works

    CFG makes the model predict each denoising step twice - once with your prompt, once without - and amplifies the gap between them. The scale is how hard. Crank it and the model follows the prompt harder but starts to saturate and burn; drop it and you get freer, softer, less obedient images. This node just steps through a range so you can find the knee of that curve for your specific model.

    It's dead simple: three widgets, one output.

    • batch_count (default 3) - how many CFG values to test.
    • first_cfg (default 7) - the low end.
    • last_cfg (default 9) - the high end.

    It evenly spaces batch_count values between the two and outputs a single X or Y connection.

    Picking a useful range

    The defaults (7 to 9) are tuned for classic SD 1.5 / SDXL, where the sweet spot sits around 5–9. But CFG's usable range depends entirely on the architecture, and that's the real value of plotting it:

    • SD 1.5 and SDXL: roughly 5–9. A 4-to-10 sweep is a good exploration.
    • Pony and Illustrious: lower, around 4–6.
    • Anything distilled - Turbo, Lightning, or a guidance-distilled model: basically 1. These are built to run at CFG 1, and in the current corpus CFG 1 gets named more than every other value combined. Sweeping a distilled model up to 9 just breaks it, so plot something like 1 to 3 instead.

    If your grid is all-burnt or all-mush, your range is wrong for the model, not the node.

    What you wire up

    batch_count plus the two bounds. The X or Y output goes into the XY Plot node, which plugs into an Efficient KSampler's script input. Put steps or sampler on the other axis for a proper CFG-vs-X matrix.

    Installing it

    ComfyUI Manager → search Efficiency Nodes for ComfyUI, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jags111/efficiency-nodes-comfyui
    

    Restart ComfyUI. No extra downloads.

    Common issues

    The XY Input rule: nothing renders unless the output flows through the XY Plot node into one of the pack's Efficient KSamplers. A stock KSampler won't accept the script.

    The subtle one is on modern models: on the 2026 LLM-encoder architectures, the dial you want is called true_cfg_scale, while guidance_scale refers to a distilled embedding - a different thing. This node plots the classic CFG, so on those models double-check you're plotting the parameter you think you are.

    Pack-wide: IMPORT FAILED at startup (a pip freeze non-zero exit is the usual cause) drops the whole pack. Update ComfyUI, update the node, check the Python environment.

    CategoryEfficiency Nodes/XY Inputs

    Inputs (3)

    NameTypeDefaultDescription
    batch_countINT30–50
    first_cfgFLOAT7.000–100
    last_cfgFLOAT9.000–100

    Outputs (1)

    NameTypeDescription
    X or YXY