Goodbye cold boot - how we made LoRA Inference 300% faster
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. Requests carrying a base_model attribute and a lora tag are routed to a shared backend that uses Diffusers' load_lora_weights/fuse_lora and unfuse_lora/unload_lora_weights to swap adapters in 2-4 seconds. Warm-up dropped from 25s to 3s and cold request latency from 35s to 13s, with hundreds of LoRAs served on fewer than 5 A10G GPUs. Fusing weights cuts inference time by 30%, and batched LoRA inference was skipped because diffusion throughput rose only 25% at batch size 8 while latency grew sixfold.
Related posts
- Using LoRA for Efficient Stable Diffusion Fine-Tuning
Hugging Face mediumAdeptLoRA 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.
- Fast LoRA inference for Flux with Diffusers and PEFT
Hugging Face hardMasterCombining Flash Attention 3, torch.compile and TorchAO FP8 quantization with PEFT's LoRA hotswapping speeds up Flux.1-Dev LoRA inference by 2.23x on an H100, and swapping adapters does not trigger recompilation. Hotswapping avoids recompiles by turning LoRA scaling factors into tensors and zero-padding adapter weights to a declared max rank. The limits are that later LoRAs must target the same layers as the first one, or a subset of them, and text encoder LoRAs are not supported. On a 24GB RTX 4090, FA3 is unavailable, so the recipe adds NF4 quantization of the T5 text encoder to fit FP8 without CPU offloading, which gives a 2.04x speedup.
- SDXL in 4 steps with Latent Consistency LoRAs
Hugging Face mediumAdeptLCM LoRAs apply latent consistency distillation as small LoRA adapters instead of distilling each full model, so any fine-tuned SDXL or Stable Diffusion 1.5 model can generate images in 4–8 steps instead of 25–50. Using diffusers, you load the LCM LoRA, swap in the LCMScheduler and run with guidance_scale around 1. Values between 1 and 2 enable negative prompts, and larger values don't work. Benchmarks at batch size 1 show SDXL dropping from 7s to 1.4s on a 3090, 64s to 6.5s on an M1 Max and 3.4s to 0.7s on a 4090. The LoRAs can also be stacked with regular style LoRAs, and training scripts are released alongside them.
- TGI Multi-LoRA: Deploy Once, Serve 30 Models
Hugging Face mediumAdeptText Generation Inference (TGI) v2.1.1 adds multi-LoRA serving: one base model such as Mistral-7B is deployed once, and many small LoRA adapters are loaded alongside it, with each request picking its adapter via an adapter_id. Adapters are tiny (13.6MB versus 14.48GB for the base), so loading 30 of them adds only about 3% VRAM. The post shows deployment via Docker with the LORA_ADAPTERS setting, Inference Endpoints through the GUI and in Python, and how to query a specific adapter. It argues that per-token cost stays flat as models are added and that consolidating bursty per-model traffic onto one deployment smooths GPU utilization.
- Remote VAEs for decoding with Inference Endpoints 🤗
Hugging Face mediumAdeptHugging Face's Diffusers team is piloting remote VAE decoding: a diffusion pipeline produces latents locally and sends them to a hosted Inference Endpoint for decoding, avoiding the VRAM spike that otherwise forces offloading (adding transfer latency) or tiling (which can hurt image quality and, for SD v1.5 at 1024x1024, raises decode time by roughly 60-100%). A `remote_decode` helper in diffusers supports SD v1, SDXL, Flux (packed latents need height/width) and HunyuanVideo (mp4 output), and a background thread with a queue lets generation overlap with decoding. Benchmark tables show local VAE decode memory reaching 93-96% of VRAM on RTX 3080/3070 for SDXL at 1024x1024.