Taming Scalable Visual Tokenizer for Autoregressive Image Generation

Fengyuan Shi, Zhuoyan Luo, Yixiao Ge, Yujiu Yang, Ying Shan, Limin Wang · DOI

Abstract

Modern autoregressive image generation relies on converting continuous visual data into discrete tokens via Vector Quantization (VQ). However, scaling these models often leads to "codebook collapse," where only a fraction of the available vocabulary is utilized. We present Index Backpropagation Quantization (IBQ), a method that makes the entire codebook differentiable during training. IBQ enables the use of massive codebooks (up to 262,144 entries) with high utilization (~96%), achieving a state-of-the-art reconstruction FID (rFID) of 1.00 on ImageNet and significantly improving the quality of autoregressive image generation.

Introduction: The Challenge of Codebook Collapse

To leverage the power of Large Language Model (LLM) architectures for vision, images must be mapped into a discrete "vocabulary" of codes, known as a codebook. Standard Vector Quantization methods, such as VQGAN, suffer from a significant scaling bottleneck: codebook collapse. In these models, only the codes closest to the input features are updated during training. Over time, unselected codes drift away from the data distribution, becoming "dead" entries. This results in extremely low codebook utilization—often less than 1%—which wastes representational capacity and leads to blurry or distorted reconstructions.

Figure 3: (a) Distribution between codebook and encoded features showing how IBQ aligns the two distributions compared to VQGAN. (b) Codebook usage curve demonstrating that IBQ maintains near 100% utilization throughout training.

Methods: Index Backpropagation Quantization (IBQ)

The core innovation of IBQ is the transition from partial, local updates to global, differentiable updates. Instead of a hard selection that ignores most of the codebook, IBQ employs a "soft" categorical distribution across the entire codebook using a softmax operation.

  1. Differentiable Indices: By treating the index selection as a soft distribution, gradients can flow to all codebook embeddings simultaneously during the backward pass.
  2. Straight-Through Estimator (STE): To maintain the benefits of discrete quantization, the forward pass uses the "hard" (discrete) index, while the backward pass utilizes the "soft" distribution to update the entire vocabulary.
  3. Double Quantization Loss: A specialized loss function is introduced to aggressively minimize the distance between selected codebook embeddings and encoded visual features, ensuring a tighter fit and preventing distribution gaps.

Experimental Results

The IBQ tokenizer was evaluated on standard benchmarks including ImageNet-1k, MS-COCO, and specialized datasets like FFHQ.

State-of-the-Art Reconstruction

IBQ sets a new benchmark for image reconstruction. With a codebook size of $2^{18}$ (262,144 entries), it achieved an rFID of 1.00 on ImageNet, outperforming previous state-of-the-art models like Open-MAGVIT2 (1.17 rFID). This performance narrows the historical gap between discrete VQ models and continuous Variational Autoencoders (VAEs).

Figure 1: Qualitative examples of high-fidelity image reconstruction across various categories using the IBQ tokenizer.

Scaling Laws and Generation

The research establishes that visual tokenizers follow clear scaling laws: increasing codebook size, embedding dimensions, and model depth consistently improves quality, provided the tokenizer avoids collapse. When integrated into an autoregressive transformer (e.g., LlamaGen), IBQ-based models produced superior images, with a 2.1B parameter model achieving a generation FID of 2.05.

Conclusion and Future Work

IBQ effectively "tames" the visual tokenizer, allowing it to scale to massive vocabularies without the penalty of codebook collapse. While the method is highly efficient—adding only marginal memory and time overhead—future work will explore its application in more complex architectures like Masked Autoregressive (MAR) models and further refine its performance on high-detail tasks such as facial reconstruction.

Summary updated

BibTeX
@misc{shi2024taming,
  author = {Fengyuan Shi and Zhuoyan Luo and Yixiao Ge and Yujiu Yang and Ying Shan and Limin Wang},
  title = {{Taming Scalable Visual Tokenizer for Autoregressive Image Generation}},
  year = {2024},
  eprint = {2412.02692},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.02692},
}
Figure