Abstract
Training discrete autoencoders (VQ-VAEs) is notoriously difficult because discretization is non-differentiable. This paper introduces Gaussian Quant (GQ), a method that bypasses these challenges by training a standard continuous Gaussian VAE first and then converting it into a high-performing discrete model with zero additional training. By employing a Target Divergence Constraint (TDC), GQ ensures the continuous model is optimized for subsequent discretization. Experimental results on ImageNet and COCO demonstrate that GQ consistently outperforms established discrete tokenizers in both reconstruction quality and generative performance.
The Challenge of Discrete Tokenization
Vector-Quantized Variational Autoencoders (VQ-VAEs) serve as the fundamental "tokenizers" for modern generative AI, converting high-dimensional images into discrete codes compatible with models like Llama or Stable Diffusion. However, training these models is notoriously unstable. The mapping from continuous vectors to discrete codebook entries is a step function, preventing standard backpropagation. Researchers typically rely on complex workarounds—such as straight-through estimators, Gumbel-Softmax tricks, or specialized loss functions—to mitigate issues like "codebook collapse," where the model underutilizes its discrete capacity.
Gaussian Quant: A Two-Stage Approach
The authors propose Gaussian Quant (GQ), a two-stage pipeline that eliminates the need to train the discrete component directly:
- Constrained Continuous Training: The model begins as a standard Gaussian VAE. The key innovation is the Target Divergence Constraint (TDC), a heuristic that forces the model to achieve a specific Kullback–Leibler (KL) divergence for every dimension of the latent space. This ensures information is distributed uniformly, preparing the continuous latent space to be mapped into a discrete codebook of a specific size.
- Training-Free Conversion: After training the continuous VAE, a fixed codebook of random Gaussian noise is generated. Discretization is achieved by simply finding the entry in this random codebook closest to the VAE's output.
This approach is theoretically grounded in the bits-back coding rate. The authors demonstrate that if the codebook size matches the information rate of the continuous VAE, the quantization error becomes negligible.
Experimental Setup
GQ was evaluated using two primary computer vision datasets: ImageNet for comprehensive quantitative and qualitative assessment, and COCO to test generalization across diverse image types. The method was tested across two dominant architectures: UNet (prevalent in diffusion models) and ViT (Vision Transformers).
Performance and Insights
GQ consistently surpasses established discrete tokenizers, including VQGAN, FSQ, LFQ, and BSQ, across a variety of performance metrics.
Key Results:
- Reconstruction Quality: On ImageNet at 0.5 bits-per-pixel (bpp), GQ achieved a PSNR of 30.17, notably higher than VQGAN (29.21) and FSQ (29.29).
- Visual Fidelity: GQ preserves significantly finer details, such as animal fur textures and sharp architectural lines, which are often blurred or distorted by competing methods at similar compression rates.
- Generative Performance: When integrated into generative pipelines, GQ achieved superior Fréchet Inception Distance (FID) scores, indicating the production of more realistic and diverse imagery.
The success of GQ highlights that random codebooks are sufficient for high-quality quantization, provided the encoder is properly constrained during training. Furthermore, the implementation of a custom CUDA kernel ensures that the encoding process remains computationally efficient, matching the speed of standard continuous VAEs.
Conclusion and Future Directions
While GQ represents a significant advancement in discrete autoencoding, certain challenges remain. The model still struggles with extremely fine, high-contrast details, such as small text on license plates. Future work may explore the application of GQ within multi-scale or residual VQ-VAE structures. Additionally, the authors note that while GQ improves reconstruction, the complex relationship between tokenization strategies and the downstream "dreaming" capabilities of transformers warrants further investigation.
Summary updated