Deep Fried Convnets

Zichao Yang, Marcin Moczulski, Misha Denil, Nando de Freitas, Alexander J. Smola, Le Song, Ziyu Wang

Abstract

The fully-connected layers of deep convolutional neural networks typically contain over 90% of the network parameters. Reducing the number of parameters while preserving predictive performance is critically important for training big models in distributed systems and for deployment in embedded devices. In this paper, we introduce a novel Adaptive Fastfood transform to reparameterize the matrix-vector multiplication of fully connected layers. Reparameterizing a fully connected layer with $d$ inputs and $n$ outputs with the Adaptive Fastfood transform reduces the storage and computational costs from $O(nd)$ to $O(n)$ and $O(n \log d)$ respectively. Using the Adaptive Fastfood transform in convolutional networks results in what we call a deep fried convnet. These convnets are end-to-end trainable, and enable us to attain substantial reductions in the number of parameters without affecting prediction accuracy on the MNIST and ImageNet datasets.

Introduction

In modern convolutional neural networks (CNNs), there is a significant disparity between computational workload and memory requirements. While convolutional layers perform the bulk of floating-point operations (FLOPs), they contain a relatively small fraction of the total parameters. In contrast, fully connected (FC) layers often account for over 90% of the network's parameters despite being computationally inexpensive. This "parameter bloat" hinders the deployment of state-of-the-art models on memory-constrained devices and complicates distributed training.

"Deep Fried Convnets" addresses this issue by introducing the Adaptive Fastfood transform, a method to reparameterize FC layers into structured products of diagonal and Hadamard matrices. This approach allows for training compressed architectures from scratch, rather than relying on post-hoc compression techniques like SVD or pruning.

The Adaptive Fastfood Transform

The core innovation is the replacement of a standard dense weight matrix $W \in \mathbb{R}^{n \times d}$ with a sequence of structured transformations. The operation is defined as: $$h_{l+1} = (SHG\Pi HB) h_l$$

Architecture of a Deep Fried Convnet, showing the replacement of traditional fully connected layers with the Fastfood transform.

The components of this transform include:

  • $B, G, S$: Diagonal matrices. Unlike traditional Fastfood transforms where these are random, here they are learned parameters updated via backpropagation.
  • $\Pi$: A fixed random permutation matrix.
  • $H$: The Walsh-Hadamard matrix, which enables the Fast Hadamard Transform. This reduces computational complexity from $O(nd)$ to $O(n \log d)$.

By making the scaling factors adaptive, the network can learn the optimal projections for the specific task, significantly outperforming static random projections.

Experimental Evaluation

The authors evaluated Deep Fried Convnets on the MNIST and ImageNet (ILSVRC-2012) benchmarks.

MNIST Results

On the MNIST dataset, the model achieved an error rate of 0.71%, matching the reference LeNet architecture while utilizing 11 times fewer parameters in the FC layers. This demonstrates that the structured transform can capture the necessary information for digit recognition with a fraction of the storage.

ImageNet Results

For ImageNet, the authors modified the AlexNet architecture. They tested both "fixed feature" training and "joint training" (training the entire network from scratch).

Performance comparison on ImageNet (joint training). Adaptive Fastfood models achieve comparable or better error rates than the reference model with significantly fewer parameters.

As shown in the results, the Adaptive Fastfood 32 model achieved a 41.93% error rate, outperforming the reference AlexNet (42.59%) while reducing the total parameter count from 58.7M to 32.8M.

Discussion and Limitations

Deep Fried Convnets demonstrate that training structured, compressed models from the start is highly effective. However, some challenges remain:

  • The Softmax Bottleneck: While internal FC layers were compressed, the final softmax layer remains dense to maintain performance, accounting for nearly 99% of the remaining parameters in the ImageNet model.
  • Hardware Optimization: Although theoretical complexity is lower, realizing actual wall-clock speedups requires custom GPU kernels optimized for the Fast Hadamard Transform, as current performance is dominated by convolutional layers.

Future work includes extending structured transforms to the final softmax layer and developing optimized kernels to leverage the theoretical efficiency gains.

Summary updated

BibTeX
@inproceedings{yang2015deep,
  author = {Zichao Yang and Marcin Moczulski and Misha Denil and Nando de Freitas and Alexander J. Smola and Le Song and Ziyu Wang},
  title = {{Deep Fried Convnets}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2015},
  url = {https://openreview.net/forum?id=SyZXqgfOZB},
}
Figure