---
title: "VQ-Diffusion"
description: "VQ-Diffusion is a conditional latent diffusion model whose noising and denoising run over a discrete VQ-VAE codebook rather than Gaussian noise."
url: "https://swe.quest/articles/vq-diffusion-60af6753b8809ca3"
canonical: "https://huggingface.co/blog/vq-diffusion"
source: "Hugging Face"
published: "2022-11-30"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 7
tags: ["computer-vision","machine-learning","python"]
---

# VQ-Diffusion

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-11-30, 7 min read, Deep dive. Original: [https://huggingface.co/blog/vq-diffusion](https://huggingface.co/blog/vq-diffusion)

## Summary

VQ-Diffusion is a conditional latent diffusion model whose noising and denoising run over a discrete VQ-VAE codebook rather than Gaussian noise. Each token can stay, be uniformly resampled, or become permanently masked, and a CLIP-conditioned encoder-decoder transformer predicts the full distribution of un-noised latents in one pass. Compared with autoregressive image transformers, it avoids raster-order directional bias and error accumulation, and its inference cost scales with diffusion steps rather than latent pixels, roughly a 10x big-O gain on 32x32 ITHQ latents and up to 15x faster in practice. The model can be run in a few lines with the Diffusers VQDiffusionPipeline.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- diffusion models (DDPM)
- transformers and attention
- VQ-VAE
- autoregressive generative models

## Keywords

VQ-Diffusion, Diffusers, VQ-VAE, VQGAN, Taming Transformers, CLIP, ImageBART, DALL-E

## Related posts

- [Welcome aMUSEd: Efficient Text-to-Image Generation](https://swe.quest/articles/welcome-amused-efficient-text-to-image-generation-12956b5ceb4a1912.md): Hugging Face · 2024-01-04 · Medium · 6 min read · Computer vision, Model training, Inference & serving, Open source
  aMUSEd is an open, permissively licensed reproduction of Google's MUSE that generates images with masked image modeling instead of latent diffusion.
- [Introducing Würstchen: Fast Diffusion for Image Generation](https://swe.quest/articles/introducing-wurstchen-fast-diffusion-for-image-generation-7dba36d9df7944a1.md): Hugging Face · 2023-09-13 · Medium · 6 min read · Computer vision, Inference & serving, Python
  Würstchen is a text-to-image diffusion model whose text-conditional Prior (Stage C) runs in a latent space with 42x spatial compression, far beyond the usual 4-8x.
- [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.
- [Stable Diffusion with 🧨 Diffusers](https://swe.quest/articles/stable-diffusion-with-diffusers-03ca8448e680e397.md): Hugging Face · 2022-08-22 · Medium · 15 min read · Computer vision, Inference & serving, Machine learning, Python
  Stable Diffusion is a latent diffusion model that denoises compressed 64×64 latents rather than pixels, combining a VAE, a text-conditioned U-Net with cross-attention, and a frozen CLIP text encoder.
- [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.

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)
