MARS: Masked Automatic Ranks Selection in Tensor Decompositions

Maxim Kodryan, Dmitry Kropotov, Dmitry P. Vetrov

Abstract

Tensor decomposition methods have proven effective in various applications, including compression and acceleration of neural networks. At the same time, the problem of determining optimal decomposition ranks, which present the crucial parameter controlling the compression-accuracy trade-off, is still acute. In this paper, we introduce MARS - a new efficient method for the automatic selection of ranks in general tensor decompositions. During training, the procedure learns binary masks over decomposition cores that “select” the optimal tensor structure. The learning is performed via relaxed maximum a posteriori (MAP) estimation in a specific Bayesian model and can be naturally embedded into the standard neural network training routine. Diverse experiments demonstrate that MARS achieves better results compared to previous works in various tasks.

Introduction

Deep Neural Networks (DNNs) are often massive, making them difficult to deploy on edge devices with limited memory and power. Tensor decomposition is a popular solution: it breaks down large weight matrices into smaller "core" tensors, significantly reducing the number of parameters.

However, these decompositions rely on a crucial hyperparameter: the rank. The rank determines the size of the core tensors; too high, and memory savings are negligible; too low, and the model's accuracy drops significantly. Finding the optimal rank for every layer in a complex network is an NP-hard discrete optimization problem. Most researchers resort to setting all ranks to a uniform value, which is rarely optimal. MARS (Masked Automatic Ranks Selection) addresses this by treating rank selection as a learning problem integrated into standard training.

Methodology: Masked Automatic Ranks Selection

MARS eliminates the need for manual hyperparameter tuning by learning binary masks over decomposition cores. The method is built on several key pillars:

  1. Binary Masking: MARS places binary masks ($0$ or $1$) over the slices of the decomposition cores. If a mask element is $0$, that slice is effectively "deleted," reducing the rank of that dimension.
The MARS masking process: a binary mask $m_k$ selects specific slices of the core tensor $\mathcal{G}$ to determine the effective rank.
  1. Bayesian Framework: The authors formulate rank selection as a Maximum A Posteriori (MAP) estimation problem. They use a factorized Bernoulli prior to encourage sparsity (more zeros in the masks), driving the model toward lower-rank solutions.
  2. Differentiable Relaxation: Since binary masks are discrete and cannot be optimized via gradient descent, MARS uses the Binary Concrete relaxation (Gumbel-Softmax trick). This "softens" the masks during training, allowing the model to learn which ranks are important using standard backpropagation.
  3. End-to-End Training: Unlike previous methods requiring multi-stage "decompose-then-fine-tune" cycles, MARS operates end-to-end, training the model weights and the ranks simultaneously.

Experimental Results and Insights

The authors evaluated MARS on a diverse set of benchmarks, including MNIST, sentiment analysis (IMDB, SST), and CIFAR-10 with ResNet-110.

Key Insights

  • Non-Uniformity is Key: Experiments confirm that uniform rank assignment is highly inefficient. MARS consistently finds non-uniform rank distributions that outperform uniform baselines.
Visualization of learned mask parameters $\phi$, illustrating the sparsity and non-uniformity of the selected ranks across different masks.
  • Hierarchical Importance: In embedding layers, MARS discovered that the first few cores in a sequence are more critical for capturing information, leading to an "escalating" rank distribution.
  • Generality: MARS is a general-purpose scheme applicable to any decomposition (Tucker, CP, TT, etc.), unlike many previous methods tied to specific types like Tensor Train.

Performance Highlights

  • Extreme Compression: On MNIST, MARS achieved over 200× compression while maintaining 97.9% accuracy. For sentiment analysis on IMDB, it reached 559× compression with 90.1% accuracy, surpassing previous state-of-the-art results.
  • Real-World Speedup: On LeNet-5, MARS achieved a 1.2× inference speedup by selecting hardware-friendly ranks.
  • Scalability: On CIFAR-10, MARS compressed a ResNet-110 by 7× with only a minor drop in accuracy, proving its effectiveness for deep architectures.

Conclusion

MARS provides a robust framework for automatic rank selection, significantly improving the efficiency of tensor-compressed neural networks. While the current version utilizes MAP estimation, future work could explore full Variational Inference or alternative discrete optimization algorithms like REINFORCE. The success of MARS in neural network compression suggests its potential applicability to other domains involving low-rank tensor approximations, such as signal processing and physics simulations.

Summary updated

BibTeX
@inproceedings{kodryan2023mars,
  author = {Maxim Kodryan and Dmitry Kropotov and Dmitry P. Vetrov},
  title = {{MARS: Masked Automatic Ranks Selection in Tensor Decompositions}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2023},
  url = {https://openreview.net/forum?id=k8aQhReYON},
}
Figure