---
title: "Run FLUX.1-dev three times faster"
description: "FLUX.1-dev image generation on Modal drops from ~6.75s to under three seconds per 1024x1024 image."
url: "https://swe.quest/articles/run-flux-1-dev-three-times-faster-ae60b80e0a362206"
canonical: "https://modal.com/blog/flux-3x-faster"
source: "Modal"
published: "2025-06-18"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["inference","performance","python","computer-vision","serverless"]
---

# Run FLUX.1-dev three times faster

A post on [Modal](https://swe.quest/sources/modal.md), published 2025-06-18, 9 min read, How-to. Original: [https://modal.com/blog/flux-3x-faster](https://modal.com/blog/flux-3x-faster)

## Summary

FLUX.1-dev image generation on Modal drops from ~6.75s to under three seconds per 1024x1024 image. About 1.5x comes from standard optimizations: torch.compile with max-autotune, fused QKV projections and channels-last memory layout. Another 2x comes from First Block Caching (via ParaAttention, based on TEACache), which skips denoising steps whose early-block residual change falls below a threshold. A threshold of 0.12 gave a good quality/speed tradeoff. The tens of minutes of compile time added to cold starts were cut roughly 30x by persisting Inductor, Triton and CUDA caches on a volume and using Modal memory snapshots.

Written by swe.quest, not by the author.

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

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Python](https://swe.quest/tags/python.md) (Languages)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)

## Prerequisites

- PyTorch basics
- diffusion models
- Transformer attention

## Keywords

FLUX.1-dev, torch.compile, TorchInductor, diffusers, First Block Caching, ParaAttention, Modal, Triton

## Related posts

- [Exploring simple optimizations for SDXL](https://swe.quest/articles/exploring-simple-optimizations-for-sdxl-b199204d28422c69.md): Hugging Face · 2023-10-24 · Medium · 8 min read · Inference & serving, Performance engineering, Computer vision, Python
  Running SDXL out of the box in fp32 on an A100 takes about 28GB and 72 seconds for 4 images.
- [Diffusers welcomes FLUX-2](https://swe.quest/articles/diffusers-welcomes-flux-2-7cb4762bf1303faf.md): Hugging Face · 2025-11-25 · Hard · 21 min read · Inference & serving, Computer vision, Model training, Python
  FLUX.2 from Black Forest Labs is a new image generation and editing model, not a drop-in replacement for Flux.1.
- [Fast LoRA inference for Flux with Diffusers and PEFT](https://swe.quest/articles/fast-lora-inference-for-flux-with-diffusers-and-peft-adf61d95e12cb0a4.md): Hugging Face · 2025-07-23 · Hard · 9 min read · Inference & serving, Performance engineering, Computer vision, Python
  Combining 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.
- [Welcome FLUX.3 Image Klein in Diffusers](https://swe.quest/articles/welcome-flux-3-image-klein-in-diffusers-478c83816e6db758.md): Hugging Face · 2026-10-15 · Medium · 16 min read · Computer vision, Inference & serving, Model training, Python
  FLUX.3 Image Klein from Black Forest Labs is supported in Diffusers from launch.
- [Diffusers welcomes Stable Diffusion 3](https://swe.quest/articles/diffusers-welcomes-stable-diffusion-3-f6ced777e2fcbd47.md): Hugging Face · 2024-06-12 · Medium · 7 min read · Computer vision, Inference & serving, Model training, Python
  Stable Diffusion 3 Medium (2B parameters) is now usable through 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)
