IDF++: Analyzing and Improving Integer Discrete Flows for Lossless Compression

Rianne van den Berg, Alexey A. Gritsenko, Mostafa Dehghani, Casper Kaae Sønderby, Tim Salimans

Lossless compression is the art of shrinking data without losing a single bit. While traditional tools like PNG or ZIP have served us for decades, the machine learning community has recently turned to Normalizing Flows—models that learn to transform complex data (like a photo) into a simple, predictable distribution (like white noise).

However, most flows are designed for continuous, real-valued data. When applied to discrete data like pixels, they often require "bits-back" coding or dequantization, which can be messy and computationally expensive. Integer Discrete Flows (IDF) were a breakthrough because they operate directly on integers. In this paper, researchers introduce IDF++, a refined version that is more flexible, easier to train, and twice as efficient.

TL;DR

IDF++ improves Integer Discrete Flows by proving they are theoretically as flexible as continuous flows and introducing architectural refinements that allow a model with half the layers to outperform the original. It achieves state-of-the-art lossless compression results on standard image benchmarks, significantly beating traditional codecs like PNG and JPEG-2000.

What Problem Does This Paper Address?

Lossless compression relies on density estimation: if you can perfectly predict the probability of a pixel, you can represent it with the minimum number of bits.

Two major hurdles stood in the way of IDFs:

  1. Flexibility Concerns: Previous research suggested that discrete flows were fundamentally less flexible than continuous ones because they can only "permute" probability masses rather than stretching or squeezing them.
  2. Gradient Bias: IDFs use a "rounding" operation that isn't differentiable. To train them, researchers use a Straight-Through Estimator (STE), which essentially ignores the rounding during backpropagation. It was widely believed that the resulting "gradient bias" severely limited how deep these models could go.

Methods

The authors tackle these hurdles through both theoretical proof and empirical engineering:

  • The Flexibility Proof: They demonstrate that the "permutation-only" limitation of discrete flows is a non-issue if you embed the data into a large enough space. Since IDFs operate on a countably infinite integer lattice ($\mathbb{Z}^d$), they have enough "room" to factorize any distribution into an independent one.
Visualizing the transformation of a base distribution to a complex target distribution in discrete space.
  • Gradient Analysis: They numerically compared STE gradients against "true" gradients (calculated via finite differences). They found that for 8-bit data, the STE is actually a very reliable proxy, debunking the idea that gradient bias is the primary cause of poor performance in deep models.
  • IDF++ Architecture: To improve performance, they introduced several key tweaks:
  • Inverted Permutations: They ensured that channel permutations are inverted after each layer, which helps maintain the spatial correlation of the image across levels.
  • The "Rezero" Trick: They initialized each flow layer to perform an identity transformation at the start of training, making the optimization much more stable.
  • Modernized Blocks: They replaced standard ReLU activations with Swish and added Group Normalization to the internal neural networks.

Datasets

The models were evaluated on three standard image datasets used in generative modeling:

  • CIFAR-10: $32 \times 32$ color images.
  • ImageNet-32: Downsampled $32 \times 32$ versions of the massive ImageNet dataset.
  • ImageNet-64: Downsampled $64 \times 64$ versions of ImageNet.

Key Insights and Ideas

  • Infinite Lattice = Infinite Flexibility: By proving that IDFs can "flatten" a high-dimensional hypercube into a one-dimensional line of integers, the authors showed that discrete flows are just as powerful as continuous ones for density estimation.
  • Architecture Matters More Than Bias: The "performance degradation" previously blamed on gradient bias was actually due to poor architectural choices. By using better normalization and initialization, the authors could train deeper, more stable models.
  • Efficiency Gains: One of the most striking findings was that an IDF++ model with only 4 flow layers per level performed better than the original IDF model with 8 layers. This effectively doubles the speed of the forward pass.

Key Results

The performance is measured in bits per dimension (bpd)—lower is better.

Model / Codec CIFAR-10 ImageNet-32 ImageNet-64
PNG 5.87 6.39 5.71
JPEG-2000 5.20 6.48 5.10
Original IDF 3.32 4.18 3.90
IDF++ (Small) 3.31 4.16 3.85
IDF++ (Full) 3.26 4.12 3.81

IDF++ consistently outperforms traditional hand-designed codecs and the original IDF baseline across all datasets.

Limitations and Future Work

While IDF++ is a significant step forward, the authors note a few remaining challenges:

  • Computational Cost: Like most deep learning-based compression, IDF++ is much slower to run than a simple algorithm like PNG. Reducing the complexity of these models is a priority for real-world use.
  • Source Compression: These models are currently "tuned" to specific datasets. Future work is needed to make them generalize better to arbitrary, unseen images (general-purpose compression).
  • Alternative Estimators: While STE works well for 8-bit data, the authors suggest exploring other gradient estimators for lower bit-depth data where the bias becomes more problematic.

Summary updated

BibTeX
@inproceedings{berg2021idf,
  author = {Rianne van den Berg and Alexey A. Gritsenko and Mostafa Dehghani and Casper Kaae Sønderby and Tim Salimans},
  title = {{IDF++: Analyzing and Improving Integer Discrete Flows for Lossless Compression}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=eLoVfmZaPjT},
}
Figure