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

Differentiable Vector Quantization for Rate-Distortion Optimization of Generative Image Compression

Shiyin Jiang, Wei Long, Minghao Han, Zhenghao Chen, Ce Zhu, Shuhang Gu

TL;DR

The paper introduces RDVQ (Rate-Distortion Vector Quantization), a novel framework that enables end-to-end rate-distortion optimization for vector quantization-based image compression. By introducing a differentiable soft relaxation of the discrete codebook distribution during training, RDVQ allows the rate loss to directly shape the encoder's latent space. This achieves state-of-the-art perceptual quality at ultra-low bitrates using a lightweight architecture with a fraction of the parameters required by competing methods.

What Problem Does This Paper Address?

In learned image compression, models aim to balance the trade-off between the file size (rate) and the reconstruction quality (distortion). Most modern codecs use Scalar Quantization (SQ), which quantizes each feature independently. SQ allows for straightforward end-to-end optimization using differentiable approximations, but it fails to capture complex cross-channel dependencies, often leading to structural blurriness at low bitrates.

Vector Quantization (VQ) solves this by mapping groups of features to discrete "atoms" in a learnable codebook, which preserves local structures and textures much better. However, VQ relies on a hard nearest-neighbor lookup that is fundamentally non-differentiable.

Figure 1. Gradient-based rate control in VQ compression is chal- lenging due to non-differentiable indices.

As a result, the gradient from the rate loss cannot flow back to the encoder. This decouples representation learning from entropy modeling, forcing existing VQ methods to rely on sub-optimal heuristics for rate control.

Methods

RDVQ overcomes the VQ gradient bottleneck by decoupling the reconstruction path from the rate-optimization path during training.

Figure 2. Overview of RDVQ. The analysis transform ga extracts multi-scale features, which are flattened into a sequence y for vector quantization and entropy modeling. The VQ module produces hard-quantized embeddings yq, discrete indices yind, and a relaxed distri- bution psoft. During training, reconstruction is performed from yq, while the rate objective is computed as the cross-entropy between the relaxed distribution psoft and the entropy model prediction qψ, enabling gradient flow from the rate loss to the encoder. The same model is used for entropy coding and supports test-time index completion. Right: Details of the VQ module and gradient flow. Hard assignment is used for reconstruction and coding, while the relaxed distribution is used only for rate estimation, restoring gradient flow from the rate loss (LR) to the encoder ga.

The framework introduces three core components:

  1. Differentiable Soft Relaxation: During training, the hard nearest-neighbor lookup is replaced only in the rate-estimation branch with a distance-aware soft distribution ($p_{\text{soft}}$) computed via a softmax over negative distances. This acts as a "gradient bridge," allowing the rate loss to backpropagate and optimize the encoder. The actual image reconstruction and final deployment still use standard hard VQ.
  2. Dependency-Aware Token Ordering: Multi-scale features from the encoder are flattened into a sequence. To maintain structural relationships, tokens are ordered scale-wise (coarse-to-fine) and spatially, creating a structured causal sequence.
  3. Masked-Transformer Entropy Model: A transformer predicts the conditional probabilities of the codebook indices based on the dependency-aware sequence. Because it is tightly coupled with the optimized latent space, it also enables test-time rate control via prefix transmission and autoregressive index completion without needing to retrain the model.

Datasets

The model was pretrained on ImageNet for the autoencoder/codebook and fine-tuned on high-resolution datasets (OpenImage and DF2K).

Evaluation was performed on three standard image compression benchmarks:

  • Kodak: 24 natural images (768 × 512).
  • CLIC2020 Test: 428 high-quality 2K images.
  • DIV2K validation set: 100 high-quality 2K images.

Key Insights and Ideas

  • Decoupled Optimization Paths: The primary "aha moment" is that you don't need to change the quantization method used for image reconstruction to make the network differentiable. By using a soft distribution purely as a training surrogate for the rate loss, the network learns an entropy-aware prior while retaining the discrete deployment benefits of VQ.
  • Emergent Encoder Adaptation: When subjected to joint rate-distortion optimization, the encoder naturally adapts its behavior. As the bitrate constraint tightens, the encoder progressively prioritizes smooth, low-frequency structures and concentrates its codebook usage on a smaller, highly representative subset of atoms.
  • Unified Tokenization and Compression: By introducing an entropy constraint to VQ, this work bridges the gap between discrete visual tokenizers (like those used in autoregressive image generation) and traditional image codecs.

Key Results

RDVQ achieves state-of-the-art performance in ultra-low bitrate settings while remaining highly efficient:

  • Bitrate Reduction: Compared to the hybrid SQ-VQ method RDEIC, RDVQ reduces the required bitrate by up to 75.71% on the DISTS metric and 37.63% on the LPIPS metric on the DIV2K validation set.
  • Model Efficiency: RDVQ achieves superior or competitive perceptual quality while using less than 20% of the parameters of dominant baselines (saving roughly 251.9M parameters compared to foundation-model-based architectures like StableCodec).
  • Speed: It maintains practical inference speeds, processing a full 2K resolution image in 1.3 seconds on a single NVIDIA RTX 4090 GPU.

Limitations and Future Work

The authors note that while the transformer-based entropy model allows for test-time rate control via prefix completion, this flexibility operates within a limited range of bitrates. Extreme adjustments outside this optimized window can degrade completion stability.

For future work, the authors suggest that their entropy-aware VQ formulation could be applied broadly to improve the efficiency and structure of visual tokenizers used in large-scale discrete generative models.

Summary updated

BibTeX
@inproceedings{jiang2026differentiable,
  author = {Shiyin Jiang and Wei Long and Minghao Han and Zhenghao Chen and Ce Zhu and Shuhang Gu},
  title = {{Differentiable Vector Quantization for Rate-Distortion Optimization of Generative Image Compression}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=h36YPpumN0},
}
Figure