Tensor Contraction Layers for Parsimonious Deep Nets

Jean Kossaifi, Aran Khanna, Zachary Chase Lipton, Tommaso Furlanello, Anima Anandkumar

Introduction

Deep convolutional neural networks (CNNs) have achieved state-of-the-art performance in various computer vision tasks. However, architectures like AlexNet and VGG suffer from significant parameter bloat, primarily due to their large fully-connected (FC) layers. In these models, the final convolutional layer outputs a multi-dimensional activation tensor (e.g., height $\times$ width $\times$ channels), which is typically flattened into a 1D vector before being fed into dense FC layers.

This flattening process has two major drawbacks. First, it destroys the inherent spatial and multi-dimensional structural information of the activations. Second, FC layers scale multiplicatively with the input size, often accounting for over 80% of a network's total parameters. This makes deploying such models on resource-constrained devices challenging.

The Tensor Contraction Layer (TCL)

To address these issues, this paper introduces the Tensor Contraction Layer (TCL). Instead of flattening the activation tensor immediately, the TCL applies tensor contractions—specifically $n$-mode products—directly to the multi-dimensional input.

The TCL projects an input tensor into a lower-dimensional space using learnable projection matrices for each mode.

The TCL projects each dimension of the input tensor into a lower-dimensional space using a set of learnable projection matrices. Unlike FC layers, where the parameter count is the product of input dimensions and hidden units, a TCL’s parameter count is the sum of the parameters in its individual projection matrices. This shift from multiplicative to additive scaling is the primary driver of the massive compression rates observed. The TCL is fully differentiable and can be integrated into existing architectures using standard backpropagation.

Experimental Results

The authors evaluated the TCL on CIFAR-100 and ImageNet datasets using modified AlexNet and VGG-19 architectures. The experiments focused on two configurations: adding a TCL as a bottleneck before FC layers and replacing FC layers with TCLs entirely.

Performance of AlexNet on CIFAR-100 with various TCL configurations, showing significant space savings with minimal accuracy loss.

On CIFAR-100 with AlexNet, adding a TCL before the FC layers reduced parameters by 74.49% while improving accuracy from 65.41% to 66.57%. Replacing both FC layers with TCLs achieved a staggering 98.64% space savings with only a minor drop in accuracy. Similar results were observed for VGG-19, where replacing FC layers yielded a 98.43% parameter reduction. Preliminary results on ImageNet also showed that replacing the first FC layer in AlexNet could save 35.49% of parameters while slightly boosting Top-1 accuracy.

Key Insights and Future Work

The TCL acts as a powerful structural regularizer by forcing the network to compress data along its natural axes. This preserves spatial priors and helps the network learn more compact representations.

While the TCL drastically reduces parameter counts, current implementations face computational bottlenecks due to memory transpositions required for tensor contractions. Future work aims to leverage optimized BLAS primitives to eliminate these overheads. Additionally, the authors plan to explore sparsity within TCLs and develop "tensor regression layers" to further minimize the parameter footprint of the final classification stages.

Summary updated

BibTeX
@misc{kossaifi2017tensor,
  author = {Jean Kossaifi and Aran Khanna and Zachary Chase Lipton and Tommaso Furlanello and Anima Anandkumar},
  title = {{Tensor Contraction Layers for Parsimonious Deep Nets}},
  year = {2017},
  eprint = {1706.00439},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1706.00439},
}
Figure