---
title: "Exploring Quantization Backends in Diffusers"
description: "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."
url: "https://swe.quest/articles/exploring-quantization-backends-in-diffusers-11e0d1ba0cf15851"
canonical: "https://huggingface.co/blog/diffusers-quantization"
source: "Hugging Face"
published: "2025-05-21"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["inference","computer-vision","python","performance"]
---

# Exploring Quantization Backends in Diffusers

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2025-05-21, 11 min read, How-to. Original: [https://huggingface.co/blog/diffusers-quantization](https://huggingface.co/blog/diffusers-quantization)

## Summary

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. Benchmarks on an H100 put BnB 4-bit NF4 at about 12.6 GB after loading with no inference slowdown, while torchao and Quanto INT4 cut memory further but take roughly 109 seconds per image versus 12 seconds for BF16. Code examples apply PipelineQuantizationConfig to the transformer and T5 encoder, load pre-quantized GGUF files, and combine quantization with CPU offloading, group offloading and torch.compile. The 8-bit quality differences are usually hard to see, and NF4 is suggested as the best tradeoff.

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

## Prerequisites

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

## Keywords

Diffusers, Flux, bitsandbytes, torchao, Quanto, GGUF, FP8, torch.compile

## Related posts

- [Memory-efficient Diffusion Transformers with Quanto and Diffusers](https://swe.quest/articles/memory-efficient-diffusion-transformers-with-quanto-and-diffusers-3c257e9814771482.md): Hugging Face · 2024-07-30 · Medium · 9 min read · Inference & serving, Computer vision, Performance engineering, Python
  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.
- [Bringing Nunchaku 4-bit Diffusion Inference to Diffusers](https://swe.quest/articles/bringing-nunchaku-4-bit-diffusion-inference-to-diffusers-c0f307e158fa29ca.md): Hugging Face · 2026-07-23 · Hard · 11 min read · Inference & serving, Performance engineering, Python, Hardware
  Diffusers can now load SVDQuant/Nunchaku 4-bit (W4A4) diffusion checkpoints natively via from\_pretrained(), with CUDA kernels fetched from the Hub through the kernels package instead of compiled locally.
- [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.
- [Making LLMs even more accessible with bitsandbytes, 4-bit quantization and QLoRA](https://swe.quest/articles/making-llms-even-more-accessible-with-bitsandbytes-4-bit-quantization-and-qlora-7bc797d3e83b0ec6.md): Hugging Face · 2023-05-24 · Medium · 14 min read · Inference & serving, Model training, LLMs, Python
  bitsandbytes now integrates 4-bit quantization into Hugging Face transformers, letting most accelerate-loadable models (text, vision, multimodal) run in 4-bit and be fine-tuned via QLoRA, which backpropagates through a frozen 4-bit base model into LoRA adapters.
- [State of open video generation models in Diffusers](https://swe.quest/articles/state-of-open-video-generation-models-in-diffusers-9770186e8fdb5a0a.md): Hugging Face · 2025-01-27 · Medium · 16 min read · Inference & serving, Computer vision, Video & media, Performance engineering, Model training
  Open video generation models such as HunyuanVideo, CogVideoX, LTX-Video, Mochi-1 and Allegro share a common architecture: T5-style text encoders, a DiT-based denoiser over 3D spatio-temporal tokens, a spatially and temporally compressing VAE, and a scheduler.

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)
