Nodes/ComfyUI-Replicate/Replicate bytedance/sdxl-lightning-4step
ComfyUI Node

Replicate bytedance/sdxl-lightning-4step

4-step SDXL, run in the cloud

By replicate·Created 2 years ago·Updated 2 years ago· 207
Replicate bytedance/sdxl-lightning-4step
    • IMAGE
    promptself-portrait of a woman, lightning in the background
    negative_promptworst quality, low quality
    width1024
    height1024
    num_outputs1
    schedulerK_EULER
    num_inference_steps4
    guidance_scale0.00
    seed
    disable_safety_checkerfalse
    force_rerunfalse

    SDXL-Lightning is ByteDance's distilled SDXL - the technique that made few-step SDXL genuinely usable, widely considered the best speed method of its moment. This is the 4-step variant: instead of the 20-50 steps a normal SDXL needs, it produces a full 1024×1024 image in four. This node runs it on Replicate's cloud via ComfyUI-Replicate, so it generates without touching your GPU.

    Quick honesty first: SDXL-Lightning is free and small. The LoRA and checkpoints are on Hugging Face and run fine on modest local hardware. So the reason to use this node isn't "it's the only way" - it's for when you have no capable GPU on hand, or you want a fast image-gen step inside a graph that's already living in the cloud. If you've got a local SDXL setup, you'll usually just run Lightning there.

    How it works

    Distillation trains a "student" model to collapse many denoising steps into a few big jumps - SDXL-Lightning uses progressive adversarial distillation to do it. The catch, and it's the number one mistake people make: the teacher's guidance is baked in, so you run it at very low CFG (this model defaults to guidance_scale 0) and at the exact step count it was trained for (4). Crank CFG to the usual 7 and you get oversaturated, artifacted garbage. The node handles the call to Replicate and returns an IMAGE.

    Inputs and outputs that matter

    Output is an IMAGE.

    • prompt / negative_prompt - the usual.
    • num_inference_steps (4) - leave it at 4. This variant is trained for four steps; more won't improve quality, fewer breaks it.
    • guidance_scale (0) - leave it near 0. This is the whole "distilled model" rule; raising it is the classic way to wreck a Lightning image.
    • width / height (1024) - SDXL's native resolution.
    • scheduler (K_EULER default) - Euler is the correct family for Lightning.

    num_outputs batches up to 4, seed fixes the roll, disable_safety_checker toggles Replicate's content filter, and force_rerun forces a fresh generation on identical inputs.

    How to install it

    ComfyUI Manager: search ComfyUI-Replicate, install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/replicate/comfyui-replicate
    cd comfyui-replicate
    pip install -r requirements.txt
    

    Restart, and set your token first:

    export REPLICATE_API_TOKEN="r8_************"; python main.py
    

    Token: replicate.com/account/api-tokens.

    Common issues

    Returns an image cleanly - this is the well-supported case in the pack, no output caveats.

    The classic failure is settings drift: if the image looks fried, oversaturated, or blown out, you've almost certainly raised guidance_scale or num_inference_steps off their defaults. Put them back - 4 steps, guidance near 0, Euler. That's not a preference, it's how the model was trained; a distilled 4-step model expects exactly four large jumps and no extra guidance.

    The other honest note is cost-per-value. Running a tiny, free, few-step model as a paid cloud call is fine when you have a reason (no GPU, cloud-only pipeline), but if you're generating in volume it adds up fast for a model you could run locally for nothing. Know which situation you're in. And as always, a missing REPLICATE_API_TOKEN is the first-run error.

    CategoryReplicate

    Inputs (11)

    NameTypeDefaultDescription
    promptoptSTRINGself-portrait of a woman, lightning in the background
    negative_promptoptSTRINGworst quality, low quality
    widthoptINT1024256–1280
    heightoptINT1024256–1280
    num_outputsoptINT11–4
    scheduleroptCOMBOK_EULER8 options: DDIM, DPMSolverMultistep, HeunDiscrete, KarrasDPM, K_EULER_ANCESTRAL, K_EULER, +2
    num_inference_stepsoptINT41–10
    guidance_scaleoptFLOAT0.000–50
    seedoptINT
    disable_safety_checkeroptBOOLEANfalse
    force_rerunoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE