~10 min read

Fine-Tune a LoRA Adapter

~45 minIntermediateYou'll build: A trained LoRA adapter for your art style

In this tutorial you’ll prepare a training dataset, configure Kohya SS, and train a LoRA adapter that captures your unique art style — then test it in ComfyUI.

LoRA training requires a GPU with at least 8 GB VRAM. SDXL LoRA training requires 12 GB minimum. Training on CPU is not practical.
VRAMCapabilityBatch SizeNotes
8 GBSD 1.5 only1Use gradient checkpointing and fp16 mixed precision
12 GBSDXL (batch 1)1Tight but workable for SDXL LoRA with gradient checkpointing
16 GB+Comfortable SDXL2–4Recommended for SDXL; larger batches improve training stability
24 GB+Large batches4–8Fastest training; can use higher network rank and batch sizes

You’ll also need 15–50 high-quality images that represent the style or subject you want to train on, and Kohya SS installed from the Thumper-Run catalog.

Step 1: Prerequisites

Before you begin, make sure you have the following ready:

  • GPU — NVIDIA with CUDA 11.8+ (see VRAM table above)
  • Training images — 15–50 images representing your target style or subject
  • Kohya SS — install from the Thumper-Run catalog (one-click install)
  • Base model — SD 1.5 or SDXL checkpoint (downloaded with the SDXL Starter pack)
  • Disk space — at least 20 GB free for Kohya SS, the base model, and training outputs
If you already have ComfyUI installed with the SDXL Starter model pack, the base checkpoint is already on disk. Kohya SS will detect it automatically.

What is LoRA?

LoRA (Low-Rank Adaptation) is a technique that trains a small adapter on top of a frozen base model. Instead of modifying all the model’s weights (billions of parameters), LoRA inserts small trainable matrices into the attention layers. This dramatically reduces VRAM usage and training time.

The result is a small file (typically 10–200 MB) that can be loaded alongside any compatible base model at inference time. You can combine multiple LoRAs, adjust their strength independently, and swap them without reloading the base model.

LoRA vs Full Fine-Tuning

AspectLoRAFull Fine-Tune
Output size10–200 MB adapter2–7 GB full model
VRAM required8–16 GB24–48 GB
Training time30 min – 3 hours6–24+ hours
CombinableYes — stack multiple LoRAsNo — one model per checkpoint
Quality ceilingVery high for styles/charactersHighest possible

Step 2: Prepare Your Dataset

Dataset quality is the single biggest factor in LoRA training. A small, curated dataset outperforms a large, noisy one every time.

Image Selection

  • Consistent style — all images should share the visual qualities you want the LoRA to learn
  • Varied subjects — include different compositions, angles, and subjects to prevent overfitting
  • Clean backgrounds — avoid cluttered or distracting backgrounds unless clutter is part of the style
  • High resolution — source images should be at least as large as your training resolution
  • No watermarks — watermarks, logos, and text will be learned by the model

Resolution

Match your training resolution to the base model:

  • SD 1.5 — 512×512 (or 512×768 for portrait orientation)
  • SDXL — 1024×1024 (or bucket resolutions like 896×1152)

Kohya SS supports resolution bucketing, which groups images by aspect ratio automatically. You do not need to crop every image to exact squares.

Captioning

Each image needs a text caption that describes its content. There are two main approaches:

Natural language captions describe the image in sentences:

# Good: specific, descriptive, includes trigger word
a painting in the style of mystyle, a woman standing
in a field of sunflowers, warm golden light, impressionist
brushstrokes, soft edges
# Bad: vague, no trigger word, too short
a nice painting of a woman

Tag-based captions use comma-separated keywords (Danbooru style):

# Good: trigger word first, specific tags
mystyle, 1girl, standing, sunflower field, golden hour,
impressionist, soft lighting, warm colors
# Bad: generic tags only
1girl, standing, flowers
Use natural language captions for SDXL (it was trained on natural language). Use tag-based captions for SD 1.5 anime models trained on Danbooru tags.

Save each caption as a .txt file with the same filename as the image (e.g. image01.png and image01.txt).

Directory Structure

Kohya SS expects a specific folder layout. The folder name encodes the number of repeats:

training_data/
img/
10_mystyle/ # 10 repeats, concept name "mystyle"
image01.png
image01.txt
image02.png
image02.txt
...
model/
# Base model checkpoint goes here (or use a path)
output/
# Trained LoRA files will be saved here

Repeats vs Steps

The repeat count in the folder name (e.g. "10" in "10_mystyle") controls how many times each image is shown per epoch. The total training steps are calculated as:

total_steps = (num_images × repeats × epochs) / batch_size
# Example: 20 images, 10 repeats, 10 epochs, batch size 1
# total_steps = (20 × 10 × 10) / 1 = 2000 steps
# Example: 50 images, 5 repeats, 8 epochs, batch size 2
# total_steps = (50 × 5 × 8) / 2 = 1000 steps

A good starting point is 1500–3000 total steps. More steps is not always better — over-training leads to stiff, repetitive outputs.

Trigger Word Strategy

A trigger word is a unique token that activates your LoRA at inference time. Choose a word that:

  • Does not exist in natural language (e.g. "mystyle", "zxy_art", "jhnwick")
  • Is easy to type and remember
  • Does not conflict with other LoRAs you might combine

Include the trigger word in every caption, typically at the beginning. At inference time, including the trigger word in your prompt activates the LoRA’s learned style.

Avoid common English words as trigger words. If you use "painting" as a trigger, the LoRA will activate whenever anyone writes "painting" in any prompt, even without intending to use your style.

Auto-Captioning Tools

Manually captioning 50 images is tedious. These tools can generate captions automatically:

  • Kohya SS built-in tagger — uses WD14 tagger for Danbooru-style tags. Available in the Utilities tab.
  • BLIP/BLIP-2 — generates natural language captions. Good for SDXL training.
  • Florence-2 — Microsoft’s vision model, produces detailed descriptions. Available in ComfyUI as a custom node.

Always review auto-generated captions and add your trigger word manually. Auto-captioners miss stylistic details that are important for LoRA training.

Regularization Images (Optional)

Regularization images help prevent the LoRA from "overwriting" the base model’s general understanding of a concept. They are generated from the base model using the class word (e.g. "woman", "landscape") without your trigger word.

training_data/
img/
10_mystyle/ # Your training images
...
reg/
1_woman/ # 1 repeat, base class "woman"
reg_001.png
reg_002.png
# Generate 100–200 images from the base model

Regularization is optional but recommended when training character or face LoRAs. For pure style LoRAs, it’s usually unnecessary.

Step 3: Install Kohya SS

Kohya SS is available in the Thumper-Run catalog. Installation is one click:

  1. Open the Thumper-Run catalog and search for Kohya SS
  2. Click Install — the pipeline clones the repo, creates a venv, and installs dependencies
  3. Wait for installation to complete (typically 3–5 minutes)
  4. Click Launch to start the Kohya SS GUI

Once launched, you should see console output similar to:

bash
# Expected console output
Kohya SS GUI starting...
Loading modules...
CUDA device detected: NVIDIA GeForce RTX 4070 (12 GB)
GUI running at http://localhost:7860

Verify GPU Detection

In the Kohya SS console output, confirm that your GPU is detected. If you see "No CUDA device found", check your NVIDIA driver installation and CUDA version.

If Kohya SS fails to detect your GPU, try closing other GPU-intensive applications first. Some apps hold exclusive GPU locks.

Verify Python Environment

Kohya SS requires Python 3.10 or 3.11 with specific PyTorch versions. The Thumper-Run installer handles this automatically, but if you encounter issues:

bash
# Check Python version inside the venv
python --version
# Should output: Python 3.10.x or 3.11.x
# Check PyTorch CUDA availability
python -c "import torch; print(torch.cuda.is_available())"
# Should output: True
# Check VRAM detected
python -c "import torch; print(f'{torch.cuda.get_device_properties(0).total_mem / 1024**3:.1f} GB')"

Configuration File

For repeatable training runs, Kohya SS can save and load configuration files. After setting your parameters in the GUI, click "Save" to export a .json config. This is useful for:

  • Resuming a training run with the same parameters
  • Sharing your setup with others
  • A/B testing parameter changes (save config A, modify, save config B)
  • Documentation — keep a record of what worked

Step 4: Train Your LoRA

With your dataset prepared and Kohya SS running, it’s time to configure and start training.

GUI Walkthrough

The Kohya SS GUI has several tabs. Here’s where to set each group of parameters:

  • Source Model tab — select your base checkpoint (SD 1.5 or SDXL) and set the model type
  • Folders tab — point to your training images directory, regularization directory (optional), and output directory
  • Parameters tab — set learning rate, optimizer, network rank, epochs, and other training hyperparameters

Parameter Reference

ParameterRecommendedRangeNotes
Learning Rate1e-45e-5 – 5e-4Lower for SDXL; higher for SD 1.5. Use 1.0 with Prodigy optimizer.
OptimizerAdamW8bitAdamW / AdamW8bit / ProdigyAdamW8bit saves VRAM. Prodigy auto-tunes LR (set LR to 1.0).
Network Rank324 – 128Higher rank = more capacity but larger file. 16–32 for styles, 64–128 for characters.
Network Alpha161 – rank valueScaling factor. Set to half the rank value as a starting point.
Batch Size11 – 8Limited by VRAM. Larger batches give smoother gradients.
Epochs105 – 20Save checkpoints every 2–3 epochs to compare quality.
Schedulercosine_with_restartscosine / cosine_with_restarts / constantCosine with restarts helps escape local minima. Constant is simpler.
Mixed Precisionfp16fp16 / bf16 / nofp16 for most GPUs. bf16 for RTX 30xx/40xx (slightly better quality).
Gradient CheckpointingEnabledOn / OffTrades speed for VRAM savings. Required for 8–12 GB GPUs.

Step Calculation

Calculate your total training steps before starting to ensure you’re in the right range:

steps = (images × repeats × epochs) / batch_size
# Aim for 1500–3000 total steps for a style LoRA
# Aim for 3000–5000 total steps for a character LoRA

Optimizer Selection

Choosing the right optimizer affects training quality and ease of configuration:

  • AdamW8bit — the default choice. Uses less VRAM than full AdamW. Requires manual LR tuning.
  • Prodigy — adaptive optimizer that auto-tunes the learning rate. Set LR to 1.0 and let it find the optimal rate. Great for beginners.
  • AdamW — full-precision optimizer. Better gradients but uses more VRAM. Best for 24 GB+ GPUs.

Loss Curve Interpretation

Monitor the training loss in the Kohya SS console or TensorBoard:

  • Steadily decreasing — training is working correctly
  • Plateaued early — learning rate may be too low, or the dataset is too small
  • Spikes or oscillation — learning rate is too high; reduce by half
  • Drops to near zero — overfitting; reduce epochs or increase regularization
Save checkpoints every few epochs. The final epoch is not always the best — later epochs can overfit. Compare intermediate checkpoints to find the sweet spot.

Network Rank Deep Dive

Network rank (also called LoRA dim) controls the capacity of the adapter. Think of it as how many "dimensions" the LoRA has to learn your concept:

RankFile Size (SDXL)Best ForTraining Time
4–8~5–15 MBSimple color palettes, minor style adjustmentsFastest
16–32~25–80 MBArt styles, rendering techniques, environmentsModerate
64~130 MBCharacters, faces, complex objectsSlower
128~250 MBHighly detailed characters, multi-conceptSlowest

Higher rank does not always mean better results. A rank 128 LoRA trained on 15 images will overfit faster than a rank 32 LoRA. Match the rank to the complexity of what you’re training.

TensorBoard Monitoring

Kohya SS can output TensorBoard logs for detailed training visualization. Enable logging in the Parameters tab and then view the dashboard:

bash
# Launch TensorBoard (in a separate terminal)
tensorboard --logdir /path/to/training_data/output/logs
# Open http://localhost:6006 in your browser

Key metrics to watch in TensorBoard:

  • loss/train — primary training loss, should decrease
  • lr — learning rate over time (should follow your scheduler)
  • loss/epoch_average — per-epoch average, useful for comparing checkpoints

Step 5: Test Your LoRA

Once training completes, you’ll find .safetensors files in your output directory. Time to test them in ComfyUI.

Load in ComfyUI

  1. Copy the .safetensors file to your ComfyUI models/loras/ directory
  2. In ComfyUI, add a Load LoRA node to your workflow
  3. Select your LoRA file from the dropdown
  4. Connect the Load LoRA node between the checkpoint loader and the CLIP/UNet inputs
  5. Include your trigger word in the positive prompt

Strength Sweep

The LoRA strength controls how strongly the adapter affects the output. Run a sweep to find the best value:

StrengthEffectUse Case
0.3 – 0.5Subtle influenceBlending your style with the base model’s defaults
0.6 – 0.8BalancedBest starting point for most LoRAs; clear style without artifacts
0.9 – 1.0Full effectMaximum style influence; may show artifacts if over-trained
1.1 – 1.2Over-drivenExaggerated style; useful for artistic effect but often produces distortion
Generate the same prompt at strengths 0.4, 0.6, 0.8, and 1.0 using a fixed seed. This gives you a direct comparison to find the ideal strength.

Checkpoint Comparison

If you saved multiple checkpoints during training, test each one at the same strength and prompt. Earlier checkpoints are more flexible; later ones capture more detail but may overfit.

Generalization Test

A well-trained LoRA should generalize beyond your training data. Test with diverse prompts:

  • Different subjects than your training images
  • Different compositions (close-up, wide shot, top-down)
  • Different lighting conditions (day, night, studio)
  • Combined with other LoRAs to check compatibility

If the LoRA only produces images that look like your training set, it’s overfitted. Reduce epochs or increase dataset diversity.

Combining Multiple LoRAs

One of LoRA’s greatest strengths is composability. In ComfyUI, you can chain multiple Load LoRA nodes to combine styles:

  • Style LoRA (0.7 strength) + Character LoRA (0.8 strength) = character in your style
  • Lighting LoRA (0.5) + Texture LoRA (0.6) = combined aesthetic
  • Keep total combined strength below 1.5 to avoid artifacts
When combining LoRAs, reduce each one’s strength. Two LoRAs at 1.0 each will likely produce distorted output. Start with 0.5–0.7 each and adjust.

Sharing Your LoRA

Once you’re happy with the results, share your LoRA with the community:

  • CivitAI — the largest community hub for Stable Diffusion models and LoRAs
  • HuggingFace — host your LoRA as a model repository with documentation
  • Thumper Marketplace — package your LoRA with a manifest for one-click install

Include sample images, recommended strength settings, the trigger word, and the base model it was trained on. This helps other users get the best results from your LoRA.

LoRA File Management

As you train and iterate, you’ll accumulate many LoRA files. Keep them organized:

models/loras/
mystyle_v1_epoch5.safetensors # First attempt, epoch 5
mystyle_v1_epoch8.safetensors # First attempt, epoch 8
mystyle_v2_r64_epoch6.safetensors # Second attempt, rank 64
mystyle_final.safetensors # Your best version

Include the version, rank, and epoch in the filename so you can identify each file later. Delete experimental checkpoints once you’ve found the best one to save disk space.

XY Plot for Systematic Testing

ComfyUI supports XY Plot nodes that generate a grid of images varying two parameters. This is the most efficient way to test your LoRA:

  • X axis: LoRA strength (0.3, 0.5, 0.7, 0.9, 1.0)
  • Y axis: different checkpoints (epoch 4, epoch 6, epoch 8, epoch 10)
  • Fixed seed, fixed prompt, fixed base model
  • Result: a single image grid showing all combinations

This gives you a comprehensive view of how your LoRA behaves across different settings, making it easy to pick the optimal checkpoint and strength.

Install the "ComfyUI Impact Pack" from ComfyUI Manager — it includes the XY Plot nodes and many other useful testing utilities.

Troubleshooting

ProblemCauseFix
Blurry outputUnder-trained or LR too lowIncrease epochs or raise learning rate. Check that your training images are high resolution.
Style not appearingMissing trigger word or low strengthInclude the trigger word in your prompt. Increase LoRA strength to 0.8–1.0.
CUDA OOMInsufficient VRAMEnable gradient checkpointing, reduce batch size to 1, lower network rank.
Loss spikesLearning rate too highHalve the learning rate. Switch to cosine_with_restarts scheduler.
Identical outputsSevere overfittingUse an earlier checkpoint. Reduce repeats or epochs. Add more diverse training images.
Color shift / tintTraining data has a dominant colorAdd more color-diverse training images. Lower LoRA strength. Use regularization images.
Artifacts at high strengthOver-trained or rank too highUse the LoRA at lower strength (0.6–0.8). Try a lower-rank version.
Training stuck / NaN lossLearning rate too high or corrupted dataLower learning rate to 5e-5. Check for corrupted or 0-byte images in dataset.
LoRA not loadingModel architecture mismatchEnsure the LoRA was trained on the same architecture (SD 1.5 vs SDXL) as your base model.

Quick Reference: Training Recipes

Here are tested parameter combinations for common training scenarios:

ScenarioImagesRankRepeatsEpochsLR
Style (SDXL)20–30328101e-4
Character (SDXL)30–50646128e-5
Style (SD 1.5)15–25161082e-4
Object (SDXL)20–40328101e-4

File Size Reference

Expected LoRA file sizes depend on the base model and network rank:

Base ModelRank 16Rank 32Rank 64Rank 128
SD 1.5~9 MB~18 MB~36 MB~72 MB
SDXL~25 MB~50 MB~100 MB~200 MB

If your LoRA file is significantly larger than expected, check that you selected LoRA training (not full fine-tune) in Kohya SS.

Key Takeaways

  • Dataset quality matters more than quantity — 20 great images beat 200 mediocre ones
  • Use a unique trigger word that does not exist in natural language
  • Start with AdamW8bit optimizer and 1e-4 learning rate (or Prodigy at 1.0)
  • Save checkpoints every 2–3 epochs — the last epoch is not always the best
  • Test at multiple strengths (0.4–1.0) with a fixed seed to find the sweet spot
  • If outputs look identical to training images, the LoRA is overfitted