How to Train Custom LoRA Models for Flux and Stable Diffusion
Disclosure: Some links in this article are affiliate links. If you click and make a purchase, we may earn a commission at no extra cost to you. This does not influence our editorial recommendations - we only recommend products and services we genuinely believe in. Read our full affiliate disclosure.

Last Tuesday, I spent four hours watching a $2.40-per-hour cloud instance burn through my bank account because I set the learning rate for a Flux.1 Dev training run to 0.0005 instead of 0.0001. The result? Every single generated image looked like a neon-drenched deep-fry disaster that could double as a warning label on an energy drink.
If you're tired of paying subscription fees to consumer-facing AI generation apps that water down your likeness or art style, training your own Low-Rank Adaptation (LoRA) is the only real fix. But doing it right requires navigating a minefield of VRAM bottlenecks, bloated datasets, and cloud GPU rental pricing models designed to bleed you dry if you leave an instance running.
RemoGrid is reader-supported. When you sign up or purchase through links on our site, we may earn an affiliate commission at no extra cost to you. We test every platform independently.
We've spent the last three weeks testing training scripts, cloud providers, and dataset curation strategies. This guide breaks down the exact workflow to train production-grade custom LoRAs for both Flux and Stable Diffusion without throwing money away.
The Hardware and Cloud Reality: Local vs. Cloud Training
Before you touch a single line of Python, you need to answer a brutal financial question: do you buy a $1,600 graphics card, or do you rent one for an hour?
If you're running an older card with 12GB or 16GB of VRAM - like an RTX 3060 or 4070 - local training for Flux.1 Dev is practically impossible without running out-of-memory errors that crash your system kernel. Flux is a massive 12-billion parameter beast. Even with 8-bit quantization and gradient checkpointing, you need a minimum of 24GB VRAM just to breathe during a training pass.
Let's look at the actual math of renting versus owning.
Cloud GPU Provider Comparison
| Provider | GPU Model | VRAM | Hourly Rate | Setup Complexity | Best For |
|---|---|---|---|---|---|
| RunPod | RTX 4090 | 24GB | $0.74 - $0.89 | Medium (Templates) | Budget Flux LoRA training |
| Massed Compute | RTX 6000 Ada | 48GB | $1.95 - $2.40 | Low (Dedicated templates) | Heavy dataset batch sizes |
| Vast.ai | A6000 | 48GB | $1.10 - $1.60 | High (P2P bids/interruptions) | Advanced users chasing lowest cost |
| Google Colab Pro | A100 / V100 | 40GB | $10/mo + Compute Units | Low (Jupyter notebooks) | Quick tests and beginners |
If you're just getting started with our AI Tools Resource Center, firing up a RunPod RTX 4090 pod with a pre-configured PyTorch template is the fastest way to avoid dependency hell.
Step 1: Dataset Curation (The Part Everyone Screws Up)
Garbage in equals garbage out. No hyper-parameter tuning can save a training run built on 50 blurry smartphone selfies taken in the exact same dim lighting.
When you're building a dataset for a person, style, or object, follow these strict rules:
- Resolution Matters: For Flux, your source images should be at least 1024x1024 pixels. Don't upscale low-res images with cheap interpolators; you'll bake artifacts straight into the model weights.
- Diversity is Non-Negotiable: If you're training a face, include shots with different expressions, varied lighting (studio, outdoor, overcast), diverse clothing, and different angles.
- Keep the Count Lean: You don't need 500 images. For a solid face LoRA, 20 to 30 pristine images are the sweet spot. Anything over 50 risks severe overfitting unless you have thousands of training steps and varied captions.
Captioning Your Images
Flux relies heavily on natural language understanding. If you just dump images into a folder with generic filenames like image_01.jpg, your training results will suffer. You need descriptive captions.
Use an automated tagger like JoyCaption or WD14, or write them by hand in corresponding .txt files matching your image names:
Include a unique trigger word in every single caption - something rare like tkln_person or xyz_style so the model doesn't bleed your concept into generic prompts.
Step 2: Provisioning Your Cloud GPU (RunPod Walkthrough)
Let's spin up a clean environment on RunPod to run our training script.
- Create an Account: Head over to RunPod and deposit $10 into your billing balance.
- Deploy a Pod: Click Deploy and search for the standard RunPod PyTorch template (
pytorch/pytorch). - Select Your Hardware: Choose an RTX 4090 (24GB) or an A6000 (48GB if you have the budget).
- Configure Disk Space: Set your container disk to at least 100GB. Flux checkpoints are massive, and you'll need room for your dataset, virtual environments, and output weights.
- Launch and Connect: Hit Connect, then open the Jupyter Lab link or SSH directly into your pod via terminal.

Step 3: Setting Up the Training Environment
Once you're inside your pod's terminal, clone the industry-standard training repository. For Flux and modern SDXL/SD3 models, kohya_ss or ai-toolkit by Ostris are the most stable choices. We'll use ai-toolkit because its configuration files are clean YAML structures that don't require messing with massive CLI strings.
Run the following commands in your terminal:
Next, create your Python virtual environment and install the required dependencies:
This installation process takes about three to five minutes depending on the pod's network speed. While that runs, let's look at the financial impact of your training runs.
Training Cost Breakdown (Per Run)
| Phase / Item | RTX 4090 (24GB) Cost | A6000 (48GB) Cost | Time Invested |
|---|---|---|---|
| Environment Setup | $0.15 | $0.30 | 10 mins |
| Dataset Prep & Upload | $0.00 (Local) | $0.00 (Local) | 30 mins |
| Flux LoRA Training (1500 steps) | $0.90 | $1.80 | 45 mins |
| Testing & Evaluation | $0.30 | $0.45 | 15 mins |
| Total Estimated Cost | ~$1.35 | ~$2.55 | 1 hour 40 mins |
Compare that $1.35 cost to monthly subscriptions for managed generation apps that restrict your ownership rights. Training your own model gives you total portability. For related technical setups, check out our guide on Optimizing Remote Work Infrastructure for AI Developers.
Step 4: Configuring the YAML Training File
Inside your ai-toolkit directory, navigate to the config folder. You'll find sample configuration files. Create a new file named flux_lora_train.yaml and paste the following baseline configuration:
Key Parameters to Adjust:
rank: Set to16for standard character likenesses. If you're training a complex style, bump it to32. Higher ranks increase file size and training time.lr(Learning Rate): Keep this at0.0001. If you push it to0.0005, your model will overfit rapidly and burn out.steps: Aim for 1200 to 1800 steps depending on your dataset size (multiply your image count by 50 to 75).

Step 5: Executing the Training Run and Monitoring Loss
Upload your captioned image folder to /workspace/ai-toolkit/datasets/my_images using Jupyter Lab's upload tool or via an SFTP client.
Once your dataset is in place and your YAML config file is saved, start the training process with this command:
Watch the terminal output closely for the first 50 steps. You want to see the loss metric steadily decline. If the loss spikes erratically or drops to near zero instantly, your learning rate is too high or your dataset has duplicate/corrupt images.
When the training completes, your .safetensors weight files will be waiting in the output/my_custom_flux_lora directory. Download the final checkpoint or the checkpoint from step 1250 if you suspect step 1500 went slightly over.
Step 6: Testing and Integrating Your LoRA
Never trust your training run without running a rigorous evaluation suite. Move your new .safetensors file into your local or cloud ComfyUI or AUTOMATIC1111 weights directory:
Fire up ComfyUI and load a standard Flux workflow. Attach a Load LoRA node between your model loader and your samplers, setting the strength multiplier between 0.8 and 1.0.
Test your trigger word (tkln_person) across three distinct scenarios:
- The Direct Prompt: Test if the model renders the exact likeness or style cleanly without contamination.
- The Stress Test: Change the clothing, lighting, and background entirely. Does the model maintain identity consistency, or does it collapse back to the base Flux training data?
- The Bleed Test: Prompt for something completely unrelated while keeping the LoRA active. If your base style shifts, your training rank was too high or your dataset lacked negative examples.
For more deep dives into managing your digital workflows and avoiding hidden fees when paying for cloud infrastructure, explore our guides in the Fintech and Payments category.
Frequently Asked Questions
How much does it actually cost to train a Flux LoRA on a cloud GPU?
Training a standard Flux.1 Dev LoRA on a RunPod instance running an RTX 4090 or A6000 typically costs between $1.20 and $3.50 per session, depending on dataset size and epoch count. Setup and testing time account for the majority of minor cost fluctuations.
What is the minimum VRAM required to train a Flux LoRA locally?
You need at least 24GB of VRAM (such as an RTX 3090 or 4090) to train a Flux LoRA locally using 8-bit quantization scripts and gradient checkpointing, though 48GB (A6000) is safer for higher resolutions and larger batch sizes.
How many images do I need in my dataset to get good results?
For a face or specific character, 15 to 30 high-resolution images taken from varied angles, lighting conditions, and clothing variations yield the cleanest results without overfitting or memorizing the background elements.
What is the difference between training Flux.1 Dev and Flux.1 Schnell LoRAs?
Flux.1 Dev uses 12 steps of guidance distillation and requires a non-commercial research license, while Schnell is designed for 4-step generation. Dev produces significantly better semantic understanding and detail retention in custom LoRAs, making it the preferred choice for professional work.
Which cloud GPU provider offers the best price-to-performance ratio for training?
RunPod and Massed Compute offer the most reliable hourly rates for RTX 4090 ($0.74 to $0.89/hr) and A6000 ($1.80 to $2.40/hr) instances with pre-configured PyTorch templates that eliminate manual dependency installation headaches.
Why are my generated images burnt or over-saturated after training?
Over-saturation usually happens when your learning rate is set too high (above 0.0002) or you run too many training steps for a small dataset, causing the model to memorize rather than generalize. Lower your learning rate to 0.0001 and reduce your total step count on the next run.
Frequently Asked Questions
Training a standard Flux.1 Dev LoRA on a RunPod instance running an RTX 4090 or A6000 typically costs between $1.20 and $3.50 per session, depending on dataset size and epoch count.
You need at least 24GB of VRAM (such as an RTX 3090 or 4090) to train a Flux LoRA locally using 8-bit quantization scripts, though 48GB (A6000) is safer for higher resolutions.
For a face or specific character, 15 to 30 high-resolution images taken from varied angles, lighting conditions, and clothing variations yield the cleanest results without overfitting.
Flux.1 Dev uses 12 steps of guidance distillation and requires a non-commercial license, while Schnell is designed for 4-step generation. Dev produces significantly better semantic understanding and detail retention in custom LoRAs.
RunPod and Massed Compute offer the most reliable hourly rates for RTX 4090 ($0.74 to $0.89/hr) and A6000 ($1.80 to $2.40/hr) instances with pre-configured PyTorch templates.
Over-saturation usually happens when your learning rate is set too high (above 0.0002) or you run too many training steps for a small dataset, causing the model to memorize rather than generalize.

Alex Morgan is the founder and lead editor of RemoGrid. With over six years of hands-on experience in remote operations, cross-border freelance workflows, and AI tool benchmarking, Alex independently tests and audits software platforms to help modern digital workers build sustainable online income streams. He regularly reviews international payment systems (Wise, Stripe, Payoneer, local mobile wallets) and conducts real-world usability benchmarks across AI productivity tools.


