---
title: "Memory-efficient Diffusion Transformers with Quanto and Diffusers"
description: "Weight quantization with Quanto cuts the GPU memory of Transformer-based diffusion pipelines (PixArt-Sigma, Stable Diffusion 3, Aura Flow) with little quality loss and a modest latency cost."
url: "https://swe.quest/articles/memory-efficient-diffusion-transformers-with-quanto-and-diffusers-3c257e9814771482"
canonical: "https://huggingface.co/blog/quanto-diffusers"
source: "Hugging Face"
published: "2024-07-30"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["inference","computer-vision","performance","python"]
---

# Memory-efficient Diffusion Transformers with Quanto and Diffusers

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-07-30, 9 min read, How-to. Original: [https://huggingface.co/blog/quanto-diffusers](https://huggingface.co/blog/quanto-diffusers)

## Summary

Weight quantization with Quanto cuts the GPU memory of Transformer-based diffusion pipelines (PixArt-Sigma, Stable Diffusion 3, Aura Flow) with little quality loss and a modest latency cost. Quantizing the text encoders as well as the diffusion transformer matters most: PixArt drops from about 12 GB to 5.4 GB with FP8. For SD3, the second text encoder should be left unquantized. Benchmarks on an H100 show that bfloat16 and qint8 with fused QKV projections reduce latency. INT4 saves the most memory but is slower and needs the final proj\_out layer excluded to preserve quality. Code covers quantizing, saving and loading quantized Diffusers models.

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)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- PyTorch basics
- diffusion model pipelines
- model quantization concepts ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))

## Keywords

Quanto, Diffusers, Stable Diffusion 3, PixArt-Sigma, Aura Flow, FP8, INT8, Hugging Face Optimum

## Related posts

- [Exploring Quantization Backends in Diffusers](https://swe.quest/articles/exploring-quantization-backends-in-diffusers-11e0d1ba0cf15851.md): Hugging Face · 2025-05-21 · Medium · 11 min read · Inference & serving, Computer vision, Python, Performance engineering
  Hugging Face Diffusers supports several quantization backends (bitsandbytes, torchao, Quanto, GGUF and native FP8 layerwise casting) that shrink large diffusion models such as Flux-dev, whose full BF16 pipeline needs about 31 GB.
- [Making LLMs lighter with AutoGPTQ and transformers](https://swe.quest/articles/making-llms-lighter-with-autogptq-and-transformers-6a1ce27ee3288303.md): Hugging Face · 2023-08-23 · Medium · 10 min read · Inference & serving, LLMs, Performance engineering, Hardware
  AutoGPTQ is now integrated into Hugging Face Transformers (via Optimum), letting users quantize and run LLMs at 8, 4, 3 or 2 bits with the GPTQ post-training method.
- [Optimizing Stable Diffusion for Intel CPUs with NNCF and 🤗 Optimum](https://swe.quest/articles/optimizing-stable-diffusion-for-intel-cpus-with-nncf-and-optimum-4e8b23fd42b05887.md): Hugging Face · 2023-05-25 · Hard · 7 min read · Inference & serving, Computer vision, Model training, Performance engineering
  Post-training 8-bit quantization breaks Stable Diffusion's UNet, so this workflow uses NNCF quantization-aware training with knowledge distillation from the original model as teacher and EMA on non-quantizer weights.
- [Quanto: a PyTorch quantization backend for Optimum](https://swe.quest/articles/quanto-a-pytorch-quantization-backend-for-optimum-8330ba5aea428b63.md): Hugging Face · 2024-03-18 · Medium · 5 min read · Inference & serving, Python, Machine learning, Open source
  Quanto is a PyTorch quantization backend for Optimum that works in eager mode on any device (CPU, CUDA, MPS), supports int2/int4/int8/float8 weights and int8/float8 activations, and accelerates int8-int8, fp16-int4, bf16-int8 and bf16-int4 matmuls on CUDA.
- [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.

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)
