Introduction
In the realm of deep generative models, such as Variational Autoencoders (VAEs), data is frequently mapped to a continuous latent space. To transmit this data over a channel, standard practice dictates quantizing these continuous values into discrete buckets to utilize standard entropy coding (e.g., Huffman or Arithmetic coding). However, quantization is inherently problematic: it introduces errors and has zero derivatives almost everywhere, which complicates gradient-based training.
Relative Entropy Coding (REC) offers an elegant, quantization-free alternative. It allows for the direct communication of a sample from a target distribution $Q$ using a proposal distribution $P$. Despite its theoretical appeal, existing REC algorithms have struggled with practical adoption because they are often prohibitively slow—with runtimes scaling exponentially with the KL divergence ($2^{D_{KL}}$)—or they suffer from high coding overhead, using significantly more bits than the theoretical minimum.
To address these bottlenecks, this paper introduces Greedy Rejection Coding (GRC), a novel REC algorithm that achieves near-optimal runtime and codelength by intelligently partitioning the search space.
The Greedy Rejection Coding Algorithm
GRC generalizes a classic rejection sampling algorithm to arbitrary probability spaces and partitioning schemes. The "greedy" aspect of the algorithm stems from its approach to narrowing down the search space to find an acceptable sample more efficiently.
The core innovation of GRC is the use of partitioning processes. Standard rejection sampling can be likened to looking for a needle in a haystack. GRC, instead, recursively splits the probability space into smaller regions (cells), effectively playing a game of "hot or cold" to quickly discard large regions of low probability density.
The authors focus on two primary variants of this partitioning approach:
- GRCS (On-sample partitioning): Splits the space dynamically at the location of the previously drawn sample.
- GRCD (Dyadic partitioning): Recursively splits the space into two halves of equal probability under the proposal distribution $P$.
By "zooming in" on regions where the target distribution $Q$ has high density, GRC finds an acceptable sample much faster than naive methods.
Optimizing the Training Objective
Beyond the algorithm itself, the authors note that simply plugging REC into a standard VAE pipeline is suboptimal. Standard VAE training (maximizing the Evidence Lower Bound, or ELBO) does not account for the specific logarithmic overhead incurred by REC algorithms. To remedy this, they propose a Modified ELBO that adds an overhead penalty directly into the loss function. This encourages the model to learn latent representations that are inherently easier for GRC to compress.
Experimental Validation and Results
Theoretical and Synthetic Triumphs
A major theoretical contribution of the paper is proving that if the density ratio between the target and proposal distributions is unimodal, GRC is guaranteed to be fast and produce optimal-length codes.
Crucially, GRC's runtime scales linearly with the KL divergence ($D_{KL}$), rather than the infinity divergence ($D_\infty$) which bottlenecked previous state-of-the-art methods like A* coding. For unimodal distributions, the expected runtime of GRCS is theoretically bounded by $\approx 4.82 \cdot D_{KL} + \mathcal{O}(1)$.
In synthetic tests using Gaussian pairs where $D_\infty$ was artificially increased while $D_{KL}$ remained fixed, GRC variants maintained a constant, fast runtime, whereas A* coding slowed down exponentially.
Real-World Compression on MNIST
The researchers evaluated GRC within a full VAE compression pipeline using the MNIST dataset. By combining GRC with the modified ELBO training objective and a specialized index compression method ($\zeta$ coding), they achieved a 1–7% gain in compression efficiency compared to standard methods. For a VAE with 100 latent dimensions, the total bits per pixel successfully dropped from ~1.60 to ~1.48.
Limitations and Future Directions
While GRC represents a significant step forward for REC, it does have limitations:
- CDF Requirement: GRC requires the ability to evaluate the Cumulative Distribution Function (CDF) of the target distribution $Q$. While feasible for many standard models, this can become computationally expensive or mathematically intractable for highly complex distributions.
- The Curse of Dimensionality: Currently, the most practical way to apply GRC to multivariate data is dimension-wise (breaking it down into 1D independent problems). This introduces a small coding overhead for every single dimension, which accumulates in high-dimensional spaces.
Future work will likely focus on developing truly multivariate partitioning schemes that can handle high-dimensional latent spaces simultaneously, potentially driving the bit-rate down even further and making REC a standard tool in neural compression pipelines.
Summary updated