Vector Quantized Diffusion Model for Text-to-Image Synthesis

Shuyang Gu, Dong Chen 0003, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen 0001, Lu Yuan, Baining Guo

Abstract

VQ-Diffusion is a novel text-to-image framework that combines the efficiency of vector quantization with the stability of discrete diffusion. By replacing the standard "one-token-at-a-time" autoregressive approach with a global, bidirectional "mask-and-replace" strategy, it achieves state-of-the-art image quality while running up to 15 times faster than traditional models like DALL-E.

Introduction

Most modern text-to-image models, such as the original DALL-E or CogView, rely on autoregressive (AR) frameworks. These models treat image generation as a sequential task, predicting visual tokens one by one. This approach suffers from two primary drawbacks: unidirectional bias, where pixels cannot account for future context, and error accumulation, where a single mistake propagates through the entire generation process. While Generative Adversarial Networks (GANs) offer faster inference, they often struggle with complex scenes. VQ-Diffusion bridges this gap by offering high-quality complexity with the speed and global context missing from AR methods.

Methods

The VQ-Diffusion pipeline consists of two main stages. First, a Vector Quantized Variational Autoencoder (VQ-VAE) compresses high-resolution images into a grid of discrete visual tokens from a learned codebook. Second, a discrete diffusion process is applied to these tokens.

Overview of the VQ-Diffusion pipeline, showing the VQ-VAE stage and the discrete diffusion process.

The core innovation is a "mask-and-replace" strategy. During training, tokens are corrupted by being replaced with a special [MASK] token or a random token. A Transformer-based model then uses bidirectional attention to predict the original tokens from the noisy grid. This allows the model to consider the entire image context simultaneously. Additionally, a reparameterization trick enables the model to predict the final noiseless image at every step, allowing for significant inference speedups by skipping steps.

Key Results

VQ-Diffusion was evaluated on several benchmarks, including MSCOCO, CUB-200, and large-scale datasets like LAION-400M. On MSCOCO, it achieved a Fréchet Inception Distance (FID) of 13.86, significantly outperforming DALL-E (27.50) and CogView (27.10).

Qualitative comparison of VQ-Diffusion against DM-GAN and DF-GAN across various text prompts.

Beyond quantitative metrics, the model demonstrates superior qualitative performance, accurately rendering complex scenes and multiple objects that GAN-based models often fail to capture. Furthermore, the VQ-Diffusion-B model is approximately 15 times faster than its autoregressive counterparts while maintaining higher image quality. It also naturally supports image inpainting by masking irregular regions and providing text prompts.

Discussion and Limitations

The model's performance is sensitive to hyperparameters, particularly the mask rate. A high mask rate can lead to error accumulation, while a low rate may hinder the capture of global structure. Truncation sampling is also employed to filter out low-probability noise during generation. Future work involves scaling the model and datasets further to achieve even greater photorealism and diversity.

Conclusion

VQ-Diffusion represents a significant step forward in text-to-image synthesis, providing a faster and more stable alternative to autoregressive models through the use of discrete diffusion and global context.

Summary updated

BibTeX
@inproceedings{gu2021vector,
  author = {Shuyang Gu and Dong Chen and Jianmin Bao and Fang Wen and Bo Zhang and Dongdong Chen and Lu Yuan and Baining Guo},
  title = {{Vector Quantized Diffusion Model for Text-to-Image Synthesis}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr52688.2022.01043},
}
Figure