Nodes/Comfy_z-sampling/Z-Sampling Settings
ComfyUI Node

Z-Sampling Settings

The four knobs that make the zigzag zigzag

By sal063·Created 7 months ago·Updated 7 months ago· 1
Z-Sampling Settings
    • z_settings
    gamma_15.5
    gamma_20.0
    lambda_step-1
    t_max1

    This node does nothing on its own, and that's the point. It's a config bundle: four numbers in, one z_settings object out, meant to be wired into the optional z_settings input on Z-Sampler (Zigzag) from the same pack. If you never add this node, Z-Sampler still works - it just runs with defaults. You only reach for the Settings node when you want to actually tune the zigzag, which you will once you see how much time it costs.

    The four knobs

    • gamma_1 (default 5.5) - the CFG scale used on the forward denoise legs. This is your "strong guidance" dial, roughly what you'd normally type into a KSampler's CFG.
    • gamma_2 (default 0.0) - the CFG scale for the inversion legs, the part where the sampler walks back up the noise ladder. The default of 0 (no guidance) is the sane one; this is where you're deliberately letting the model drift so the next denoise pass has something to correct.
    • lambda_step (default -1) - how many of the leading steps get the full zigzag treatment. -1 means auto, which resolves to steps - 1, i.e. every step except the last. Lower it to apply the loop only to the early, high-noise steps.
    • t_max (default 1) - zigzag rounds per step. This is the real quality/speed dial. Each round is two extra model evaluations, so t_max = 2 roughly triples per-step compute on the zigzag steps. The tooltip's honest about it: more rounds, slower but better.

    The only output is z_settings, a ZSETTINGS bundle you plug into Z-Sampler's z_settings socket.

    How it interacts with Z-Sampler

    Two things worth knowing so you don't fight the node:

    1. When you wire a settings bundle in, gamma_1 takes over the Z-Sampler's cfg input for the denoise legs. Whatever you left in the sampler's own CFG box stops mattering.
    2. lambda_step and t_max define where the extra compute goes. At defaults (auto lambda, t_max 1) a 30-step sample is already doing ~three model passes per step. Push t_max to 2 and you're paying for it.

    Tuning without rage-quitting

    Start from the defaults. Change one thing at a time: raise t_max to 2 if you want to feel the quality bump and you're not GPU-constrained. Leave gamma_2 at 0 until you understand the mechanism - cranking it re-injects real noise into the inversion legs, and on most models that just costs you quality for a sampler that's already slow. If you're on Anima (the pack's home turf, Cosmos-based with 16-channel latents), the author's one piece of workflow advice applies: feed Z-Sampler an Empty Cosmos Latent Video of length 1.

    Install

    Same pack as Z-Sampler, so if you have that node you already have this one. Otherwise: ComfyUI Manager → search "Comfy_z-sampling" → install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/sal063/Comfy_z-sampling
    

    Restart, and look under sampling → z-sampling in the node menu. No extra dependencies, no model files, nothing to download. Given the whole pack is one Python file, there isn't much to break - and if this settings node misbehaves, remember you can just delete it and let Z-Sampler fall back to its defaults.

    Categorysampling/z-sampling

    Inputs (4)

    NameTypeDefaultDescription
    gamma_1FLOAT5.51–30CFG scale for denoising steps (strong guidance)
    gamma_2FLOAT0.00–15CFG scale for inversion steps (weak/no guidance)
    lambda_stepINT-1-1–500Steps with zigzag optimization. -1 = auto (steps-1)
    t_maxINT11–10Zigzag rounds per step. More = slower but better quality

    Outputs (1)

    NameTypeDescription
    z_settingsZSETTINGS