Compressing Neural Networks Using Tensor Networks with Exponentially Fewer Variational Parameters

Yong Qing, Pengfei Zhou, Ke Li, Shi-Ju Ran · DOI

Abstract

Neural network (NN) designed for challenging machine learning tasks is in general a highly nonlinear mapping that contains massive variational parameters. High complexity of NN, if unbounded or unconstrained, might unpredictably cause severe issues including overfitting, loss of generalization power, and unbearable cost of hardware. In this work, we propose a general compression scheme that significantly reduces the variational parameters of NN's, despite of their specific types (linear, convolutional, etc), by encoding them to deep automatically differentiable tensor network (ADTN) that contains exponentially-fewer free parameters. Superior compression performance of our scheme is demonstrated on several widely-recognized NN's (FC-2, LeNet-5, AlextNet, ZFNet and VGG-16) and datasets (MNIST, CIFAR-10 and CIFAR-100). For instance, we compress two linear layers in VGG-16 with approximately $10^{7}$ parameters to two ADTN's with just 424 parameters, improving the testing accuracy on CIFAR-10 from $90.17\%$ to $91.74\%$. We argue that the deep structure of ADTN is an essential reason for the remarkable compression performance of ADTN, compared to existing compression schemes that are mainly based on tensor decompositions/factorization and shallow tensor networks. Our work suggests deep TN as an exceptionally efficient mathematical structure for representing the variational parameters of NN's, which exhibits superior compressibility over the commonly-used matrices and multi-way arrays.

Introduction

As neural networks (NNs) scale toward trillions of parameters, they encounter significant bottlenecks in hardware costs and energy consumption. Furthermore, massive, unconstrained parameter spaces often lead to overfitting, where models memorize training data but fail to generalize. While existing compression techniques like pruning and shallow tensor decompositions (e.g., Matrix Product States) offer some relief, they often struggle to maintain accuracy at extreme compression levels. This research introduces Automatically Differentiable Tensor Networks (ADTN), a method that represents NN weights as deep, multi-layered tensor contractions, achieving staggering compression ratios while frequently improving model accuracy.

Methodology

The ADTN scheme encodes weight tensors into a "brick-wall" structure of small, interconnected tensors (typically $2 \times 2 \times 2 \times 2$). Unlike standard "shallow" tensor methods, ADTN utilizes multiple layers ($M$) and, crucially, inserts non-linear activation functions like ReLU between these layers. This design mimics the architecture of a deep neural network within the weight representation itself, allowing it to capture complex features more effectively than traditional linear decompositions.

The ADTN architecture encodes a weight tensor into a deep, multi-layered structure with non-linear activations.

Optimization follows a two-stage process:

  1. Pre-training: The ADTN is trained to minimize the Euclidean distance between its output and the original "teacher" weights.
  2. Fine-tuning: The entire system is trained end-to-end, allowing compressed weights to adapt to the specific task data.

The authors also identified "backward compression"—compressing layers starting from the output and moving toward the input—as a more stable and effective strategy than forward approaches.

Key Results and Insights

The quantitative results are striking. On the CIFAR-10 dataset using VGG-16, two linear layers containing roughly 18.8 million parameters were compressed into ADTNs with just 424 parameters. Despite this $44,000\times$ reduction, testing accuracy actually increased from 90.17% to 91.74%. This suggests that ADTN acts as a powerful regularizer, stripping away noise and refining the model's degrees of freedom to prevent overfitting.

Performance comparison between ADTN and MPO shows ADTN's superior accuracy at high compression ratios.

As illustrated in the comparison with Matrix Product Operators (MPO), ADTN consistently maintains higher accuracy ($\eta$) as the inverse compression ratio ($1/\rho$) increases. This highlights the "Deep Advantage": deep tensor networks can represent much denser information and higher entanglement than shallow ones, allowing for a transition from exponential $O(2^Q)$ to linear $O(MQ)$ parameter complexity.

Conclusion

ADTN provides a robust framework for extreme model compression by treating weight representation as a deep learning problem. While the current "decoding" process (contracting the tensor network) adds some computational overhead during inference, the method's ability to maintain generalization at extreme compression ratios is a significant step forward. Future work aims to integrate tensor contraction directly into NN inference to optimize computational efficiency and speed.

Summary updated

BibTeX
@misc{qing2023compressing,
  author = {Yong Qing and Pengfei Zhou and Ke Li and Shi-Ju Ran},
  title = {{Compressing Neural Networks Using Tensor Networks with Exponentially Fewer Variational Parameters}},
  year = {2023},
  eprint = {2305.06058},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.06058},
}
Figure