Introduction
In the world of lossless data compression, a golden rule applies: if you have a model that predicts the probability of data well (i.e., achieves a low negative log-likelihood), you can theoretically turn that model into a highly efficient compressor. Deep generative models—such as autoregressive models, Variational Autoencoders (VAEs), and flow models—excel at this prediction task.
However, translating theoretical existence into a computationally efficient algorithm is challenging. Autoregressive models boast efficient coding but are painfully slow to decode because they generate data sequentially, one pixel at a time. VAEs bypass this using a technique called "bits-back coding." Flow models, which use invertible transformations to map data to a simple noise distribution, have historically been the "odd one out." Despite offering fast sampling and exact likelihoods, they lacked a tailored coding algorithm that didn't require calculating massive, complex Jacobian matrices—a computationally prohibitive step for high-dimensional data like images.
This paper introduces local bits-back coding, a novel technique that finally makes flow-based generative models practical for lossless data compression. By treating flows as a special case of latent variable models and using local linear approximations, the authors achieve compression rates that nearly match theoretical limits while remaining computationally efficient.
Local Bits-Back Coding
The authors bridge the algorithmic gap by adapting the bits-back framework specifically for flows.
The "Local" Idea: Standard bits-back coding is designed for latent variable models. The authors realized that a flow model $f$ can be viewed as a latent variable model if you consider the mapping $z = f(x)$ and inject a tiny bit of artificial Gaussian noise. By using a local linear approximation (a Taylor expansion) of the flow around a data point, they can define artificial distributions that make the bits-back scheme work for flows.
The Algorithm: To encode a piece of data $x$, the process follows three main steps:
- Decode a latent variable $z$ from an auxiliary pool of random bits (this is the "bits-back" mechanism).
- Encode the data $x$ using a distribution centered around the inverse flow of $z$.
- Encode $z$ using the flow's prior distribution.
Efficiency Gains: A naive "Black Box" version of this algorithm requires computing the full Jacobian matrix, which takes $O(d^3)$ time and is far too slow. However, most modern flows (like RealNVP or Glow) are built compositionally from many simple layers. The authors demonstrate that you can apply local bits-back coding layer-by-layer. This compositional approach avoids the full Jacobian entirely, running in $O(d)$ time and making it as fast as the model itself.
Additionally, the authors provide a new interpretation of dequantization (the practice of adding noise to discrete data during training), showing that it is essentially a bits-back coding step that converts a continuous model into a discrete one.
Key Insights and Results
The researchers evaluated their algorithms on standard image benchmarks including CIFAR-10, ImageNet 32x32, and ImageNet 64x64, utilizing the state-of-the-art Flow++ architecture.
- Near-Theoretical Performance: On CIFAR-10, the theoretical limit (Negative Log-Likelihood) was 3.116 bits/dim. The local bits-back algorithm achieved 3.118 bits/dim—an almost perfect match to the theoretical bound.
- Massive Speedup: The computational difference between the naive and compositional approaches is staggering. The Black Box algorithm took 1349 seconds to encode a single 64x64 ImageNet image. The Compositional algorithm took only 0.69 seconds.
- Parallelism: Unlike autoregressive models, which must be coded sequentially, this method is fully parallelizable across data dimensions, making it highly suitable for modern GPU hardware.
The Precision Balance: The paper highlights a delicate trade-off between the noise level ($\sigma$) and discretization precision ($\delta$). If the discretization is too coarse relative to the noise, the compression performance collapses.
Limitations and Future Work
While highly effective, the method has a few limitations:
- The "Initial Bits" Problem: Bits-back coding requires a pre-existing pool of random bits to start the decoding process. This makes it impractical for compressing a single, small file from scratch. However, this overhead becomes negligible when compressing large batches of data or long sequences.
- Hyperparameter Sensitivity: The method requires careful tuning of the noise parameter $\sigma$ and discretization $\delta$ to maintain optimal compression.
Looking forward, the authors suggest extending this technique to other modalities, such as video (VideoFlow) and audio (WaveGlow). In these domains, the fast, parallel decoding capabilities of flows could offer a massive advantage over current sequential compression methods.
Summary updated