Automate 3000+ Apps AI Support Chatbot Rent Cloud GPUs Smart Forms Free Rank In AI Search Track Your Rankings
Automate 3000+ Apps AI Support Chatbot
Free Email Marketing AI Data Analyst Funnels + Email Free AI Agent Workspace Build AI Apps No Code No-Code AI Agents
Home » Local AI Image Generation on Mac » LoRA Training Settings

LoRA Training Settings Explained: Steps, Learning Rate and Rank

For a first LoRA, use a learning rate of 1e-4, a rank of 8 to 16, a batch size of 1, and enough epochs to reach about 1000 to 2000 total steps, which for 25 images is 40 to 80 epochs. Save a checkpoint every 100 to 200 steps and pick the best one by looking at preview images. Those 4 numbers do nearly all the work, and when a LoRA fails, the cause is usually too many or too few steps, not an exotic setting.

The 4 Settings That Matter

So a training config has a dozen or more fields, and it is easy to think each one needs tuning. It does not. Total steps, learning rate, rank and resolution decide the result, and everything else is either a memory setting or bookkeeping. If you only ever touch those 4, you can make good LoRAs.

It helps to have 1 picture of what is going on. Training shows the model 1 of your images with noise added, asks it to guess the clean version, measures how wrong it was, and nudges the LoRA weights a little in the direction that would have been less wrong. That is 1 step. Do it a thousand times and the LoRA has absorbed what your images have in common.

Steps and Epochs

A step is 1 nudge. An epoch is 1 pass through every image. So total steps is images times epochs, divided by the batch size:

ImagesEpochsTotal steps (batch size 1)
15801200
25501250
40401600
60 (style)352100

For 1 subject, 1000 to 2000 steps is the normal window. Styles often want more, 2000 to 4000, because a style has to be pulled out of many different subjects. These are starting ranges, not laws, and they shift with the model, the rank and the learning rate.

The thing to understand is that there is no penalty for setting the epoch count high as long as you save checkpoints along the way. Set it for 2500 steps, save every 150, and you get 16 LoRAs to choose from. The right step count is then something you find by looking, not something you have to guess before you start. In the mflux config that is "num_epochs" in the training loop and "save_frequency" in the checkpoint block.

Learning Rate

The learning rate is the size of each nudge. 1e-4, which is 0.0001, is the standard starting value for LoRA training and the one the mflux example configs use with the AdamW optimizer.

Too high and the LoRA overshoots, the previews turn to noise, colors burn, faces melt, usually within the first few hundred steps. Too low and nothing seems to happen, you get to 2000 steps and the subject still is not there. If 1e-4 burns, try 5e-5. If it is too slow, try 2e-4. Move by a factor of 2, not a factor of 10, the usable window is narrow.

Learning rate and steps trade against each other. Half the rate with twice the steps lands in roughly the same place, and the slower version is usually a bit cleaner and gives you more checkpoints near the sweet spot. So when time allows, lower and longer is the safer side.

Rank

Rank is the size of the LoRA, how much room it has to store what it learned. Rank 8 is small, 16 is the common default, 32 is large, and beyond that is for special cases. The file size scales with it.

A bigger rank is not a better LoRA. A simple subject, 1 face, 1 product, fits fine in rank 8 or 16. Give it rank 64 and it has room to memorize your exact training photos, backgrounds and all, which is the opposite of what you want. Rank basically means "how much detail am I allowed to remember", and for most subjects the answer you want is "not too much". Use 8 to 16 for a person, pet or object, and 16 to 32 for a detailed art style or a character with a complicated outfit.

In mflux the rank is set per layer in the lora_layers block, and the same block decides which layers get a LoRA at all:

"lora_layers": {
  "targets": [
    { "module_path": "layers.{block}.attention.to_q", "blocks": { "start": 15, "end": 30 }, "rank": 8 },
    { "module_path": "layers.{block}.attention.to_k", "blocks": { "start": 15, "end": 30 }, "rank": 8 },
    { "module_path": "layers.{block}.attention.to_v", "blocks": { "start": 15, "end": 30 }, "rank": 8 }
  ]
}

That example from the Z-Image docs puts a rank 8 LoRA on the attention layers of blocks 15 to 30, the second half of the model. The fuller example config in the mflux repo covers all 30 blocks at rank 16 and adds the feed forward layers, which is a stronger and larger LoRA that also needs more memory to train. Start with the small one. The layer names are different for every model family, so copy the block from that model's own README instead of reusing one from another model.

Resolution

Training resolution is the image size the model sees during training, capped by "max_resolution" in mflux. 1024 gives the most detail and uses the most memory and time. 768 is noticeably lighter and still makes good LoRAs for faces and objects. 512 is fast and coarse, fine for a test run to check that the dataset and config work before committing to a long one.

A good habit is a quick 512 run of 300 steps first. If the previews show the subject starting to appear, the dataset and captions are sound, and the long run at full size is worth starting. If they show nothing, or the wrong thing, you found out in 20 minutes instead of 6 hours.

Batch Size

Batch size is how many images are processed per step. On a Mac leave it at 1. Bigger batches smooth the training a little and need proportionally more memory, and memory is the thing a Mac training run is always short on.

Timestep Range

The mflux configs have 2 fields that look odd at first, "timestep_low" and "timestep_high". An image is generated in steps from pure noise to finished picture, and these set which part of that journey the training samples from. Early steps decide composition and overall shapes, late steps decide fine detail.

The examples use 4 to 9 for Z-Image Turbo (out of 9 steps) and 25 to 40 for FLUX.2 klein base (out of 40), so both train on the middle and later part. Leave them at the example values for your model. They are worth knowing about mainly so you do not copy a range from one model's config into another, since 25 to 40 makes no sense on a model with 9 steps.

Memory Settings Are Not Quality Settings

These 3 change whether the run fits, not how good the LoRA is:

Turn them on when the run gets killed at the first step, and leave them off when you have the room, since off is faster.

How to Read the Result

You have a row of preview images from different step counts. Here is what each failure looks like and what to change:

What you seeWhat it meansWhat to do
Subject never appears, previews look like the base modelUndertrained, or the trigger word is missing from captionsCheck captions, then more steps or a higher learning rate
Subject is close but not quite rightSlightly undertrainedUse a later checkpoint, or raise the LoRA scale to 1.1 or 1.2
Subject is right, prompt is followedThe sweet spotKeep this checkpoint
Subject is right but always in the same pose or backgroundOvertrained, or the dataset lacks varietyUse an earlier checkpoint, lower the scale to 0.7, fix the dataset
Colors burned, harsh contrast, warped shapesBadly overtrained or learning rate too highEarlier checkpoint, halve the learning rate
Previews are noise from early onLearning rate far too high, or a config copied from the wrong modelRecheck the config against the model's README

Do not trust the loss curve to tell you this. The loss on image models is noisy and can keep drifting down long after the LoRA has started memorizing. The preview images are the real test, especially ones with prompts that ask for something your training photos never showed.

A Sensible Order for Changing Things

When a run does not come out right, change 1 thing at a time, in this order. First the checkpoint, try earlier and later ones from the run you already have, that costs nothing. Then the LoRA scale at generation time, also free. Then the dataset, since most problems start there, covered in building a LoRA training dataset. Only then the learning rate, and last the rank. Most people do it in the reverse order and spend days retraining for a problem that a different checkpoint would have solved in a minute.

Overshoot the steps and save often. Use 1e-4, rank 8 to 16, batch size 1, aim past where you think the LoRA will be done, and checkpoint every 100 to 200 steps. Picking the best checkpoint from a long run beats trying to guess the perfect step count in advance.