Abstract
Vector quantization is a technique in machine learning that discretizes continuous representations into a set of discrete vectors. It is widely employed in tokenizing data representations for large language models, diffusion models, and other generative models. Despite its prevalence, the characteristics and behaviors of vector quantization in generative models remain largely underexplored. In this study, we systematically investigate the issue of collapses in vector quantization, where collapsed representations are observed across discrete codebook tokens and continuous latent embeddings. By leveraging both synthetic and real datasets, we identify the severity of each type of collapses and triggering conditions. Our analysis reveals that random initialization and limited encoder capacity result in tokens collapse and embeddings collapse. Building on these findings, we propose potential solutions aimed at mitigating each collapse. To the best of our knowledge, this is the first comprehensive study examining representation collapsing problems in vector quantization.
Introduction: The Hidden Diversity Killer
In the field of generative AI, tokenization is the critical process of converting continuous data, such as image pixels, into discrete units or tokens. This is typically achieved through Vector Quantization (VQ). While state-of-the-art models like DALL-E or Visual Autoregressive (VAR) models are highly capable, they frequently suffer from mode collapse. In these scenarios, the model generates repetitive, "safe" images, failing to capture the full diversity of the training data.
While previous research often attributed this to "codebook collapse"—where many tokens in the dictionary remain unused—this study identifies a more insidious failure mode: token representation shrinkage. Even when all tokens are utilized, they may cluster into a narrow region of the latent space. This lack of geometric diversity in the token space directly translates to a lack of diversity in the generated output.
Methods: Deferred Quantization
To address this, the researchers propose Deferred Quantization. The core idea is to avoid the "initialization trap" where a codebook is anchored to the noisy, homogenized output of an untrained encoder. The training is split into two distinct phases:
- The Geometric Phase (Continuous Training): The model is initially trained as a continuous autoencoder. Without the constraints of a discrete grid, the encoder is free to learn a well-distributed, spread-out map of the data manifold.
- The Discretization Phase (VQ Activation): Once the encoder has developed a mature representation, the codebook is initialized using these semantically rich embeddings. Only at this point is the quantization bottleneck introduced.
This two-stage approach ensures that the discrete tokens are anchored to a diverse landscape, preserving the geometric variety learned during the continuous phase.
Key Insights: Geometry Matters
A crucial finding of this work is that a tokenizer can achieve very low reconstruction error while still being poor for generation. This occurs because the model may focus exclusively on high-density "average" regions of the data, ignoring the "long tail" of diversity.
The paper demonstrates that "dead tokens" and "shrinkage" are distinct issues. Even if all tokens are active, they can still be "shrunk" into a small volume. Deferred Quantization specifically targets the geometry of these tokens to ensure they span the full data distribution.
Experimental Results
The effectiveness of Deferred Quantization was validated across synthetic data, natural images (CIFAR-10, ImageNet-100), and specialized medical images (ODIR).
- Scaling and Efficiency: On CIFAR-10, standard VQ models often see performance degradation as codebook size increases due to exacerbated shrinkage. Deferred Quantization enables models to effectively scale with larger codebooks.
- Improved Generation: On ImageNet-100, integrating Deferred Quantization with the VAR model improved the Frechet Inception Distance (FID)—a key metric for image quality and diversity—from 12.88 down to 10.44.
- Qualitative Diversity: Visual analysis confirms that models trained with this method produce images with significantly more varied colors, textures, and compositions compared to the homogenized outputs of standard training.
Conclusion
Deferred Quantization offers a simple yet powerful lever for preserving diversity in generative models. By controlling the early-stage dynamics of quantization, researchers can prevent the "shrinkage" that often plagues standard VQ-VAEs. While future work may further refine the transition between continuous and discrete phases for smaller models, this study provides a foundational understanding of representation collapse in vector quantization.
Summary updated