[Paper Review] Learning Fast Algorithms for Linear Transforms Using Butterfly Factorizations
This paper proposes a differentiable, parameterized butterfly factorization that automatically learns fast $O(N\log N)$ algorithms for structured linear transforms—such as DFT, DCT, Hadamard, and convolutions—by representing them as products of sparse, structured block-diagonal matrices. It achieves state-of-the-art performance in end-to-end ML models, exceeding unconstrained fully connected layers on CIFAR-10 by 3.9 accuracy points with 40× fewer parameters and 4× faster inference.
Fast linear transforms are ubiquitous in machine learning, including the discrete Fourier transform, discrete cosine transform, and other structured transformations such as convolutions. All of these transforms can be represented by dense matrix-vector multiplication, yet each has a specialized and highly efficient (subquadratic) algorithm. We ask to what extent hand-crafting these algorithms and implementations is necessary, what structural priors they encode, and how much knowledge is required to automatically learn a fast algorithm for a provided structured transform. Motivated by a characterization of fast matrix-vector multiplication as products of sparse matrices, we introduce a parameterization of divide-and-conquer methods that is capable of representing a large class of transforms. This generic formulation can automatically learn an efficient algorithm for many important transforms; for example, it recovers the $O(N \log N)$ Cooley-Tukey FFT algorithm to machine precision, for dimensions $N$ up to $1024$. Furthermore, our method can be incorporated as a lightweight replacement of generic matrices in machine learning pipelines to learn efficient and compressible transformations. On a standard task of compressing a single hidden-layer network, our method exceeds the classification accuracy of unconstrained matrices on CIFAR-10 by 3.9 points -- the first time a structured approach has done so -- with 4X faster inference speed and 40X fewer parameters.
Motivation & Objective
- To automatically learn efficient, subquadratic algorithms for structured linear transforms without hand-crafted design.
- To reduce reliance on platform-specific, hand-optimized libraries (e.g., FFTW, cuFFT) by enabling end-to-end differentiable learning of fast transforms.
- To discover whether structured parameterizations can outperform unconstrained dense layers in real-world ML benchmarks.
- To characterize the minimal inductive bias required to learn fast algorithms via sparse matrix factorizations.
- To integrate a learnable, fast transform layer into deep learning pipelines for improved efficiency and performance.
Proposed method
- Parameterize linear transforms as products of $O(\log N)$ butterfly matrices—structured, sparse, block-diagonal matrices with $O(N)$ total parameters.
- Use a differentiable optimization framework to learn the butterfly parameters from input-output pairs of the target transform.
- Leverage the recursive divide-and-conquer structure of butterfly factorizations to enable $O(N\log N)$ matrix-vector multiplication.
- Represent the transform as a composition of $O(\log N)$ stages, each applying a permutation and a block-diagonal matrix with $2^k$ blocks of size $N/2^k$.
- Integrate the butterfly layer into neural networks as a lightweight, compressible alternative to fully connected layers.
- Implement the fast multiplication algorithm in 5 lines of Python, enabling efficient inference on any hardware without transform-specific tuning.
Experimental results
Research questions
- RQ1Can a generic, differentiable parameterization learn fast $O(N\log N)$ algorithms for diverse structured transforms like DFT and DCT?
- RQ2To what extent can a structured, learnable matrix factorization outperform unconstrained dense layers in accuracy, parameter efficiency, and inference speed?
- RQ3Can the same butterfly parameterization recover known fast algorithms (e.g., Cooley-Tukey FFT) to machine precision for realistic sizes up to $N=1024$?
- RQ4How does the performance of a learned butterfly transform compare to highly optimized, hand-tuned kernels like cuFFT and cuDNN?
- RQ5Can the butterfly layer improve performance in standard deep learning architectures like ResNet18 without adding significant parameters?
Key findings
- The method recovers the $O(N\log N)$ Cooley-Tukey FFT algorithm to machine precision for $N$ up to 1024, outperforming sparse and low-rank baselines.
- On CIFAR-10, a single-layer network with a butterfly parameterization achieves 93.89% accuracy—3.9 points higher than an unconstrained fully connected layer—while using 40× fewer parameters.
- The butterfly layer improves ResNet18 accuracy by 0.43 points on CIFAR-10, with only a 0.07% increase in model parameters.
- Inference with the learned butterfly matrix is up to two orders of magnitude faster than dense GEMV and within 3–5× of specialized FFT/DCT kernels on CPU.
- Training with the butterfly layer is 15% faster than dense GEMM and within 40% of FFT on GPU, demonstrating competitive training efficiency.
- The method generalizes to learn convolutions and other structured transforms, with no need for transform-specific optimizations in the fast multiplication algorithm.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.