Differentiable Learning of Generalized Structured Matrices for Efficient Deep Neural Networks

Changwoo Lee, Hun-Seok Kim

TL;DR

Researchers have developed Gaudi-GBLR, a framework that allows neural networks to automatically learn the most efficient "shape" for their weight matrices during training. By making structural properties like block width and location differentiable, they can compress models like Vision Transformers and GPT-2 by over 60% while maintaining—or even improving—performance compared to standard dense models.

What Problem Does This Paper Address?

Deep Learning is currently in an "arms race" of scale. As models like Large Language Models (LLMs) and Vision Transformers (ViTs) grow to billions of parameters, the computational cost of the dense matrix multiplications at their core becomes a massive bottleneck for deployment.

To solve this, researchers often use structured matrices—mathematical formats like "low-rank" or "block-sparse" that require fewer multiplications. However, there are two major problems with this approach:

  1. Manual Design: Choosing which structure to use (e.g., "Should this layer be low-rank or sparse?") is currently a manual, trial-and-error process.
  2. Disjoint Formats: Existing structures are "islands." You cannot easily blend a sparse matrix with a low-rank one because they are defined using different, non-differentiable discrete parameters.

The authors ask a fundamental question: Can we create a single, universal format that encompasses all these structures and learn the optimal configuration automatically using gradient descent?

Methods

The paper introduces two major innovations to achieve this goal:

1. Generalized Block-Low-Rank (GBLR)

The authors propose a unified matrix format where a large matrix is represented as a sum of multiple rank-1 blocks. By varying the width, height, and location of these blocks, and allowing them to overlap, the GBLR format can represent low-rank, block-sparse, and block-low-rank matrices within a single mathematical framework.

Comparison of structured matrices including the proposed GBLR format.

2. The "Gaudi" Mask (Gaussian-Dirichlet)

The hardest part of learning a matrix "structure" is that the parameters—like where a block starts ($l$) and how wide it is ($w$)—are discrete. You cannot take a gradient of a "boxcar" (rectangular) mask.

To fix this, the authors move to the frequency domain. They use the Dirichlet kernel (the Fourier transform of a rectangular pulse) to parameterize the mask. They then apply Gaussian smoothing to make the edges of the mask "soft." This resulting Gaussian-Dirichlet (Gaudi) function is fully differentiable.

During training, the model uses gradient descent to "slide" these blocks around and "stretch" them to the optimal size. As training progresses, the smoothing is reduced until the blocks become sharp, discrete structures ready for efficient inference.

The Gaudi-GBLR framework during and after training.

Key Insights and Ideas

  • Structure as a Learnable Parameter: Instead of a human deciding that a specific layer should be sparse, the model decides based on the data. The authors found that different layers in a Transformer naturally "want" different amounts of complexity.
  • The Power of Overlap: By allowing rank-1 blocks to overlap, the model can create "high-rank regions" only where they are needed, rather than forcing a uniform rank across the whole matrix.
  • Compression as Regularization: Surprisingly, in the language task (GPT-2), the structured GBLR model actually achieved lower perplexity (better performance) than the dense baseline. This suggests that learning the right structure acts as a form of beneficial regularization, stripping away "noise" in the weights.
  • Automatic Budgeting: Using an $\ell_1$ penalty on the block widths, the framework automatically allocates more "computational budget" to important layers (like the "Value" projections in Attention) and less to others.

Key Results

The authors evaluated their method across several standard benchmarks, including Vision Transformers (ViT) and MLP-Mixer on ImageNet-1K/CIFAR, GPT-2 on WikiText-103, and ResNet-18 on ImageNet.

  • ViT-Base on ImageNet: Gaudi-GBLR reduced the FLOPs (floating-point operations) to 30% of the original model with virtually no loss in accuracy (78.51% vs 78.57%). It significantly outperformed other "hand-crafted" structured approaches like Monarch or Pixelfly at the same complexity levels.
  • GPT-2 on WikiText-103: The method achieved a perplexity of 19.24 using only 43.7% of the FLOPs, outperforming the dense baseline (19.36) and low-rank approximations (19.48).
  • Efficiency: Because the final learned structure is just a set of small, cropped matrices, the inference requires no mask computation overhead, leading to genuine theoretical speedups.

Limitations and Future Work

  • Initialization: The method currently relies on a Singular Value Decomposition (SVD) of a pre-trained dense matrix for initialization in fine-tuning tasks. While this is a one-time cost, it adds complexity to the pipeline.
  • Hardware Realization: While the paper shows a massive reduction in theoretical complexity (FLOPs), translating this to actual "wall-clock" speedups on GPUs is difficult. Current hardware is optimized for large, dense blocks; taking full advantage of the custom GBLR shapes would likely require specialized CUDA kernels.
  • Search Space: While GBLR is very flexible, it still assumes a block-based structure. Exploring even more irregular or non-linear structural parameterizations remains an open area for future research.

Summary updated

BibTeX
@inproceedings{lee2024differentiable,
  author = {Changwoo Lee and Hun-Seok Kim},
  title = {{Differentiable Learning of Generalized Structured Matrices for Efficient Deep Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=pAVJKp3Dvn},
}
Figure