TL;DR
STanH introduces a novel, differentiable quantization layer that enables variable-rate learned image compression (LIC) within a single core network architecture. By fine-tuning just a few hundred quantization parameters while keeping the rest of the network frozen, it eliminates the need to train and store separate multi-million parameter models for every target bitrate—slashing storage costs by roughly half with negligible impact on compression efficiency.
What Problem Does This Paper Address?
End-to-end learned image compression (LIC) models have recently evolved to match or even outperform traditional codecs like JPEG and HEVC/H.266. These deep learning models typically optimize a joint Rate-Distortion (RD) cost function:
$$\mathcal{L} = R + \lambda \cdot D$$
Here, $\lambda$ dictates the trade-off between the compressed file size (rate, $R$) and visual quality (distortion, $D$).
The catch? Quantization—the step that converts continuous network features into discrete bits—is fundamentally non-differentiable. To get around this during training, researchers usually replace quantization with uniform noise. However, this binds the entire network's weights to a single, fixed $\lambda$. If a user application needs to support six different quality levels, developers must train, deploy, and store six entirely separate neural networks, each containing tens of millions of parameters. This massive storage and training overhead makes deployment on resource-constrained edge devices highly impractical.
Methods
The authors propose STanH (Sum of Hyperbolic Tangents), a parametric, differentiable activation layer designed to relax the step-wise nature of standard quantization during training.
1. The STanH Layer
Instead of rounding to the nearest integer, the STanH layer approximates quantization using a finite summation of shifted and scaled hyperbolic tangent ($\tanh$) functions:
$$\tilde{y} = \sum_{i=1}^{L-1} \frac{w_i}{2} \cdot \tanh[\beta (y - b_i)]$$
Where:
- $w_i$ and $b_i$ are learnable weights and biases that define the reconstruction levels and the widths of the quantization intervals.
- $\beta$ is the inverse temperature controlling the steepness of the steps.
2. Temperature Annealing
During the early stages of training, $\beta$ is kept low so the function remains smooth and gradients can flow backward via standard backpropagation. As training progresses, a semi-deterministic annealing strategy gradually drives $\beta \to \infty$, morphing the smooth curve into a true, discrete step function.
3. Anchor and Derivation Strategy
To achieve variable bitrates, the authors train a few fully optimized anchor models at specific rates. To achieve a new target bitrate, they simply plug a new STanH layer into an existing anchor model, freeze all the convolutional/transformer layers, and fine-tune only the STanH parameters (which amount to just a few hundred numbers). These light-weight variations are called derivations.
4. Continuous Rate Control
Remarkably, the authors found that they can achieve continuous, fine-grained rate adaptation without any retraining simply by linearly interpolating the weights ($w$) and biases ($b$) of two trained STanH layers.
Datasets
- Training: The anchor models were trained on 24k random samples from the OpenImages dataset. The derivations were refined using a subset of only 8,000 images.
- Evaluation: Performance was validated across three standard image compression benchmarks:
- Kodak PhotoCD (24 uncompressed images)
- CLIC Professional validation and test datasets (60 high-resolution images)
- Tecnik dataset (100 high-resolution images)
Key Insights and Ideas
- Decoupling Transform from Quantization: The paper proves that the underlying mathematical transforms (the deep features learned by the encoder/decoder) do not need to change drastically to alter the bitrate. Adjusting the quantization step sizes and boundaries dynamically is sufficient.
- Non-Uniform Quantization Intervals: Unlike standard uniform integer rounding, STanH learns optimal, non-uniform quantization intervals. For lower bitrates, it automatically learns wider quantization steps around zero, effectively zeroing out less important high-frequency details.
- Linear Parameter Interpolation Works: Linearly blending the weights of two discrete quantization layers yields stable intermediate quantization behaviors, providing a simple mechanism for continuous quality sliders in software applications.
Key Results
The authors integrated STanH into three state-of-the-art LIC architectures (Zou22, Xie21, and Cheng20).
- Storage Savings: Instead of storing 6 full models to cover an RD curve, using a 3-anchor setup with 3 derivations reduced storage footprints by 49% (Cheng20), 53% (Zou22), and 57% (Xie21).
- Training Efficiency: Refining a STanH derivation takes only about 1/10th of the time of training a full model from scratch, leading to overall training energy savings of up to 45%.
- Negligible Quality Loss: The compression efficiency penalty (measured via BD-Rate) for compressing the network architecture by half was under 1% for both the Zou22 and Cheng20 models on the Kodak dataset.
Limitations and Future Work
While STanH significantly optimizes deployment and storage, the authors note that calculating the varying integral bounds required by the parametric layer during training increases the computational complexity per training iteration.
Additionally, extending this method to learned video compression remains an open challenge. Video codecs rely heavily on temporal residual representations, which exhibit vastly different latent space distributions than static images, meaning a straightforward drop-in application of STanH may require further architectural adaptations.
Summary updated