Scalable Image Tokenization with Index Backpropagation Quantization

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

Abstract

Existing vector quantization (VQ) methods struggle with scalability, largely attributed to the instability of the codebook that undergoes partial updates during training. The codebook is prone to collapse as utilization decreases, due to the progressively widening distribution gap between non-activated codes and visual features. We propose Index Backpropagation Quantization (IBQ), a new VQ method for the joint optimization of all codebook embeddings and the visual encoder. By applying a straight-through estimator on the one-hot categorical distribution between the encoded feature and codebook, all codes are differentiable and maintain a consistent latent space with the visual encoder. IBQ enables scalable training of visual tokenizers and achieves a large-scale codebook ($2^{18}$) with high dimension ($256$) and high utilization. Code and models are available at: https://github.com/TencentARC/SEED-Voken.

Introduction: The Challenge of Codebook Collapse

In generative AI, visual tokenization converts continuous images into discrete "words" or tokens. Most visual tokenizers use Vector Quantization (VQ), mapping image patches to the nearest entry in a codebook. However, traditional methods like VQGAN struggle to scale. Increasing codebook size often leads to codebook collapse, where only a small fraction of codes are utilized while the rest become "dead" and drift away from the data distribution. This creates a widening gap between visual features and available codes, resulting in blurry reconstructions and poor generation quality.

Methodology: Index Backpropagation Quantization (IBQ)

IBQ addresses the scaling bottleneck by making the entire codebook differentiable. Unlike standard VQ, where only the "winning" code receives a gradient update, IBQ treats selection as a categorical distribution:

  1. Soft Distribution: It calculates similarity between an encoded feature and every codebook entry to create a "soft" probability distribution.
  2. Straight-Through Estimator (STE): During the forward pass, the model selects the single best "hard" index. In the backward pass, the STE propagates gradients through the entire soft distribution to all codebook embeddings simultaneously.
  3. Joint Optimization: This ensures every code is constantly pulled toward the data distribution, preventing "dead" codes and maintaining a consistent latent space.
Figure 4: Comparison of feature distribution and codebook usage. IBQ (right) maintains a consistent latent space and near-100% codebook utilization compared to the significant distribution gap and low usage in VQGAN (left).

Experimental Results and Key Insights

The models were evaluated on ImageNet-1K and MS-COCO 2017, with large-scale pretraining on datasets including CapFusion and LAION-COCO.

Breaking the Scaling Ceiling

IBQ successfully trains codebooks with $2^{18}$ (262,144) entries and a high embedding dimension (256) while maintaining over 84% utilization. Previous methods typically saw utilization drop to near 0% at this scale.

State-of-the-Art Reconstruction and Generation

  • Reconstruction: IBQ achieves a reconstruction FID (rFID) of 1.00 on ImageNet, significantly outperforming previous SOTA models like Open-MAGVIT2 (1.17) and VQGAN (3.98).
  • Generation: When paired with a vanilla Transformer, IBQ achieves a generation FID (gFID) of 2.05, outperforming established models like LlamaGen and DiT-XL/2.
Figure 1: High-fidelity image reconstructions achieved by the IBQ tokenizer across diverse visual categories.

Discussion and Future Work

While IBQ advances visual tokenization, the memory overhead of calculating similarities against $2^{18}$ codes is non-trivial. Additionally, while general reconstruction is excellent, fine-grained details like human faces may benefit from specialized fine-tuning. Future work will explore pairing IBQ with advanced second-stage architectures like Mamba-based models to further improve generative performance.

Summary updated

BibTeX
@misc{shi2024scalable,
  author = {Fengyuan Shi and Zhuoyan Luo and Yixiao Ge and Yujiu Yang and Ying Shan and Limin Wang},
  title = {{Scalable Image Tokenization with Index Backpropagation Quantization}},
  year = {2024},
  eprint = {2412.02692},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.02692},
}
Figure