Nodes/ComfyUI Flux Trainer/Optimizer Config Prodigy
ComfyUI Node

Optimizer Config Prodigy

The optimizer that finds its own learning rate

By kijai·Created 2 years ago·Updated about a year ago· 1,156
Optimizer Config Prodigy
    • optimizer_settings
    max_grad_norm0.00
    lr_schedulerconstant
    lr_warmup_steps0
    lr_scheduler_num_cycles1
    lr_scheduler_power1.00
    weight_decay0.0000
    decoupletrue
    use_bias_correctionfalse
    min_snr_gamma5.00
    extra_optimizer_args

    Prodigy is the optimizer that made a lot of people stop obsessing over learning rate. Its whole pitch is adaptivity: you set the learning rate to 1.0 and it figures out the actual rate on its own as training goes. For the SDXL era that was a gift - finding a good LR by hand is tedious and easy to get wrong - and Prodigy became the community default because of it. OptimizerConfigProdigy is the node that wires Prodigy into a Flux Trainer run with its specific knobs exposed.

    A reality check up front: Prodigy's dominance was an SDXL-era thing. On newer architectures the recipes people publish increasingly name AdamW8bit or Adopt-style optimizers instead, and Prodigy notably does not play well with Chroma. It's still a perfectly good choice, and a genuinely convenient one if hand-tuning LR isn't your idea of fun - just know it's no longer the automatic answer it once was.

    How it works

    The node outputs optimizer_settings (type ARGS) for the Init node. Remember Prodigy's core trick: set the learning_rate on the Init node to 1.0, not a tiny number, and let Prodigy scale from there. That's the part people get wrong.

    The inputs worth knowing:

    • weight_decay (default 0) - regularization. A small value can help against overfitting.
    • decouple (default true) - decoupled weight decay (the "AdamW" style). Leave it on; it's the recommended mode.
    • use_bias_correction (default false) - an optional Prodigy stabilizer, occasionally worth trying if early training is jumpy.
    • lr_scheduler (default constant) - with an adaptive optimizer a constant schedule is common, since Prodigy is already adjusting the effective rate.
    • min_snr_gamma (default 5) - standard loss weighting, leave at 5.

    When to reach for it

    Use Prodigy when you don't want to hunt for a learning rate and you're on SDXL or Flux (not Chroma). It's the "just let it figure it out" button. If you're following a modern recipe that specifies an exact LR and a plain optimizer, though, there's no need to override it with Prodigy - the auto-tuning is solving a problem that recipe already solved for you.

    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 set a tiny learning rate and it barely trains. The classic Prodigy mistake. Set the Init node's learning_rate to 1.0 - Prodigy interprets that as "scale freely," and a value like 1e-4 hobbles it.

    Don't use it on Chroma. Chroma gradient-explodes with the wrong optimizer and Prodigy specifically doesn't work well there; that base wants Adam8bit with very low weight decay and a low fixed LR instead.

    It's not magic on new architectures. Prodigy auto-tunes the LR, but it doesn't fix a bad dataset, wrong rank, or too many steps. If results are off, look at those first - the optimizer is rarely the bottleneck.

    CategoryFluxTrainer

    Inputs (10)

    NameTypeDefaultDescription
    max_grad_normFLOAT0.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
    weight_decayFLOAT0.0000weight decay (L2 penalty)
    decoupleBOOLEANtrueuse AdamW style weight decay
    use_bias_correctionBOOLEANfalseturn on Adam's bias correction
    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