Coding for Computation: Efficient Compression of Neural Networks for Reconfigurable Hardware

Hans Rosenberger, Rodrigo Fischer, Johanna S. Fröhlich, Ali Bereyhi, Ralf R. Müller

Abstract

The deployment of deep neural networks on resource-constrained reconfigurable hardware, such as FPGAs, is often hindered by computational bottlenecks rather than just memory limitations. This paper introduces a comprehensive compression pipeline designed to minimize the number of addition operations required during inference. By combining structured pruning via Group Lasso, weight sharing through affinity propagation, and Linear Computation Coding (LCC), the proposed pipeline achieves a 2x reduction in additions for ResNet-34 on TinyImageNet without accuracy loss. This work highlights the critical synergy between structured sparsity and algorithmic computation coding for hardware-efficient AI.

Introduction

As neural network architectures grow in complexity, their deployment on edge devices and reconfigurable hardware becomes increasingly challenging. Traditional compression techniques, such as quantization and unstructured pruning, primarily focus on reducing the memory footprint. However, in hardware accelerators like FPGAs, the actual bottleneck is often the arithmetic computation itself.

In quantized networks, matrix-vector products are reduced to additions, subtractions, and multiplications by powers of two. Since multiplications by powers of two can be implemented as computationally "free" bitshifts in hardware, the primary cost of inference lies in the additions. This research addresses this challenge by proposing a method to identify and eliminate both unnecessary weights and redundant sub-computations, strictly reducing the number of additions required for inference.

Methodology: A Three-Stage Compression Pipeline

The proposed framework utilizes a synergistic three-stage process to optimize neural networks for hardware efficiency.

1. Structured Pruning via Group Lasso

Standard $L_1$ regularization typically results in unstructured sparsity, where individual weights are dropped randomly. While this reduces parameter count, it creates sparse matrices that are difficult for downstream coding algorithms to process efficiently. To combat this, the authors employ Group Lasso regularization to enforce structured pruning. By dropping entire columns or filters, the remaining weight matrices remain dense but are reshaped into "tall" and "narrow" configurations, which are ideal for Linear Computation Coding.

2. Weight Sharing

Following the pruning stage, the authors apply an affinity propagation clustering algorithm to identify highly correlated columns within the weight matrices. These similar columns are then tied to a single shared centroid through a retraining procedure. This step further reduces the effective size of the matrix and prepares the weights for the final coding stage.

3. Linear Computation Coding (LCC)

LCC serves as the core engine of the compression scheme. It factors the weight matrices into sparse matrices containing only zeros and signed powers of two. This factorization allows the system to identify common sub-expressions in matrix-vector products—for example, computing a sum once and reusing it across multiple operations. This effectively replaces expensive additions with cheap bitshifts. The authors evaluated two variants of LCC:

  • Fully Parallel (FP): Designed for maximum parallelization on FPGAs.
  • Fully Sequential (FS): Optimized for sequential processing.

To extend this approach to Convolutional Neural Networks (CNNs), the authors developed methods to reshape 3D convolutional kernels into 2D matrix-vector products compatible with LCC.

Experimental Results

The effectiveness of the pipeline was evaluated using two primary benchmarks: MNIST for simple Multilayer Perceptrons (MLP) and TinyImageNet for complex ResNet-34 architectures.

  • MLP on MNIST: The combination of regularized training, weight sharing, and LCC improved the compression ratio (measured by the reduction in additions) by up to 50% compared to applying LCC in isolation.
  • ResNet-34 on TinyImageNet: For this large-scale computer vision task, the Fully Sequential (FS) LCC algorithm achieved a 2x reduction in additions while maintaining the baseline prediction accuracy of approximately 57%.

Algorithm Performance Comparison

A key finding was the performance difference between the FP and FS algorithms. While the Fully Parallel (FP) algorithm is theoretically advantageous for FPGA parallelization, it yielded only marginal gains on the ResNet-34 architecture. Because the preceding regularization and pruning stages already significantly reduced the matrix sizes, the matrices became too small for the FP algorithm to find and exploit parallel redundancies effectively. In contrast, the FS algorithm proved much more robust for these heavily compressed deep networks.

Key Insights

The research highlights several critical takeaways for hardware-aware model compression:

  • Compute vs. Memory: Optimizing for storage does not inherently optimize for computation. By targeting addition operations directly, researchers can create models that are significantly more hardware-friendly.
  • The Necessity of Structured Sparsity: Algorithmic computation coding relies on finding patterns within matrices. Structured pruning is a prerequisite for LCC to function effectively, as random sparsity disrupts these patterns.
  • Synergistic Optimization: The three stages—pruning, sharing, and coding—are not merely additive. Pruning and sharing actively reshape the weight matrices into the specific "exponential aspect ratios" where LCC algorithms perform optimally.

Limitations and Future Work

While the proposed method shows significant promise, it is currently focused strictly on reducing additions within matrix-vector products. It does not yet account for the computational costs associated with non-linear activation functions or other auxiliary network operations. Additionally, the Fully Parallel LCC algorithm's performance degradation on small matrices suggests a need for more adaptive coding strategies. Future research may explore alternative ways to restructure convolutional layers to further enhance the efficiency of LCC-based compression.

Summary updated

BibTeX
@inproceedings{rosenberger2025coding,
  author = {Hans Rosenberger and Rodrigo Fischer and Johanna S. Fröhlich and Ali Bereyhi and Ralf R. Müller},
  title = {{Coding for Computation: Efficient Compression of Neural Networks for Reconfigurable Hardware}},
  booktitle = {SSP},
  year = {2025},
  doi = {10.1109/ssp64130.2025.11073129},
}
Figure