Nodes/ComfyUI-Apt_Preset/Stack_Ksampler_adv
ComfyUI Node

Stack_Ksampler_adv

KSampler (Advanced), Packaged for Two-Stage Sampling

By cardenluoĀ·Created 2 years agoĀ·Updated 18 days agoĀ· 309
Stack_Ksampler_adv
    • ksample
    ā—„add_noise▾►
    ā—„steps20ā–ŗ
    ā—„cfg8.00ā–ŗ
    ā—„samplereulerā–ŗ
    ā—„schedulernormalā–ŗ
    ā—„start_at_step0ā–ŗ
    ā—„end_at_step1000ā–ŗ
    ā—„return_with_leftover_noise▾►

    This is ComfyUI's native KSamplerAdvanced, field for field, repackaged into Apt_Preset's Stack system. Everything that node exposes is here: add_noise, steps, cfg, sampler, scheduler, start_at_step, end_at_step, return_with_leftover_noise - the only difference is it outputs a KS_STACK bundle instead of sampling directly, so it plugs into the pack's own downstream sampler/loader node rather than taking model/positive/negative/latent itself.

    Inputs

    • add_noise (enable / disable) - whether to add fresh noise at the start of this sampling stage.
    • steps (default 20, 0–10000) and cfg (default 8, 0–100).
    • sampler (default euler, 44 choices) - the full stock ComfyUI roster.
    • scheduler (default normal, 9 choices: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, normal, linear_quadratic, kl_optimal).
    • start_at_step / end_at_step (0–10000, default 0 and 1000) - the step range this stage actually runs, out of the total steps.
    • return_with_leftover_noise (disable / enable) - whether to hand off a partially-denoised latent for a second stage to continue, instead of finishing the sample.

    Output: ksample, a KS_STACK object.

    Where the "advanced" part earns its name

    start_at_step/end_at_step plus return_with_leftover_noise is the exact mechanism behind split sampling - base-model-then-refiner handoffs, or any multi-stage pipeline where one sampler does the early, coarse steps and another finishes the detail pass. With the defaults (start_at_step = 0, end_at_step = 1000, return_with_leftover_noise = disable), it just runs the whole thing in one pass and behaves like the basic sampler. To split it: lower end_at_step to somewhere partway through your total step count, set return_with_leftover_noise = enable, and hand the resulting latent to a second sampling stage that picks up from that same step with add_noise = disable.

    The defaults are SD 1.5/SDXL-era, and it shows

    cfg = 8 and scheduler = normal are tuned for the DDPM-style models of the SD 1.5/SDXL generation, where CFG 5–9 is the normal range. If you're running a flow-matching or guidance-distilled model - Flux, Z-Image, Klein - that CFG is very likely wrong: those models bake guidance into the weights and typically want CFG 1, with anything higher applying the correction twice and burning detail rather than improving prompt adherence. karras scheduling is also actively counterproductive on flow-matching models, which want a more balanced schedule (normal, simple, or beta) rather than one that concentrates effort mid-trajectory. Check your model card before trusting this node's out-of-the-box numbers.

    Install

    ComfyUI Manager: search "ComfyUI-Apt_Preset," install, restart. By hand: cd ComfyUI/custom_nodes && git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git, then restart ComfyUI. The install.bat dependency installer only runs on Windows - on Linux or a cloud box, check what it lists and pip-install those packages yourself, or let ComfyUI Manager's "install missing nodes" flow catch it.

    Troubleshooting

    If your second sampling stage produces a fresh, unrelated image instead of continuing the first, check add_noise on the second stage's node - it should be disable so it continues from the leftover noise rather than starting over.

    Import failures with this specific pack are documented, not hypothetical - a comfyui subreddit thread shows (IMPORT FAILED): ...ComfyUI-Apt_Preset. ComfyUI Manager's "install missing custom nodes" resolved it there, as did manually re-cloning the repo and restarting.

    CategoryApt_Preset/stack/😺backup/ksample

    Inputs (8)

    NameTypeDefaultDescription
    add_noiseCOMBO2 options: enable, disable
    stepsINT200–10000—
    cfgFLOAT8.000–100—
    samplerCOMBOeuler44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
    schedulerCOMBOnormal9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
    start_at_stepINT00–10000—
    end_at_stepINT10000–10000—
    return_with_leftover_noiseCOMBO2 options: disable, enable

    Outputs (1)

    NameTypeDescription
    ksampleKS_STACK—