Multi-Sample Training for Neural Image Compression

Tongda Xu, Yan Wang, Dailan He, Chenjian Gao, Han Gao, Kunzan Liu, Hongwei Qin

TL;DR

This paper introduces MS-NIC, a training framework that replaces the standard single-sample Evidence Lower Bound (ELBO) with a tighter, multiple-sample Importance Weighted Autoencoder (IWAE) target for neural image compression. By analyzing the unique properties of the uniform noise used in compression, the authors develop a "plug-and-play" training method that achieves up to a 5% bitrate saving and learns richer latent representations without altering the inference architecture.

The Challenge with Standard NIC Training

Most modern Neural Image Compression (NIC) models are trained using a framework established by Ballé et al. (2017). In this setup, quantization—a non-differentiable process—is replaced during training by adding uniform noise. This allows the model to be treated as a Variational Autoencoder (VAE), where the goal is to maximize the Evidence Lower Bound (ELBO).

However, the standard ELBO has two major drawbacks in this context:

  1. Looseness: The ELBO is a lower bound on the true log-likelihood. A loose bound can lead to "posterior collapse," where the model ignores some latent dimensions, resulting in a less efficient representation.
  2. Gradient Noise: Standard training relies on a single-sample estimate of the gradient, which can be highly volatile, making the model harder to optimize.

While the machine learning community has solved some of these issues using Importance Weighted Autoencoders (IWAE), these techniques haven't been successfully applied to NIC. The uniform noise used in compression breaks the mathematical assumptions (like absolute continuity) that standard IWAE gradient estimators rely on.

Introducing MS-NIC: Multiple-Sample Training

The authors propose MS-NIC (Multiple-Sample Neural Image Compression) to bridge this gap. Their approach involves several key technical contributions and mathematical analyses of NIC posteriors.

They identify that the uniform posterior used in NIC has unique properties: its support depends on the parameters, and its log-density is zero on that support. This means that the "score function" gradient estimator is biased and essentially "broken" for NIC.

Graphical models comparing standard VAE, IWAE, and the proposed MS-NIC architectures.

To solve this, they introduce two new training targets:

  • MS-NIC-MIX: A hybrid approach that samples the primary latent ($y$) multiple times but the hyper-latent ($z$) only once. This is computationally cheaper.
  • MS-NIC-DMS (Double Multiple Sampling): A nested approach that samples both latents multiple times. This provides the tightest bound and converges to the true log-likelihood as the number of samples increases.

Unbiased Pathwise Estimators vs. DReG

The authors prove that while popular variance-reduction "tricks" like DReG (Doubly Reparameterized Gradient) fail in this context, a direct pathwise gradient estimator remains unbiased for NIC when using multiple samples.

Table demonstrating the failure of the DReG gradient estimator compared to the pathwise estimator in NIC.

Additionally, they provide a theoretical justification for the "Direct-y" trick—a common but poorly understood industry practice of feeding the deterministic latent $y$ (instead of the noisy $\tilde{y}$) into the hyper-prior network. They demonstrate that this significantly improves the Signal-to-Noise Ratio (SNR) of the gradients.

Key Insights

  • The Uniform Distribution "Blessing and Curse": The uniform noise used to simulate quantization is a "blessing" because it makes the standard pathwise gradient estimator equivalent to more advanced "Sticking the Landing" (STL) estimators. It’s a "curse" because it invalidates the IWAE-DReG estimator, which many researchers might blindly try to apply.
  • Variance vs. Bias: In NIC training, reducing gradient variance (via the "direct-y" trick or multiple samples) is often more critical for performance than the theoretical tightness of the bound itself.
  • Richer Latents: By using a tighter bound (IWAE), the model is less likely to let latent dimensions "die." MS-NIC models exhibit significantly higher variance in their latent space, meaning they pack more useful information into the compressed representation.

Results and Future Directions

The authors tested their method on two state-of-the-art baselines (Ballé 2018 and Cheng 2020), training on ImageNet and evaluating on the Kodak dataset.

  • Bitrate Savings: MS-NIC-DMS achieved a 4.9% to 5.6% reduction in BD-BR (a measure of bitrate savings at the same quality level) compared to the Ballé 2018 baseline.
  • Quality Improvement: When applied to the more complex Cheng 2020 model, it still provided a gain, though more modest (~2.3% bitrate saving). The authors suggest that the benefit of IWAE is bounded by how severe the "posterior collapse" is in the original model; if the baseline is already highly efficient, the gains are smaller.
  • Plug-and-Play: The method requires no changes to the model architecture at inference time; it is strictly a training-time enhancement.

While training with multiple samples ($k=8$ or $k=16$) increases computational overhead during the training phase, it has zero impact on decoding speed. Because most neural video compression models use similar uniform noise formulations, MS-NIC should be easily extendable to video, marking a promising direction for future research.

Summary updated

BibTeX
@inproceedings{xu2022multi,
  author = {Tongda Xu and Yan Wang and Dailan He and Chenjian Gao and Han Gao and Kunzan Liu and Hongwei Qin},
  title = {{Multi-Sample Training for Neural Image Compression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=O5r9emheNy},
}
Figure