LoRA Training Settings Explained: Steps, Learning Rate and Rank
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:
| Images | Epochs | Total steps (batch size 1) |
|---|---|---|
| 15 | 80 | 1200 |
| 25 | 50 | 1250 |
| 40 | 40 | 1600 |
| 60 (style) | 35 | 2100 |
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:
"quantize": 8trains against an 8 bit model. Small effect on the result, big memory saving."gradient_checkpointing": truecuts peak memory to roughly the weights plus a couple of blocks, and makes steps about 30% slower. No effect on the result."low_ram": truefor the tightest machines.
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 see | What it means | What to do |
|---|---|---|
| Subject never appears, previews look like the base model | Undertrained, or the trigger word is missing from captions | Check captions, then more steps or a higher learning rate |
| Subject is close but not quite right | Slightly undertrained | Use a later checkpoint, or raise the LoRA scale to 1.1 or 1.2 |
| Subject is right, prompt is followed | The sweet spot | Keep this checkpoint |
| Subject is right but always in the same pose or background | Overtrained, or the dataset lacks variety | Use an earlier checkpoint, lower the scale to 0.7, fix the dataset |
| Colors burned, harsh contrast, warped shapes | Badly overtrained or learning rate too high | Earlier checkpoint, halve the learning rate |
| Previews are noise from early on | Learning rate far too high, or a config copied from the wrong model | Recheck 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.