Modal

Run FLUX.1-dev three times faster

Jun 18, 2025
Run FLUX.1-dev three times faster
SummaryAI, from the source post

This post details optimizations applied to the FLUX.1-dev diffusion model for faster image generation. It introduces standard optimizations including Torch compiler integration (`torch.compile` with `max-autotune`), fused QKV projections, and channels-last memory layout, resulting in a 1.5x speedup. Additionally, it implements an approximate caching technique, First Block Caching (adapted from ParaAttention and TeaCache), to achieve a further 2x speedup by skipping steps where image changes are minimal. The post also discusses reducing compile-time for TorchInductor by using a fixed set of configurations and optimizing the `torch.compile` process for faster cold starts.

More from the Inference Performance Optimization trail