NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Enhancing Vector Quantization with Distributional Matching: A Theoretical and Empirical Study

Xianghong Fang, Litao Guo, Hengchao Chen, Yuxuan Zhang, XiaofanXia, Dingjie Song, Yexin Liu, Hao Wang, Harry Yang, Yuan Yuan, Qiang Sun

TL;DR

Vector Quantization (VQ) in autoregressive models often suffers from training instability and codebook collapse because the distributions of continuous features and discrete code vectors don't match. This paper introduces Wasserstein VQ, which uses the quadratic Wasserstein distance to explicitly align these distributions under a Gaussian hypothesis. This simple modification achieves near 100% codebook utilization and significantly reduces quantization errors, leading to state-of-the-art visual reconstruction quality.

What Problem Does This Paper Address?

Autoregressive models have become a dominant paradigm in visual generation, often outperforming diffusion models. Their success hinges on Vector Quantization (VQ), a technique that compresses and discretizes continuous latent features from an encoder by mapping them to the nearest "codewords" in a learnable codebook.

However, standard VQ suffers from two critical flaws:

  1. Training Instability: Because the quantization step is non-differentiable, models use a Straight-Through Estimator (STE) to copy gradients. When the quantization error (the distance between continuous features and discrete codewords) is large, this gradient approximation fails, destabilizing training.
  2. Codebook Collapse: Often, only a tiny fraction of the codebook is actually used during training. The remaining code vectors receive no gradients, leaving them unoptimized and wasting model capacity.

The authors reveal that both issues are driven by a fundamental distributional mismatch between the encoder's features and the codebook's vectors.

Figure 1: The symbols · and × represent the fea- ture and code vectors, respectively. The left figure illustrates the distributional mismatch between the feature and code vectors, while the right figure visu- alizes their distributional match.

Methods

To bridge this distributional gap, the authors propose Wasserstein VQ, which introduces an explicit distribution-matching constraint into the training objective.

  • The Quadratic Wasserstein Distance: The authors employ the Wasserstein distance to measure and minimize the discrepancy between the feature distribution and the codebook distribution.
  • The Gaussian Hypothesis: Calculating optimal transport in high dimensions is typically too computationally expensive for deep learning training loops. To solve this, the authors assume both the continuous features and the discrete codebook vectors follow Gaussian distributions.
  • Closed-Form Loss: Under the Gaussian hypothesis, the quadratic Wasserstein distance simplifies into a clean, differentiable closed-form equation based solely on sample means and covariance matrices. This allows the proposed Wasserstein loss ($\mathcal{L}_W$) to be computed with minimal computational overhead.

The authors seamlessly integrate this loss into standard VQ-VAE and VQGAN frameworks, balancing it alongside standard reconstruction, commitment, and adversarial losses.

Datasets

The method was rigorously evaluated across four standard image synthesis benchmarks:

  • Low-Resolution: CIFAR-10 and SVHN.
  • High-Resolution: FFHQ and ImageNet.

The benchmarks were chosen to test how well the method scales across varying image complexities and massive codebook sizes (ranging from 1,024 up to 100,000 codewords).

Key Insights and Ideas

  • The Root of Codebook Collapse: Codebook collapse isn't just an initialization failure; it's an alignment failure. If the codebook's distribution doesn't match the feature space, features will crowd around a small subset of codewords, leaving the rest abandoned.
  • Theoretical Guarantees: The authors mathematically prove (Theorems 1 and 2) that matching the support and density of the feature and codebook distributions is both necessary and sufficient to achieve full codebook utilization and eliminate quantization error asymptotically.
  • Justifying the Gaussian Assumption: While assuming image features are Gaussian sounds restrictive, the authors demonstrate that learned features in lower-dimensional spaces naturally exhibit Gaussian-like characteristics due to the Central Limit Theorem.

Key Results

  • Eliminating Codebook Collapse: Across almost all datasets and massive codebook sizes, Wasserstein VQ consistently achieved 100% codebook utilization. In comparison, Vanilla VQ utilization dropped to less than 1% when scaling to large codebooks.
  • Superior Reconstruction Fidelity: On the FFHQ dataset with a codebook size of 100,000, Wasserstein VQGAN achieved a reconstructed Frechet Inception Distance (rFID) of 2.71, outperforming the previous state-of-the-art baseline (VQGAN-LC at 3.81).
  • Multi-Scale Scaling: When combined with multi-scale VQ architectures, Wasserstein VQ pushed the rFID down to an exceptional 1.79, while maintaining higher PSNR and SSIM values than all baselines.

Limitations and Future Work

The primary limitation acknowledged by the authors is their reliance on the Gaussian distribution assumption. While this assumption holds true for current standard architectures, it may not strictly hold in all scenarios or alternative latent spaces (e.g., highly multi-modal distributions).

For future work, the authors aim to develop distribution-matching VQ frameworks that are entirely distribution-agnostic, removing the Gaussian constraint without sacrificing the computational efficiency of the closed-form loss.

Summary updated

BibTeX
@misc{fang2025enhancing,
  author = {Xianghong Fang and Litao Guo and Hengchao Chen and Yuxuan Zhang and XiaofanXia and Dingjie Song and Yexin Liu and Hao Wang and Harry Yang and Yuan Yuan and Qiang Sun},
  title = {{Enhancing Vector Quantization with Distributional Matching: A Theoretical and Empirical Study}},
  year = {2025},
  eprint = {2506.15078},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.15078},
}
Figure