iFlow: Numerically Invertible Flows for Efficient Lossless Compression via a Uniform Coder

Shifeng Zhang, Ning Kang, Tom Ryder, Zhenguo Li

Lossless compression is a cornerstone of our digital lives, but as global data production skyrockets—reaching an estimated 59 zettabytes in 2020—traditional codecs like PNG and JPEG-XL are struggling to keep pace with the compression ratios offered by modern machine learning. While "neural compression" models, specifically normalizing flows, show incredible promise in shrinking files, they have historically been too slow for real-world use.

In their NeurIPS 2021 paper, researchers from Huawei Noah’s Ark Lab introduce iFlow, a framework that finally bridges the gap between the high compression ratios of deep learning and the high-speed requirements of practical software.

TL;DR

iFlow is a new framework for lossless compression that uses normalizing flows to achieve state-of-the-art compression ratios while running 5x faster than previous high-performance neural schemes. It achieves this through two main innovations: a numerically invertible transform called Modular Scale Transform (MST) that allows for flexible model architectures, and a lightning-fast entropy coder called Uniform Base Conversion System (UBCS) based on uniform distributions.

The Challenge: Discretization and Bottlenecks

Normalizing flows are generative models that learn a bijective (two-way) mapping between complex data (like images) and a simple latent space. In theory, they are perfect for compression: map an image to a simple distribution, encode it, and then reverse the process to get the exact image back. However, two major hurdles have prevented widespread adoption:

  1. The Discretization Gap: Normalizing flows work in continuous space (floating-point numbers), but lossless compression requires discrete space (integers/bits). Previous attempts to fix this either limited the model's power (making it less effective at compressing) or introduced slow "bits-back" coding techniques.
  2. The Coding Bottleneck: Traditional entropy coders like rANS (Range Asymmetric Numeral Systems) are computationally expensive and often become the primary bottleneck in neural compression pipelines.

The iFlow Solution: MST and UBCS

To overcome these hurdles, the authors introduce two core components:

Comparison of iFlow architecture against previous methods like IDF and LBB, highlighting the balance of high compression ratio and bandwidth.

1. Modular Scale Transform (MST)

MST is a novel family of transformations that makes continuous flows "numerically invertible" in discrete space. Instead of forcing the model to be mathematically constrained (like Integer Discrete Flows), MST uses a fractional approximation and modular arithmetic to handle the "remainders" that usually cause rounding errors. This allows iFlow to use powerful, non-linear flow layers without losing a single bit of information during the round trip.

2. Uniform Base Conversion System (UBCS)

Most entropy coders are designed to handle complex probability distributions, which makes them slow. Because the MST process effectively transforms data into a uniform distribution, the authors realized they didn't need a complex coder. UBCS is a high-speed coder that treats the compression process as a simple number-base conversion. It is much easier to implement and significantly more parallelizable than rANS or Arithmetic Coding.

Key Results and Performance

The researchers evaluated iFlow across a variety of standard benchmarks, including low-resolution (CIFAR10, ImageNet32/64) and high-resolution (CLIC, DIV2k) datasets. The results demonstrate a massive leap in practical viability:

  • Unprecedented Speed: iFlow is 5x faster at encoding than the previous state-of-the-art flow method (LBB).
  • Massive Coding Bandwidth: The UBCS coder achieved a throughput of over 2000 million symbols/s for encoding and 550 million symbols/s for decoding on 16 threads. This is orders of magnitude faster than the rANS coder used in competing models, as UBCS scales beautifully with multi-threading.
  • State-of-the-Art Compression: iFlow matches or exceeds the compression performance (measured in bits per dimension, or bpd) of all existing flow-based models. On CIFAR10, it achieves 3.12 bpd, significantly outperforming traditional formats like PNG (5.87 bpd) and modern ones like FLIF (4.19 bpd). It also outperformed all tested methods on high-resolution datasets like DIV2k.

Limitations and Future Work

While iFlow is a massive step forward, the authors note a few areas for further exploration:

  • Computational Overhead: Although the bit-pushing coding step is now lightning-fast, running the neural network itself still requires a GPU for optimal performance. This makes it less suitable for low-power mobile devices compared to simple algorithms like PNG.
  • Data Privacy: Generative models can sometimes "leak" information about their training data, requiring careful consideration of data-privacy laws when deployed.
  • Broader Applications: The paper suggests these techniques could be extended to other data types, such as text or graphs, using Categorical Normalizing Flows.

Summary updated

BibTeX
@inproceedings{zhang2021iflow,
  author = {Shifeng Zhang and Ning Kang and Tom Ryder and Zhenguo Li},
  title = {{iFlow: Numerically Invertible Flows for Efficient Lossless Compression via a Uniform Coder}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=UQsbDkuGM0N},
}
Figure