Tensorizing Neural Networks

Alexander Novikov, Dmitry Podoprikhin, Anton Osokin, Dmitry P. Vetrov

Introduction

Deep neural networks currently demonstrate state-of-the-art performance across several domains, but they are notoriously demanding in terms of computational resources. A primary culprit for this "memory wall" is the fully-connected (FC) layer. In architectures like VGG-16, FC layers can account for over 90% of the total network parameters. This massive memory footprint makes it difficult to deploy state-of-the-art models on mobile devices or low-end hardware, and it bottlenecks the further scaling of model sizes.

While previous research has attempted to solve this using low-rank matrix approximations (like SVD) or weight hashing, these methods often hit a ceiling: they either sacrifice too much accuracy or fail to provide sufficient compression. This paper introduces the TT-layer, a replacement for the standard fully-connected layer that represents weight matrices using the Tensor Train (TT) format. By treating weights as high-dimensional tensors rather than flat 2D matrices, the authors achieve staggering compression—reducing the parameters of a single VGG network layer by up to 200,000x with minimal impact on accuracy.

Methods: The Tensor Train Layer

The core innovation of this paper is "tensorizing" the weight matrix $W$ of an FC layer to exploit multi-dimensional redundancies.

  1. Tensor Train (TT) Format: Instead of storing a massive $M \times N$ matrix, the authors reshape the input and output dimensions into multi-dimensional tensors. The weight matrix is then represented as a sequence of small, 3D "cores." By doing this, the total number of parameters scales linearly with the number of dimensions rather than as the product of the dimensions.
  2. The TT-Layer: A new layer is defined where the forward pass (matrix-vector multiplication) is performed directly within the compressed TT-format. Consequently, the massive uncompressed weight matrix is never actually reconstructed in memory.
  3. Training from Scratch: Crucially, the authors derive the exact gradients for these TT-cores. This allows a "TensorNet" to be trained end-to-end using standard backpropagation and stochastic gradient descent, just like a normal network.
Theoretical time and memory complexity for standard fully-connected (FC) and Tensor Train (TT) layers.

As shown in the complexity analysis, the forward and backward passes in a TT-layer scale with the (typically small) TT-rank $r$, making it highly efficient for very large dimensions compared to the standard $O(MN)$ complexity of FC layers.

Key Insights

  • The Power of Multi-Dimensionality: Standard low-rank approximations are inherently "2D." By moving to the TT-format—essentially a high-dimensional generalization of low-rank factorization—the network can exploit much deeper structural redundancies in the weights.
  • Enabling "Impossible" Architectures: Because TT-layers are incredibly parameter-efficient, researchers can build "wide and shallow" networks with an astronomical number of hidden units. For the CIFAR-10 dataset, the authors trained a model with 262,144 hidden units. A standard FC layer of this size would require roughly 270GB of RAM, but it fits easily in memory as a TT-layer.
  • Inference Speedup: On a CPU, the TT-layer proved significantly faster (up to 10x) than a standard FC layer because it avoids the massive memory bandwidth overhead required to load a giant weight matrix.

Key Results

The researchers evaluated their approach on standard benchmarks including MNIST, CIFAR-10, and ImageNet (using VGG-16 and VGG-19 architectures).

Compression factors and accuracy metrics for VGG-16 and VGG-19 architectures using TT-layers versus standard and low-rank (MR) approximations.
  • Extreme VGG Compression: On ImageNet, the authors compressed the largest FC layer of VGG-16 by a factor of 194,622 (see the TT2 FC FC row). This reduced the total size of the entire VGG-16 network by nearly 4x while only increasing the top-5 error by a marginal 0.3% (from 11.2% to 11.5%). In their most aggressive setup, they achieved a 7x total network compression for VGG-19.
  • Outperforming Baselines: On MNIST, a TensorNet with ~7,700 parameters achieved a 1.9% error rate, significantly outperforming the HashedNet baseline (2.79% error with ~12,700 parameters).
  • Memory Footprint: For a massive layer ($25088 \times 4096$), the memory required for a single forward pass dropped from 392 MB (standard) to just 0.766 MB (TT-layer).

Limitations and Future Work

While highly effective, the TT-layer approach does have limitations. The performance depends heavily on how the input and output vectors are reshaped into tensors (e.g., $32 \times 32$ versus $4 \times 8 \times 8 \times 4$). Currently, this dimension factorization is a manual hyperparameter.

Furthermore, this paper focuses almost entirely on FC layers. While FC layers dominate parameter counts, convolutional layers are often the most computationally expensive. The authors note that similar tensorization ideas can be applied to convolutions, suggesting a natural combination of the two. Ultimately, future work could involve keeping the inputs and outputs of every layer in the TT-format, eliminating the need to ever "un-tensorize" the data and potentially paving the way for networks with billions of hidden units.

Summary updated

BibTeX
@inproceedings{novikov2015tensorizing,
  author = {Alexander Novikov and Dmitry Podoprikhin and Anton Osokin and Dmitry P. Vetrov},
  title = {{Tensorizing Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2015},
  url = {https://openreview.net/forum?id=rk-RcdWd-S},
}
Figure