---
title: "Using LoRA for Efficient Stable Diffusion Fine-Tuning"
description: "LoRA freezes pretrained weights and trains small rank-decomposition matrices, and diffusers now supports applying it to Stable Diffusion's cross-attention layers for both full fine-tuning and Dreambooth."
url: "https://swe.quest/articles/using-lora-for-efficient-stable-diffusion-fine-tuning-7bd5416d145ae531"
canonical: "https://huggingface.co/blog/lora"
source: "Hugging Face"
published: "2023-01-26"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["model-training","computer-vision","python"]
---

# Using LoRA for Efficient Stable Diffusion Fine-Tuning

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-01-26, 7 min read, How-to. Original: [https://huggingface.co/blog/lora](https://huggingface.co/blog/lora)

## Summary

LoRA freezes pretrained weights and trains small rank-decomposition matrices, and diffusers now supports applying it to Stable Diffusion's cross-attention layers for both full fine-tuning and Dreambooth. Training fits in 11 GB of VRAM (a 2080 Ti) without 8-bit optimizers, uses a much higher learning rate (1e-4 vs ~1e-6), and produces ~3 MB weight files, roughly 1000x smaller than the UNet. A walkthrough covers the training script on a Pokémon dataset, looking up the base model from Hub metadata, and loading LoRA weights at inference with load\_attn\_procs. LoRA is also compared with Textual Inversion and Pivotal Tuning.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Stable Diffusion basics
- PyTorch
- fine-tuning neural networks ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))

## Keywords

LoRA, Stable Diffusion, Diffusers, Dreambooth, Textual Inversion, Hugging Face Hub, Pivotal Tuning

## Related posts

- [(LoRA) Fine-Tuning FLUX.1-dev on Consumer Hardware](https://swe.quest/articles/lora-fine-tuning-flux-1-dev-on-consumer-hardware-310a6094e7391e33.md): Hugging Face · 2025-06-19 · Hard · 11 min read · Model training, Computer vision, Python
  FLUX.1-dev can be LoRA fine-tuned on a single consumer GPU by combining QLoRA (4-bit NF4 base transformer via bitsandbytes), 8-bit AdamW, gradient checkpointing, cached VAE latents and precomputed CLIP/T5 text embeddings, so that only the quantized transformer plus adapters sit in GPU memory.
- [Training Stable Diffusion with Dreambooth using Diffusers](https://swe.quest/articles/training-stable-diffusion-with-dreambooth-using-diffusers-498f7d039b45823b.md): Hugging Face · 2022-11-07 · Medium · 8 min read · Model training, Computer vision
  Dreambooth fine-tuning of Stable Diffusion overfits quickly, so learning rate and step count must be tuned together.
- [LoRA training scripts of the world, unite!](https://swe.quest/articles/lora-training-scripts-of-the-world-unite-73f0d15365f25313.md): Hugging Face · 2024-01-02 · Hard · 18 min read · Model training, Computer vision, Machine learning
  Combining Pivotal Tuning (textual inversion of newly inserted tokens, then LoRA fine-tuning) with the adaptive Prodigy optimizer produces strong SDXL Dreambooth LoRA results, and both are now available in a diffusers training script.
- [Goodbye cold boot - how we made LoRA Inference 300% faster](https://swe.quest/articles/goodbye-cold-boot-how-we-made-lora-inference-300-faster-d8d4cf4c16c22df2.md): Hugging Face · 2023-12-05 · Medium · 9 min read · Inference & serving, ML platforms, Computer vision, Python
  Hugging Face's Inference API now keeps Stable Diffusion base models warm and swaps LoRA adapters per request, so hundreds of distinct LoRAs share a few GPUs instead of each getting a dedicated deployment.
- [Diffusers welcomes Stable Diffusion 3.5 Large](https://swe.quest/articles/diffusers-welcomes-stable-diffusion-3-5-large-23c0b39797ac94ee.md): Hugging Face · 2024-10-22 · Medium · 6 min read · Computer vision, Inference & serving, Model training, Python
  Stable Diffusion 3.5 Large (8B) and a timestep-distilled Turbo variant are now usable in Diffusers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
