LoRA training teaches an existing image model one new subject or style by training a small add-on file while the model stays frozen. Pick the base model you will generate with, collect a small set of sharp, varied, captioned images of one fictional or consenting subject, run a trainer that supports that model (sd-scripts or Kohya SS for SDXL and FLUX.1; AI Toolkit, OneTrainer or musubi-tuner for FLUX.2, Qwen-Image and Z-Image), save several checkpoints and keep the one that holds the subject while still following new prompts.
LoRA training teaches an existing image model one new thing, such as a face or a style, by training a small add-on file while the model itself stays frozen. You give a trainer a small set of captioned images, it runs them against the base model you generate with, and you keep the saved checkpoint that holds the subject while still obeying new prompts. LoRA can improve character consistency, but no training recipe guarantees the same face in every generation.
Checked 13 October 2026 against the trainers' own repositories and docs: sd-scripts 0.12.0 (released 24 September 2026) with its LoRA training guide, dataset configuration, advanced guide, SDXL guide and FLUX.1 guide; Kohya SS, AI Toolkit, OneTrainer, musubi-tuner and FluxGym; the model cards on Hugging Face; Black Forest Labs' klein training guide and example; the LoRA paper and the Diffusers LoRA guide; the ComfyUI LoRA tutorial and the AUTOMATIC1111 feature list; and the pricing shown by fal, Replicate and Civitai.
One rule before the method. The subject of a character LoRA here is a fictional adult persona that you created, or yourself. Training on a real person's photos without their written permission is not allowed: this guide does not teach it, and our AI likeness rights guide explains why permission has to be in writing.
What is LoRA training?
LoRA stands for Low-Rank Adaptation. The original paper introduced it for language models, and image tools adopted it. Hugging Face's Diffusers guide gives the plainest description: it "works by inserting a smaller number of new weights into the model and only these are trained". The base model, whether Stable Diffusion or a newer family, is not changed; you load the new file beside it.
Two consequences follow. A LoRA belongs to the model family it was trained against (sd-scripts has a separate script and network module for each one), so decide where you will generate before you train. And a LoRA learns from what your images have in common, so whatever repeats across the set, wanted or not, is what it will reproduce.
- 01Base model
The model you will generate with. Check its licence first.
- 02Dataset
Sharp, varied images of one subject.
- 03Captions
A trigger word, plus everything that should stay changeable.
- 04Training
A trainer that supports the model, with checkpoints saved at intervals.
- 05Testing
Every checkpoint on the same prompts and seed.
- 06Use
Load the chosen file and set its strength.
Choose the base model before the trainer
The licence of the weights decides whether you may use the model for paid work, and it is separate from the trainer's licence. These are the families most character LoRAs are trained on, with the licence each model card states today. If you have not settled on a family, AI models for creators compares them by use.
| Base model | Weights licence | Trainers that list it |
|---|---|---|
| SDXL 1.0 | CreativeML Open RAIL++-M | sd-scripts, Kohya SS, AI Toolkit, OneTrainer |
| FLUX.1 [dev] | FLUX.1 [dev] Non-Commercial License; the model card says outputs can be used commercially | sd-scripts, Kohya SS, FluxGym, AI Toolkit, OneTrainer |
| FLUX.2 [dev] | FLUX Non-Commercial License; same note on outputs | AI Toolkit, OneTrainer, musubi-tuner |
| FLUX.2 [klein] Base 4B | Apache 2.0 | AI Toolkit, OneTrainer, musubi-tuner |
| FLUX.2 [klein] Base 9B | FLUX Non-Commercial License | AI Toolkit, OneTrainer, musubi-tuner |
| Qwen-Image (and Qwen-Image-2512 in AI Toolkit) | Apache 2.0 | AI Toolkit, OneTrainer, musubi-tuner |
| Z-Image (and Z-Image-Turbo in AI Toolkit) | Apache 2.0 | AI Toolkit, OneTrainer, musubi-tuner |
Two notes from the publishers. Black Forest Labs calls the klein Base models "ideal for fine-tuning due to their undistilled architecture" and recommends the 4B variant for most users because it needs less hardware. The Z-Image model card says its non-distilled nature "makes it a good base for LoRA training".
Pick a LoRA trainer
| Trainer | How you use it | Image models it lists | Notes |
|---|---|---|---|
| sd-scripts 0.12.0 | Command line | SD 1.x and 2.x, SDXL, SD3 and 3.5, FLUX.1, Lumina, HunyuanImage-2.1, Anima | Needs PyTorch 2.6.0 or later. The commands on this page are its own. |
| Kohya SS v26.0.0 | Browser interface over sd-scripts | The sd-scripts families | Released 9 July 2026. Installs with uv or pip. |
| AI Toolkit | Interface or command line | FLUX.1, FLUX.2 dev and klein, Qwen-Image, Z-Image, Chroma, SDXL and more | Python 3.10 or later and an NVIDIA card. Used in Black Forest Labs' klein example. |
| OneTrainer | Desktop interface | Z-Image, Qwen Image, FLUX.1, FLUX.2 dev and klein, Chroma, SD 1.5 to 3.5, SDXL | Built-in BLIP, BLIP2 and WD-1.4 captioning and masked training. |
| musubi-tuner 0.3.6 | Command line | FLUX.1 Kontext, FLUX.2 dev and klein, Qwen-Image, Z-Image, plus video models | Recommends 12GB of VRAM or more for image training and 64GB of system memory. |
| FluxGym | Simple web interface over sd-scripts | FLUX.1 | Built for 12GB, 16GB and 20GB cards. |
If you train SDXL or FLUX.1, sd-scripts and Kohya SS are the reference, and the commands on this page are theirs. For FLUX.2, Qwen-Image or Z-Image, use AI Toolkit, OneTrainer or musubi-tuner, because sd-scripts does not list those models. Training inside the node graph is covered in training a LoRA in ComfyUI.
Hosted trainers, if you have no suitable card
| Service | Listed price on 13 October 2026 |
|---|---|
| fal: FLUX.1 fast training | $2 per run at the default 1,000 steps; the price scales with steps |
| fal: FLUX.2 trainer | $0.0064 per step, so $6.40 for 1,000 steps |
| fal: Qwen-Image-2512 trainer | $0.0015 per step, with a 500 step minimum |
| fal: Z-Image trainer | $2.26 per 1,000 steps |
| Replicate: FLUX fine-tune | About $1.46 for the 1,000 step run in its guide; billed per second |
| Civitai: on-site trainer | From 500 Buzz for SD 1.5 and SDXL; Flux and video models cost more |
A hosted trainer bills per run or per step, so a failed experiment still costs money. Civitai's own notice says the site has not been accessible in Australia since 16 March 2026, so confirm it loads where you are before planning around it.
Step 1: build the dataset
The dataset decides more than any setting. Replicate's guide says a FLUX fine-tune can work with as few as two images and calls 10 "a good minimum". Black Forest Labs, writing about a style LoRA, gives 20 to 40 images as the optimal size, with too little variation below 20 and dilution above 40. For a face there is no published number that holds everywhere, so judge the set by coverage, and make sure every image is clearly one character. The 40-shot character dataset checklist lists the shots.
- High resolution: 1024px or higher
- Consistent quality, with artifacts and weak samples removed
- Varied poses, angles and compositions
- Different lighting conditions
- A mix of close-ups and full scenes
- Different settings and clothing
- No repetitive backgrounds
Source: Black Forest Labs klein training guide and Replicate FLUX fine-tuning guide, read 13 October 2026
A persona that does not exist has no photos, so you make the reference set first: write a fixed description of the face, generate candidates, choose one, then make the other angles from it with a reference-based editor. Cull hard. If you would rather start that set in a hosted tool, our AI influencer generator roundup compares them.
Step 2: caption what should stay changeable
Each image gets a text file with the same name. Start it with a trigger word that is not a real word. Black Forest Labs' example uses GFX_IMPR5N, and Replicate advises something unique that is not TOK, which other fine-tunes already use. Then describe the things you want to be able to change later.
- The face itself: the trigger word stands for it
- A real person's name
- Tags an automatic captioner got wrong
- A common word as the trigger, such as TOK
- The trigger word, in every caption
- Clothing, hairstyle and accessories in this image
- Camera angle and framing
- Lighting, background and setting
The rule comes from Black Forest Labs' guide: "Describe everything visible except the style/concept you want to teach the model." Read it the other way round and it explains a common fault: a jacket that appears in most images and in no caption is left attached to the trigger word. Automatic captioners save time (OneTrainer ships BLIP, BLIP2 and WD-1.4), but read every file afterwards.
Step 3: describe the dataset in a TOML file
Current sd-scripts reads the dataset from a TOML file passed with --dataset_config. Older tutorials put the repeat count in the name of the image folder. The official reference is explicit that this no longer applies: even if you name the folder something like 5_cat, "the number of repeats of the image and the class name will not be reflected". Images must sit directly inside image_dir, and repeats are set with num_repeats.
[general]
caption_extension = ".txt"
[[datasets]]
resolution = 1024
batch_size = 1
enable_bucket = true
bucket_no_upscale = true
[[datasets.subsets]]
image_dir = "C:/datasets/persona/images"
num_repeats = 1This is an SDXL-sized example assembled from the options in the dataset configuration reference. Resolution and batch size are set per dataset, and each subset points at one folder. class_tokens is only used as a fallback for an image that has no matching caption file, so it is left out here.
Step 4: install the trainer and run it
The sd-scripts README gives this Windows install, for Python 3.10 and CUDA 12.4:
git clone https://github.com/kohya-ss/sd-scripts.git
cd sd-scripts
python -m venv venv
.\venv\Scripts\activate
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124
pip install --upgrade -r requirements.txt
accelerate configThen the SDXL LoRA command, exactly as the SDXL guide prints it:
accelerate launch --num_cpu_threads_per_process 1 sdxl_train_network.py
--pretrained_model_name_or_path="<SDXL base model path>"
--dataset_config="my_sdxl_dataset_config.toml"
--output_dir="<output directory for training results>"
--output_name="my_sdxl_lora"
--save_model_as=safetensors
--network_module=networks.lora
--network_dim=32
--network_alpha=16
--learning_rate=1e-4
--unet_lr=1e-4
--text_encoder_lr1=1e-5
--text_encoder_lr2=1e-5
--optimizer_type="AdamW8bit"
--lr_scheduler="constant"
--max_train_epochs=10
--save_every_n_epochs=1
--mixed_precision="bf16"
--gradient_checkpointing
--cache_text_encoder_outputs
--cache_latentsThe docs show it across lines for reading and add: "In reality, you need to write this in a single line". On Windows, write one line or end each line with ^; on Linux or Mac, end each line with a backslash. One caution about the example itself: the same guide notes that with --cache_text_encoder_outputs the text encoder LoRA cannot be trained and --network_train_unet_only must be specified, so add that flag, or drop the cache if you want the text encoders trained.
FLUX.1 on a smaller card
FLUX.1 uses flux_train_network.py with the networks.lora_flux module and four files: the model, CLIP-L, T5-XXL and the autoencoder. With --fp8_base, the FLUX.1 guide gives these settings by memory:
| VRAM | Documented setting |
|---|---|
| 24GB | Basic settings work (batch size 2) |
| 16GB | Batch size 1 and --blocks_to_swap |
| 12GB | --blocks_to_swap 16 and 8bit AdamW |
| 10GB | --blocks_to_swap 22, with the fp8 T5XXL file |
| 8GB | --blocks_to_swap 28, with the fp8 T5XXL file |
Higher block swap values save memory and slow training. What ComfyUI itself needs for generating afterwards is on our ComfyUI statistics page. For FLUX.2 klein, Black Forest Labs lists an NVIDIA card with 12GB of VRAM and 32GB of system memory as the minimum for the 4B Base model, and 22GB with 64GB for the 9B.
LoRA training settings: the documented starting points
No setting is correct everywhere. These are the values in the publishers' own examples: start from the column for your model and change one thing per run.
| Setting | sd-scripts SDXL example | sd-scripts FLUX.1 example | Black Forest Labs klein guide |
|---|---|---|---|
| Rank (network_dim) | 32 | 16 | 32 in the first example config |
| Alpha (network_alpha) | 16 | 1 | 32 |
| Learning rate | 1e-4, with 1e-5 for the two text encoders | 1e-4 | 8e-5 to 1e-4 for a LoRA |
| Length | 10 epochs | 10 epochs | 1,500 to 3,000 steps for a character |
| Checkpoints | Saved every epoch | Saved every epoch | Saved every 250 steps |
What the two main dials do, in the words of the sd-scripts guide. Rank: "Higher values increase expressiveness but also increase file size and computational cost. Values between 4 and 128 are commonly used." Alpha: "It is generally recommended to set it to about half the value of network_dim, but it can also be the same value".
Length is counted in steps, and the count depends on images, repeats, epochs and batch size together. Our free LoRA training steps calculator works out steps per epoch and total steps from those four numbers, so you can see what a change does before you spend the run on it.
Avoid overfitting: test checkpoints, not loss
An overfitted LoRA repeats its training images and stops listening to the prompt. The defence is in the command already. --save_every_n_epochs=1 leaves you a file per epoch to choose from. Black Forest Labs' guide says to "monitor sample outputs to avoid overfitting", and fal's trainer page says that "too few steps may not capture the style, while too many can lead to overfitting". Our face LoRA overfitting guide shows how to read the signs.
Run one test on every checkpoint: a fixed base model, sampler, seed and LoRA strength, across prompts with angles, outfits and settings that were not in the dataset. Judge two things separately: is it still the character, and did it do what the prompt asked. Keep the earliest checkpoint that passes both.
LoRA strength: loading and using the file
In ComfyUI, put the file in ComfyUI/models/loras and add a Load LoRA node between the checkpoint and the rest of the graph. The official tutorial describes its two strength inputs: strength_model "affects how strongly the LoRA influences the model weights", and strength_clip does the same for the text encoder. In AUTOMATIC1111, the file goes in models/Lora and is called with <lora:filename:multiplier>, where the multiplier is "a number, generally from 0 to 1".
Strength is the last dial, not a repair. If a checkpoint only looks right at an extreme value, compare a neighbouring checkpoint at a normal one before you settle. A still that holds up is also the starting frame for video, and the Kling AI tutorial picks up from there.
LoRA training troubleshooting
Every row comes from the trainers' own documentation. Match the symptom, then change one thing.
| Symptom | Cause | Fix | Documented in |
|---|---|---|---|
| ValueError: fp16 mixed precision requires a GPU | Reported by some users after accelerate config | Run accelerate config again and answer 0 to the question about which GPUs to use | sd-scripts README |
| Loss shows NaN | Learning rate too high, wrong mixed precision settings, or a dataset problem | Lower the learning rate; with fp16 add --no_half_vae | sd-scripts advanced guide |
| Out of memory | The model, batch and resolution do not fit the card | Use bf16 or fp16, --gradient_checkpointing, the two caches and AdamW8bit; on FLUX.1 add --blocks_to_swap | sd-scripts advanced and FLUX.1 guides |
| Training is not progressing | Learning rate too low, or optimizer and scheduler settings | Raise the learning rate, then check the optimizer, the scheduler and the dataset | sd-scripts advanced guide |
| Repeats from a folder name like 5_cat are ignored | With a dataset config, folder names carry no settings | Set num_repeats in the TOML subset | sd-scripts dataset configuration |
| The text encoder is not being trained | --cache_text_encoder_outputs switches text encoder LoRA off | Add --network_train_unet_only, or remove the cache to train it | sd-scripts SDXL guide |
| Setting up on an RTX 50 series card | The default install targets PyTorch 2.6.0 and CUDA 12.4 | Use PyTorch 2.8.0 with CUDA 12.8 or 12.9 | sd-scripts README |
| Kohya SS: an error about the page file | The Windows page file is too small | Increase the page file size limit | Kohya SS README |
| The outfit or background follows the trigger word | The captions left a repeated detail undescribed | Describe everything visible except the thing you are teaching | Black Forest Labs training guide |
LoRA training FAQ
What is LoRA training?
LoRA training teaches an existing image model one new subject or style by training a small add-on file while the model itself stays frozen. Hugging Face describes it as inserting a smaller number of new weights into the model and training only those. You supply captioned images, a trainer runs them against the base model, and the result is a file you load beside that same model.
How many images do I need to train a LoRA?
There is no single number. Replicate says a FLUX fine-tune can work with as few as two images and that 10 is a good minimum. Black Forest Labs gives 20 to 40 images as the optimal size for a style LoRA. For a face, coverage decides the result: sharp front, three-quarter and profile views in different light, clothing and settings, with near-duplicates removed.
What is the best tool for LoRA training in 2026?
It depends on the base model. For SDXL and FLUX.1, sd-scripts 0.12.0 or its browser interface Kohya SS are the reference. For FLUX.2, Qwen-Image and Z-Image, use AI Toolkit, OneTrainer or musubi-tuner, because sd-scripts does not list those models. With no suitable graphics card, fal, Replicate and Civitai run the job for a fee.
How do I prevent overfitting during LoRA training?
Save a checkpoint at intervals and compare them, instead of keeping only the last one. Black Forest Labs' guide says to monitor sample outputs to avoid overfitting, and fal notes that too many steps can lead to overfitting. sd-scripts also offers --scale_weight_norms, which its docs say can help prevent overfitting, with 1.0 as a starting point.
What LoRA strength should I use?
There is no universal value, so test it. In ComfyUI the Load LoRA node has two values: strength_model for the image model and strength_clip for the text encoder. In AUTOMATIC1111 the multiplier in <lora:filename:multiplier> is, in its wiki's words, a number generally from 0 to 1. Compare a few values on one fixed seed and keep the lowest one that still holds the character.
Can I train a LoRA without my own GPU?
Yes. fal lists FLUX.1 fast training at $2 per run at the default 1,000 steps, Replicate's guide puts its FLUX trainer at about $1.46 for a 1,000 step run, and Civitai's on-site trainer starts from 500 Buzz for SD 1.5 and SDXL. Prices were read on 13 October 2026. You still have to test the result yourself.
Can I train a LoRA on photos of a real person?
Not without that person's written permission, and this guide does not cover it. Train on a fictional adult persona that you created, or on your own face. Civitai's trainer makes uploaders confirm they are the person in the images or have explicit consent, and likeness laws apply whatever tool you use.
Free · no card needed
Start with the free Starter Kit.
An AI character bible from AI Influencers, plus four more working files.
A LoRA is one lesson. A persona that lasts is the whole program.
AI Influencers, included in All Access, takes the character from a written description to a trained face, then through ControlNet, photorealism, video and the disclosure rules for publishing. The other three programs, live coaching and the private community come with the same subscription.
Work out your steps before you train
Enter images, repeats, epochs and batch size and the free calculator returns steps per epoch and total steps, the number every trainer setting depends on.