Pro12 min

Training Your Own LoRA

A LoRA is a small trained add on that teaches a base model a specific face, product, or style. It is how you get a model that draws your client's mascot or your exact house style on demand. Training one is now a job of dataset quality more than GPU wrangling. This lesson walks the full process.

Step 1: Build a clean dataset

Quality beats quantity. For a face, 15 to 30 sharp, varied images (different angles, lighting, expressions) beat hundreds of similar ones. Crop tight on the subject, remove duplicates, and keep the resolution consistent. The dataset is 80 percent of the result.

Step 2: Caption the images

Each image gets a text caption with a unique trigger word. The trigger is the handle you will later put in prompts to summon the LoRA. Describe what varies (the pose, the setting) and keep the trigger constant so the model binds your subject to that word.

captions/img_01.txt
sks_mascot, a friendly blue fox mascot standing,
front view, plain studio background

# "sks_mascot" is the trigger word, reused in every caption
# everything else describes only what changes in this image

Step 3: Train and test

Use a trainer like the open source kohya scripts, the ai-toolkit project for Flux, or a hosted trainer on Fal or Replicate. The key dials are learning rate, steps, and rank. Start with the defaults for your base model, train, then test the trigger word in fresh prompts.

zsh — train a Flux LoRA
ai-toolkit, config points at your dataset folder
$python run.py config/train_mascot_lora.yaml
step 500/2000 loss 0.041 saving mascot_v1-000500.safetensors
step 2000/2000 done -> mascot_v1.safetensors
$
Overtraining looks like rigidity
If your LoRA can only reproduce the training poses and ignores new prompts, it is overtrained. Drop the steps or the learning rate and retrain. A slightly undertrained LoRA is far more flexible.

Result

You have a safetensors LoRA file that, dropped into ComfyUI or a Flux app and triggered by your keyword, draws your specific subject or style in any new scene you prompt.

Hands-on tasks