Nodes/ComfyUI Flux Trainer/Optimizer Config
ComfyUI Node

Optimizer Config

The default optimizer picker for Flux Trainer (AdamW8bit and friends)

By kijai·Created 2 years ago·Updated about a year ago· 1,156
Optimizer Config
    • optimizer_settings
    optimizer_typeadamw8bit
    max_grad_norm1.00
    lr_schedulerconstant
    lr_warmup_steps0
    lr_scheduler_num_cycles1
    lr_scheduler_power1.00
    min_snr_gamma5.00
    extra_optimizer_args

    Every training run in this pack needs an optimizer - the algorithm that decides how the model's weights actually move each step - and OptimizerConfig is the general-purpose node that picks and tunes it. It's the one you wire into the optimizer_settings input of any Init node, and for most people it's the only optimizer node they'll ever need.

    The pack ships a few dedicated optimizer nodes (Prodigy, Adafactor, ProdigyPlusScheduleFree) because those have enough special knobs to deserve their own UI. OptimizerConfig is the catch-all for everything else, and its default - AdamW8bit - is still the sensible starting choice for the vast majority of LoRA training in 2026.

    How it works

    You set an optimizer_type and a learning-rate schedule, and the node bundles it all into an optimizer_settings (type ARGS) output that plugs into the Init node. The learning rate itself lives on the Init node, not here - this node governs which optimizer runs and how the LR is scheduled over the course of training.

    The inputs that matter:

    • optimizer_type (default adamw8bit) - the dropdown includes adamw8bit, adamw, prodigy, CAME, Lion8bit, Lion, adamwschedulefree, sgdschedulefree, AdEMAMix8bit, PagedAdEMAMix8bit, and ProdigyPlusScheduleFree. AdamW8bit is the default-and-fine choice; the 8bit variants save VRAM.
    • lr_scheduler (default constant) - constant, cosine, cosine_with_restarts, polynomial, or constant_with_warmup. Constant is simplest; cosine gently decays the LR toward the end.
    • lr_warmup_steps - ramps the LR up over the first N steps, which can steady the start of a run.
    • min_snr_gamma (default 5) - a loss-weighting trick that helps convergence; 5 is the community-standard value, leave it be.

    Which optimizer to actually pick

    Honestly? Start with the default AdamW8bit. It's still the workhorse and it's fine. Reach for one of the dedicated nodes only when you have a reason: Prodigy if you want the LR auto-tuned (an SDXL-era favorite), Adafactor if you're squeezing VRAM, or ProdigyPlusScheduleFree if you're chasing the newer adaptive-and-schedule-free approach. Picking those from this dropdown works, but the dedicated nodes expose their specific knobs, which is usually what you want.

    Installing the pack

    ComfyUI Manager: search ComfyUI Flux Trainer, install, restart. Or:

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

    Torch 2.4.0+ recommended, plus kijai's ComfyUI-KJNodes for the example workflows.

    Common issues

    You expected to set the learning rate here - you don't. The LR lives on the Init node. This node picks the optimizer and how the LR is scheduled, not its value.

    8bit optimizer, bitsandbytes trouble. The 8bit optimizers (adamw8bit, Lion8bit, etc.) rely on bitsandbytes under the hood, which is historically the most fragile part of any Kohya-based install. If an 8bit optimizer errors on launch, that dependency is the usual suspect; a plain adamw sidesteps it at a VRAM cost.

    Prodigy from this dropdown ignores its special settings. Prodigy wants LR set to 1.0 and has its own decouple/bias-correction knobs. If you're serious about Prodigy, use the dedicated OptimizerConfigProdigy node instead so those knobs are actually exposed.

    CategoryFluxTrainer

    Inputs (8)

    NameTypeDefaultDescription
    optimizer_typeCOMBOadamw8bitoptimizer type
    max_grad_normFLOAT1.00gradient clipping
    lr_schedulerCOMBOconstantlearning rate scheduler
    lr_warmup_stepsINT0learning rate warmup steps
    lr_scheduler_num_cyclesINT1learning rate scheduler num cycles
    lr_scheduler_powerFLOAT1.00learning rate scheduler power
    min_snr_gammaFLOAT5.00gamma for reducing the weight of high loss timesteps. Lower numbers have stronger effect. 5 is recommended by the paper
    extra_optimizer_argsSTRINGadditional optimizer args

    Outputs (1)

    NameTypeDescription
    optimizer_settingsARGS