Kaleidoscope: An Efficient, Learnable Representation For All Structured Linear Maps

Tri Dao, Nimit S. Sohoni, Albert Gu, Matthew Eichhorn, Amit Blonder +3 more
12/29/2020
60 citations
cs.LGstat.ML

Official code: HazyResearch/butterfly (183 stars, Python, Apache-2.0, last commit 2023-10-05).

Abstract

Modern neural network architectures use structured linear transformations, such as low-rank matrices, sparse matrices, permutations, and the Fourier transform, to improve inference speed and reduce memory usage compared to general linear maps. However, choosing which of the myriad structured transformations to use (and its associated parameterization) is a laborious task that requires trading off speed, space, and accuracy.

Show full abstract

We consider a different approach: we introduce a family of matrices called kaleidoscope matrices (K-matrices) that provably capture any structured matrix with near-optimal space (parameter) and time (arithmetic operation) complexity. We empirically validate that K-matrices can be automatically learned within end-to-end pipelines to replace hand-crafted procedures, in order to improve model quality. For example, replacing channel shuffles in ShuffleNet improves classification accuracy on ImageNet by up to 5%. K-matrices can also simplify hand-engineered pipelines -- we replace filter bank feature computation in speech data preprocessing with a learnable kaleidoscope layer, resulting in only 0.4% loss in accuracy on the TIMIT speech recognition task. In addition, K-matrices can capture latent structure in models: for a challenging permuted image classification task, a K-matrix based representation of permutations is able to learn the right latent structure and improves accuracy of a downstream convolutional model by over 9%. We provide a practically efficient implementation of our approach, and use K-matrices in a Transformer network to attain 36% faster end-to-end inference speed on a language translation task.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Butterfly matrix multiplication in PyTorch

18336Python, CudaNov 12, 20183 years agoApache-2.0

Similar Papers

Cite this paper

@article{dao2020kaleidoscope,
  title  = {Kaleidoscope: An Efficient, Learnable Representation For All Structured Linear Maps},
  author = {Tri Dao and Nimit S. Sohoni and Albert Gu and Matthew Eichhorn and Amit Blonder and Megan Leszczynski and Atri Rudra and Christopher Ré},
  year   = {2020},
  eprint = {2012.14966},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2012.14966}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2012.14966.svg)](https://codeofpaper.com/paper/2012.14966)

Discussion