Skip to main content
ComfyUI includes native support for training LoRA (Low-Rank Adaptation) models without requiring external tools or custom nodes. This page provides an overview of the training workflow. For detailed parameter documentation, refer to the individual node pages linked below.
The training nodes are marked as experimental. Features and behavior may change in future releases.

Node Overview

The native LoRA training system is organized into dataset nodes and training nodes.

Dataset Nodes

Used to prepare and manage training data:
NodePurpose
Load Image Dataset from FolderBatch-load images from an input subfolder
Load Image and Text Dataset from FolderLoad images with paired captions (supports kohya-ss folder structure)
Make Training DatasetEncode images with VAE and text with CLIP to produce training data
Resolution BucketGroup latents by resolution for efficient batched training
Save Training DatasetSave encoded dataset to disk to avoid re-encoding on future runs
Load Training DatasetLoad a previously saved encoded dataset from disk

Training Nodes

Used to run training, save results, and apply the LoRA:
NodePurpose
Train LoRATrain a LoRA from latents and conditioning data
Save LoRA WeightsExport trained LoRA weights to a safetensors file
Load LoRA ModelApply trained LoRA weights to a model for inference
Plot Loss GraphVisualize training loss over time

Requirements

  • A GPU with sufficient VRAM (training typically requires more memory than inference)
  • Training images placed in a subfolder under ComfyUI/input/
  • A base model (checkpoint)

Typical Training Workflow

1

Load training images

Place your training images in a subfolder under ComfyUI/input/.
  • Use Load Image Dataset from Folder for images only
  • Use Load Image and Text Dataset from Folder for image–caption pairs (each image needs a matching .txt file with the same base name)
Start with 10–20 high-quality images. Quality matters more than quantity.
2

Encode the dataset

Connect images and text to Make Training Dataset along with a VAE and CLIP model. This produces latents and conditioning outputs.To reuse the same dataset across multiple training runs, save it with Save Training Dataset and load it later with Load Training Dataset — no re-encoding needed.
3

(Optional) Resolution bucketing

If your images have varying dimensions, pass the encoded data through Resolution Bucket to group them by resolution, then enable bucket_mode in the Train LoRA node for efficient batched training.
4

Configure and run Train LoRA

Connect the model, latents, and conditioning to Train LoRA and adjust parameters as needed.Recommended starting values:
ParameterStarting value
steps100–500
rank8–16
learning_rate0.0001–0.0005
optimizerAdamW
loss_functionMSE
The node outputs trained lora weights, a loss_map, and the completed steps count.
5

Monitor training progress

Connect loss_map to Plot Loss Graph to visualize the loss curve. Training can be stopped once the loss plateaus.
6

Save and test your LoRA

Connect lora to Save LoRA Weights to export a .safetensors file to ComfyUI/output/loras/.In your inference workflow, use Load LoRA Model to apply the trained LoRA to the base model and test the results.

VRAM Optimization

TechniqueNotes
gradient_checkpointing (on by default)Reduces VRAM by recomputing activations during backward pass
Lower batch_sizeMost direct way to reduce VRAM
Higher grad_accumulation_stepsEquivalent to a larger batch size with no extra VRAM cost
offloadingMoves model weights to CPU; requires gradient_checkpointing to be enabled
bypass_modeApplies adapters via forward hooks instead of weight modification; required for quantized models (FP8/FP4)

Quantized Model Training

To train a LoRA on a quantized model (FP8/FP4), use these settings in Train LoRA:
  • training_dtype: none
  • quantized_backward: enabled
  • bypass_mode: enabled
Also enable bypass in Load LoRA Model when using the resulting LoRA for inference.

Continuing Training

Set existing_lora in Train LoRA to an existing saved LoRA file to resume from a checkpoint. The total step count accumulates automatically.

Supported Algorithms

The algorithm parameter in Train LoRA selects the weight adapter type:
AlgorithmNotes
LoRAStandard low-rank adaptation — recommended for most use cases
LoHaHadamard-product low-rank adaptation
LoKrKronecker-product low-rank adaptation — more parameter-efficient
OFTOrthogonal Fine-Tuning (experimental)