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

Linear Computation Coding: A Framework for Joint Quantization and Computing

Ralf Reiner Müller, Bernhard Gäde, Ali BereyhiAlgorithms 2022 · DOI

TL;DR

This paper introduces "computation coding," a novel framework for efficiently computing linear functions, particularly matrix-vector multiplications, by jointly quantizing and computing. It offers a significant reduction in computational cost (additions and bit shifts) for applications like deep neural network inference, achieving accuracy comparable to 16-bit fixed-point arithmetic with far fewer resources.

What Problem Does This Paper Address?

The inference phase of deep neural networks (DNNs) heavily relies on matrix-vector multiplications, which are computationally expensive. While advancements in hardware like stacked DRAM and non-volatile memories address memory access bottlenecks, the core computation remains a challenge, especially for low-energy devices. Existing methods for simplifying these operations often rely on matrix structures (like sparsity) or specific algorithms (like CSD), which can limit flexibility, hinder independent training and inference, or not scale well. This paper aims to provide a general, efficient, and flexible method for accelerating matrix-vector multiplications without requiring specific matrix structures.

Methods

The core of the paper is the introduction of computation coding, a concept analogous to rate-distortion theory in data compression but applied to function computation. For linear functions (matrix-vector products), they propose decomposing a target matrix $T$ into a product of a codebook matrix $B$ and one or more wiring matrices $W$, such that $T = BW$. The key idea is that the entries of $B$ and $W$ are restricted to be zero or signed powers of two. This allows for efficient computation using only additions and bit shifts, avoiding costly multipliers.

They introduce a greedy wiring algorithm that iteratively refines the wiring matrix to minimize distortion while adhering to a computational cost constraint. The algorithm is designed to be recursive, allowing for multiple wiring matrices to achieve higher accuracy. They also explore various codebook designs (Binary Mailman, Two-Sparse, Self-Designing) and discuss the importance of aspect ratio (wide or tall matrices) for performance.

Datasets

Not discussed in the paper. The paper focuses on theoretical analysis and simulation using synthetic data (IID Gaussian random vectors and matrices) rather than specific real-world datasets.

Key Insights and Ideas

  • Computation Coding: The fundamental idea of treating function computation as a lossy compression problem, where the "distortion" is the approximation error and the "rate" is the computational cost, is a powerful new perspective.
  • Joint Quantization and Computing: By restricting matrix entries to powers of two and using a codebook/wiring matrix decomposition, the paper elegantly combines quantization and computation, leading to significant hardware savings.
  • Exponential Aspect Ratio is Key: The paper highlights that for efficient decomposition, codebook matrices should have an exponential aspect ratio (either very wide or very tall). This is crucial for achieving significant computational savings.
  • Greedy Wiring Algorithm: This iterative approach effectively finds a good approximation of the target matrix using the restricted set of operations, demonstrating practical applicability.
  • Codebook Evolution: The concept of using previous approximations as codebooks for subsequent steps can be beneficial, especially when the target matrix itself is a good codebook.

Key Results

  • The proposed method significantly reduces the number of additions required for matrix-vector multiplication compared to traditional methods like Booth's CSD representation. For example, for a 4096x512 matrix, they achieve savings of 77% and 71% compared to CSD for 96 dB SQNR.
  • The computational cost per matrix entry vanishes with increasing matrix size, a stark contrast to state-of-the-art methods where it remains constant.
  • They demonstrate that achieving 16-bit signed integer arithmetic accuracy for 4k-vectors requires only about 1.5 adders per matrix entry, with no multipliers needed.
  • Simulations show that the greedy wiring approach performs well, and the choice of codebook has a noticeable but not overwhelming impact, especially with codebook evolution.

Limitations and Future Work

  • Hardware Implementation Details: While the paper focuses on the algorithmic and theoretical aspects, details on implementing these techniques on specific hardware (like FPGAs) are left for future work, though preliminary results are promising.
  • Nonlinear Functions: The current work focuses on linear functions. The authors suggest that extending computation coding to multidimensional nonlinear functions could lead to even greater computational cost reductions in neural networks.
  • Adaptive CSD: The paper mentions that adaptive assignments of CSD digits could further improve performance, which is not directly incorporated into their proposed method.
  • Combinatorial Complexity: Some aspects of the optimization problem (e.g., finding the optimal wiring matrix) are combinatorial and NP-hard, necessitating practical approximation algorithms like greedy wiring.

Summary updated

BibTeX
@article{muller2022linear,
  author = {Ralf Reiner Müller and Bernhard Gäde and Ali Bereyhi},
  title = {{Linear Computation Coding: A Framework for Joint Quantization and Computing}},
  journal = {Algorithms},
  year = {2022},
  doi = {10.3390/a15070253},
}
Figure