Structured adaptive and random spinners for fast machine learning computations

Mariusz Bojarski, Anna Choromanska, Krzysztof Choromanski, Francois Fagan, Cédric Gouy-Pailler, Anne Morvan, Nourhan Sakr, Tamás Sarlós, Jamal Atif

Abstract

We consider an efficient computational framework for speeding up several machine learning algorithms with almost no loss of accuracy. The proposed framework, termed "Structured Spinners," relies on projections via structured matrices that decompose into three specific rotational blocks. This approach reduces computational complexity from $O(mn)$ to $O(n \log m)$ and significantly cuts memory usage. We provide the first comprehensive theoretical guarantees for these transforms, explaining their efficacy in both randomized and adaptive settings.

1. Introduction

Linear projections of high-dimensional data are fundamental to many machine learning algorithms. In randomized settings, such as random feature maps for kernel approximation or Locality-Sensitive Hashing (LSH), data is typically projected using dense matrices of Gaussian noise. In deep learning, these projections correspond to the learned weight matrices of fully connected layers. However, computing these projections requires $O(mn)$ time and space, creating a significant bottleneck for high-dimensional applications.

While structured matrices (e.g., circulant matrices, Fastfood transform) have been proposed to mitigate this, a unified theoretical framework explaining their success has been lacking. This work addresses this gap by introducing Structured Spinners and providing rigorous theoretical validation for their performance.

2. Methods: The Structured Spinner Framework

The core of our approach is the replacement of a standard dense matrix $G$ with a structured matrix $G_{struct} = M_3 M_2 M_1$. This decomposition utilizes three blocks, each serving a specific geometric purpose:

  1. Balancing ($M_1$): This block rotates the input vector to ensure its magnitude is evenly distributed across all dimensions, preventing any single dimension from dominating.
  2. Orthogonalizing ($M_2$): This stage transforms vectors so that their images are near-orthogonal in random settings or independent in adaptive settings.
  3. Capacity ($M_3$): This block defines the transform's capacity using a vector of parameters—either random (Rademacher/Gaussian) or learned (neural network weights).
Geometric transformation of vectors under the spinner framework, illustrating the orthogonalizing and balancing effects of the matrix blocks.

By leveraging structured operations like the Fast Walsh-Hadamard Transform, the computational complexity is reduced to $O(n \log m)$. We employ Berry-Esseen type Central Limit Theorems to prove that these structured spinners asymptotically match the distributional behavior of true random Gaussian matrices.

3. Key Insights and Theoretical Results

The $M_3 M_2 M_1$ architecture generalizes various previously proposed structured matrices, such as Deep Fried Convnets. A key contribution is the first rigorous theoretical guarantee for the $HD_3HD_2HD_1$ matrix (where $H$ is a Hadamard matrix and $D$ are diagonal matrices), which is central to the fastest known cross-polytope LSH algorithms.

Illustration of angular preservation and capacity in the structured spinner framework, showing how geometric relationships between vectors are maintained.

In the context of deep learning, structured spinners allow for massive model compression. Since the Hadamard matrix is deterministic, the number of learned parameters for a layer is reduced from $O(input \times output)$ to $O(output)$, drastically lowering memory requirements while preserving network capacity.

4. Experimental Evaluation

We evaluated the framework across several tasks and datasets:

  • Kernel Approximation: On the G50C and USPST datasets, the $HD_3HD_2HD_1$ spinner achieved up to a 316.8x speedup over standard matrices for Gaussian kernel approximation with $2^{15}$ features, maintaining identical reconstruction error.
  • Neural Network Acceleration: Replacing dense layers in an MLP on MNIST reduced hidden layer computation time from 2317.4 \mu s to 389.8 \mu s for a size of $2^{12}$, with no impact on test error.
  • LSH Accuracy: Collision probabilities for cross-polytope LSH using structured spinners perfectly matched theoretical Gaussian curves, confirming that speed gains do not compromise hashing quality.

5. Conclusion

Structured Spinners offer a theoretically sound and computationally efficient alternative to dense projections in machine learning. By reducing complexity to $O(n \log m)$ and significantly compressing model size, they enable the scaling of high-dimensional algorithms to larger datasets and more complex architectures.

Summary updated

BibTeX
@inproceedings{bojarski2017structured,
  author = {Mariusz Bojarski and Anna Choromanska and Krzysztof Choromanski and Francois Fagan and Cédric Gouy-Pailler and Anne Morvan and Nourhan Sakr and Tamás Sarlós and Jamal Atif},
  title = {{Structured adaptive and random spinners for fast machine learning computations}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2017},
  url = {https://openreview.net/forum?id=tt5E5wnw2vT},
}
Figure