Learning Optimal Lattice Vector Quantizers for End-to-end Neural Image Compression
Authors: Xi Zhang, Xiaolin Wu
Organizations: Department of Electronic Engineering, Shanghai Jiao Tong University · School of Computing and Artificial Intelligence, Southwest Jiaotong University
It is customary to deploy uniform scalar quantization in the end-to-end optimized Neural image compression methods, instead of more powerful vector quantization, due to the high complexity of the latter. Lattice vector quantization (LVQ), on the other hand, presents a compelling alternative, which can exploit inter-feature dependencies more effectively while keeping computational efficiency almost the same as scalar quantization. However, traditional LVQ structures are designed/optimized for uniform source distributions, hence nonadaptive and suboptimal for real source distributions of latent code space for Neural image compression tasks. In this paper, we propose a novel learning method to overcome this weakness by designing the rate-distortion optimal lattice vector quantization (OLVQ) codebooks with respect to the sample statistics of the latent features to be compressed. By being able to better fit the LVQ structures to any given latent sample distribution, the proposed OLVQ method improves the rate-distortion performances of the existing quantization schemes in neural image compression significantly, while retaining the amenability of uniform scalar quantization. Code is available at: https://github.com/xzhang9308/OLVQ.
Figures & tables
Figure 1: Two-dimensional visual examples for (a) scalar quantizer, (b) lattice vector quantizer and (c) general vector quantizer.
Table 1: Results of bitrate savings achieved by the proposed optimal lattice vector quantization (OLVQ) method over the scalar quantizer across different image compression networks and context models. The lattice vector dimension is set to 32 here.
Figure 2: Rate-distortion curves for the Bmshj2018 model on the Kodak and CLIC datasets, evaluated in terms of MSE and SSIM.
Auto-encoder size
Bmshj2018 [ 7 ]
SwinT-ChARM [ 50 ]
Context model
Factorized
Checkerboard
Factorized
Checkerboard
E8, Gosset lattice
-6.58%
-4.95%
-5.12%
-2.19%
Optimized 8-dimension lattice
10.92%
-6.47%
-6.03%
-3.02%
A16, Barnes-Wall lattice
-8.15%
-6.15%
-5.23%
-3.12%
Optimized 16-dimension lattice
-15.73%
-8.82%
-7.42%
-4.64%
A24, Leech lattice
-12.82%
-7.54%
-6.69%
-3.47%
Table 2: Results of bitrate savings achieved by classical pre-defined lattice vector quantizers and the learned optimal lattice vector quantizers over the scalar quantizer, across different image compression models and context models.
Auto-encoder size
Bmshj2018 [ 7 ]
SwinT-ChARM [ 50 ]
Context model
Factorized
Checkerboard
Factorized
Checkerboard
Optimized 8-dimension LVQ
-10.92%
-6.47%
-6.03%
-3.02%
Optimized 8-dimension GVQ
-12.10%
-7.82%
-7.59%
-4.19%
Optimized 16-dimension LVQ
-15.73%
-8.82%
-7.42%
-4.64%
Optimized 16-dimension GVQ
-17.59%
-10.48%
-9.41%
-6.03%
Optimized 24-dimension LVQ
-20.49%
-10.71%
-10.68%
-5.89%
Table 3: Results of bitrate savings achieved by the learned optimal lattice vector quantizers and general vector quantizers over uniform scalar quantizer, across different image compression models and context models.
Table 4: Inference times of three different quantization methods: uniform scalar quantizer (USQ), lattice vector quantizer (LVQ), and general vector quantizer (GVQ) across different dimensions. For GVQ, the codebook size is adjusted to be larger as the dimension increases.
Recently, numerous end-to-end optimized image compression neural networks have been developed and proved themselves as leaders in rate-distortion performance. The main strength of these learnt compression methods is in powerful nonlinear analysis and synthesis transforms that can be facilitated by deep neural networks. However, out of operational expediency, most of these end-to-end methods adopt uniform scalar quantizers rather than vector quantizers, which are information-theoretically optimal. In this paper, we present a novel Lattice Vector Quantization scheme coupled with a spatially Adaptive Companding (LVQAC) mapping. LVQ can better exploit the inter-feature dependencies than scalar uniform quantization while being computationally almost as simple as the latter. Moreover, to improve the adaptability of LVQ to source statistics, we couple a spatially adaptive companding (AC) mapping with LVQ. The resulting LVQAC design can be easily embedded into any end-to-end optimized image compression system. Extensive experiments demonstrate that for any end-to-end CNN image compression models, replacing uniform quantizer by LVQAC achieves better rate-distortion performance without significantly increasing the model complexity. Code is available at: https://github.com/xzhang9308/LVQAC.
Xi Zhang, Xiaolin Wu
Shanghai Jiao Tong University · McMaster University
The rapid growth of visual data under stringent storage and bandwidth constraints makes extremely low-bitrate image compression increasingly important. While Vector Quantization (VQ) offers strong structural fidelity, existing methods lack a principled mechanism for joint rate-distortion (RD) optimization due to the disconnect between representation learning and entropy modeling. We propose RDVQ, a unified framework that enables end-to-end RD optimization for VQ-based compression via a differentiable relaxation of the codebook distribution, allowing the entropy loss to directly shape the latent prior. We further develop an autoregressive entropy model that supports accurate entropy modeling and test-time rate control. Extensive experiments demonstrate that RDVQ achieves strong performance at extremely low bitrates with a lightweight architecture, attaining competitive or superior perceptual quality with significantly fewer parameters. Compared with RDEIC, RDVQ reduces bitrate by up to 75.71% on DISTS and 37.63% on LPIPS on DIV2K-val. Beyond empirical gains, RDVQ introduces an entropy-constrained formulation of VQ, highlighting the potential for a more unified view of image tokenization and compression. The code will be available at https://github.com/CVL-UESTC/RDVQ.
Shiyin Jiang, Wei Long, Minghao Han +3
University of Electronic Science and Technology of China · The University of Newcastle, Australia
Scalar quantization of large language models (LLMs) is fundamentally limited by information-theoretic bounds. While vector quantization (VQ) overcomes these limits by encoding blocks of parameters jointly, practical implementations must avoid the need for expensive lookup mechanisms or other explicit codebook storage. Lattice approaches address this through highly structured and dense packing. This paper explores the Leech lattice, which, with its optimal sphere packing and kissing configurations at 24 dimensions, is the highest dimensional lattice known with such optimal properties. To make the Leech lattice usable for LLM quantization, we extend an existing search algorithm based on the extended Golay code construction, to i) support indexing, enabling conversion to and from bitstrings without materializing the codebook, ii) allow angular search over union of Leech lattice shells, iii) propose fully-parallelisable dequantization kernel. Lastly, we provide a geometric reinterpretation of combining shape--gain quantization with GPTQ-style Hessian corrections: the standard scale-correction step of shape--gain acts as a retraction onto a product of spheres, yielding a Spherical GPTQ primarily acting on directions. We find that low-angular-distortion LLVQ reduces sensitivity to Hadamard/rotation preprocessing, and enables a strong Hadamard-free PTQ in practice. LLVQ delivers state-of-the-art LLM quantization performance, outperforming recent methods such as Quip#, QTIP, and PVQ. The results highlight the effectiveness of high-dimensional lattices for scalable, theoretically grounded model compression.
Tycho F. A. van der Ouderaa, Mart van Baalen, Paul Whatmough +1