Abstract
It has been witnessed that learned image compression has outperformed conventional image coding techniques and tends to be practical in industrial applications. One of the most critical issues that need to be considered is the non-deterministic calculation, which makes the probability prediction cross-platform inconsistent and frustrates successful decoding. We propose to solve this problem by introducing well-developed post-training quantization and making the model inference integer-arithmetic-only, which is much simpler than presently existing training and fine-tuning based approaches yet still keeps the superior rate-distortion performance of learned image compression. Based on that, we further improve the discretization of the entropy parameters and extend the deterministic inference to fit Gaussian mixture models. With our proposed methods, the current state-of-the-art image compression models can infer in a cross-platform consistent manner, which makes the further development and practice of learned image compression more promising.
Introduction: The Floating-Point Catastrophe
Learned image compression using neural networks has recently begun to outperform traditional standards like JPEG, BPG, and even VVC. However, these models face a significant hurdle in production: non-determinism.
Neural networks typically rely on floating-point arithmetic. Because different hardware (e.g., an NVIDIA GPU vs. an Intel CPU) handles floating-point rounding slightly differently, the exact same model can produce divergent outputs on different devices. In most AI tasks, a 0.00001 difference is negligible. But in image compression, it is a catastrophe. Modern compression uses Arithmetic Coding, which requires the encoder and decoder to have identical probability estimates for every pixel. If the decoder’s hardware calculates a slightly different probability than the encoder’s, the entire bitstream becomes misaligned, leading to total decoding failure and corrupted images.
Methodology: Determinizing the Pipeline
We propose a three-pronged approach to "determinize" the compression pipeline without requiring expensive retraining (Quantization-Aware Training):
1. Integer-Arithmetic-Only Requantization
The core of the solution involves converting the model to 8-bit integers. To prevent 32-bit overflows during intermediate calculations—a common risk in fixed-point math—we introduce a constraint on the scaling factors ($m_0$) used between layers. This ensures the model runs safely and consistently on any standard 32-bit integer hardware.
2. Binary Logarithm-based Discretization
To estimate the probability of a pixel, models predict entropy parameters such as standard deviation ($\sigma$). Usually, this involves a slow search through a look-up table. We developed a method using binary logarithms (calculated via bit-shifting and counting leading zeros) to map these parameters to indices directly and deterministically, removing a major bottleneck in the entropy modeling stage.
3. GMM Extension
We extended this deterministic logic to support Gaussian Mixture Models (GMM), which are used in state-of-the-art compression models to represent complex pixel distributions, ensuring even the most advanced architectures remain cross-platform consistent.
Experimental Results
Using standard benchmarks including ImageNet for training and Kodak/Tecnick for evaluation, the proposed framework demonstrated significant improvements in reliability and efficiency.
- Consistency: In cross-platform tests (Encoding on GPU, Decoding on CPU), standard floating-point models failed 50% to 84% of the time. Our proposed integer-only models achieved a 0% error rate.
- Efficiency: The "compression tax" for using integers was remarkably low. On the Minnen et al. (2018) model, the BD-rate (a measure of compression loss) increased by only 0.35%, meaning the quality-to-file-size ratio remained almost identical to the full-precision model.
- Speedup: The new discretization method reduced latency on the Kodak dataset from 17.32µs to 4.35µs compared to standard implementations, a nearly 4x improvement in that specific sub-module.
Conclusion and Future Work
This work demonstrates that well-implemented Post-Training Quantization (PTQ) is sufficient to solve the consistency issues of learned image compression without the need for complex retraining. While the method is highly effective for convolutional architectures, future research will address the challenges of quantizing Transformers and Self-Attention layers, which are more sensitive to PTQ and represent the next frontier in neural image coding.
Summary updated