NeurIPS 2026Coming to NeurIPS in Sydney?Explore papers, orals & directions

Hybrid Compression for Memory-Efficient Matrix-Vector Multiplication

Felipe A. Louza, Giovanni Manzini, Guilherme P. TellesarXiv 2026

TL;DR

This paper introduces re-hybd, a hybrid compression strategy that enables efficient matrix-vector multiplication (MVM) directly on compressed data. By partitioning matrices into grammar-compressible and entropy-compressible components, the authors significantly reduce the memory footprint of large machine-learning matrices—especially dense ones with many unique values—while maintaining competitive computation speeds.

What Problem Does This Paper Address?

In modern machine learning, iterative algorithms (like gradient descent or power iteration) spend most of their time performing matrix-vector products. For massive matrices, the bottleneck isn't the processor's speed; it's memory bandwidth. Moving billions of real-valued entries from RAM to the CPU is slow and energy-intensive.

Lossless compression can help, but standard tools like gzip require you to decompress the entire matrix before you can use it, which defeats the purpose. The existing mm-RePair framework solved this by using grammar compression to allow math directly on the compressed format. However, mm-RePair has a "repetition" problem: it excels at sparse matrices with few distinct values but struggles with dense matrices or those containing millions of unique floating-point numbers (like word embeddings), where patterns rarely repeat.

Methods

The authors propose a multi-stage hybrid pipeline called re-hybd:

  1. Partitioning: The system analyzes the matrix's Compressed Sparse Row/Value (CSRV) sequence. If a pair of symbols appears more than twice, it is routed to the grammar component ($M_A$) to be compressed via RePair. Symbols that don't repeat enough to justify a grammar rule are routed to the entropy component ($M_B$).
  2. Entropy Coding: The $M_B$ component is encoded using ans-fold, an entropy coder designed for large alphabets.
  3. Ordered List Encoding (OLE): Because the order of entries within a CSR row doesn't affect the result of a multiplication, the authors sort the entries and use delta encoding. This turns large, absolute identifiers into small "gaps," which are much easier for the entropy coder to compress.
  4. Alphabet Remapping: If a matrix uses a sparse range of identifiers, the system remaps them to a contiguous range to save bits, provided a cost model predicts a net memory saving.
  5. Compressed Computation: Crucially, the MVM is performed as $Mx = M_Ax + M_Bx$. The grammar part uses the standard mm-RePair multiplication algorithm, while the entropy part is decoded on the fly during the dot product.

Datasets

The authors evaluated their method on ten real-valued matrices common in ML:

  • Sparse Matrices: airline78, census, covtype, imagenet, and mnist2m.
  • Dense/High-Entropy Matrices: glove (word embeddings), higgs, optical, pgsf (GPT-2 hidden states), and susy.
  • Quantized Variants: They also created six quantized versions of the glove matrix (from 64 to 64k levels) to specifically study how the number of distinct values impacts compression.

Key Insights and Ideas

  • The "Aha" Moment in Partitioning: The authors realized that forcing a grammar compressor to handle non-repetitive data is a waste of space. By siphoning off the "noise" into an entropy coder, the grammar for the remaining data becomes smaller and more efficient.
  • Exploiting Mathematical Invariance: The use of OLE (sorting + delta encoding) is a clever use of the fact that $a \cdot x + b \cdot y = b \cdot y + a \cdot x$. By reordering data to make it more compressible, they gain efficiency without changing the mathematical output.
  • Direct Stream Processing: The system never reconstructs the original matrix in memory. It treats the compressed data as a stream, performing the multiplication as it decodes, which keeps the "peak memory" usage very low.

Key Results

  • Superior Compactness: re-hybd was more compact than the original mm-RePair on every single test case.
  • Massive Gains on Dense Data: On the susy matrix (which has over 20 million distinct values), re-hybd reduced the compressed size from 66.6% to 57.1% of the original dense matrix size.
  • Memory Efficiency: Peak memory during multiplication was reduced by up to 26.1% (on the pgsf dataset) compared to the previous state-of-the-art.
  • Scalability: The hybrid approach scales linearly with thread count, matching the parallel performance of the original mm-RePair while maintaining a smaller memory footprint.

Limitations and Future Work

  • The Value Array Bottleneck: While the structure of the matrix is compressed, the V array (the actual floating-point values) remains uncompressed. In matrices with millions of unique values, this array itself becomes a significant portion of the memory footprint.
  • Compression Time: When combined with column reordering (the re-hybd-pc variant), compression can take a very long time (hours or even days for the largest matrices), making it best suited for "write-once, read-many" scenarios.
  • GPU Integration: The current implementation is CPU-based. The authors suggest that a GPU-friendly version of the entropy decoder could further accelerate performance.

Summary updated

Abstract

Iterative machine-learning algorithms repeatedly access large real-valued matrices through matrix-vector products, and their performance is limited by memory bandwidth rather than arithmetic throughput. Lossless compression schemes that support computation directly over the compressed data reduce both the data moved and the memory footprint of these workloads. The mm-RePair framework [11] follows this approach by applying the RePair grammar compressor to the Compressed Sparse Row/Value (CSRV) representation of a matrix and performing matrix-vector multiplications directly on the compressed data. Its effectiveness, however, degrades on matrices that are dense or contain many distinct values. In this paper we present a hybrid strategy for the mm-RePair framework that combines grammar and entropy compression. The CSRV sequence is partitioned into a grammar-compressible component, formed by the entries that mm-RePair can compress effectively, and an entropy-compressible component holding the remaining entries, which is encoded with the ans-fold coder [24]. Compression improves further by sorting and delta encoding the entries of each row in the CSRV representation, and by remapping the alphabet to a contiguous range. Experiments on real-valued machine-learning matrices, including word embeddings and transformer hidden states, show that our hybrid strategy is more compact than the original \mmRepair on every input and reduces the peak memory of multiplication, with the largest gains on dense matrices with many distinct values, at competitive multiplication times. It also outperforms the column-reordering variant of \mmRepair on most of the matrices, and combining the two is even more compact on the sparse ones, at the cost of a much longer compression time. Finally, our strategy scales with the number of threads as well as the original \mmRepair does.
BibTeX
@misc{louza2026hybrid,
  author = {Felipe A. Louza and Giovanni Manzini and Guilherme P. Telles},
  title = {{Hybrid Compression for Memory-Efficient Matrix-Vector Multiplication}},
  year = {2026},
  eprint = {2611.18792},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.18792},
}
Figure