Dynamic Shuffle: An Efficient Channel Mixture Method

Kaijun Gong, Zhuowen Yin, Yushu Li, Kailing Guo, Xiangmin XuarXiv 2023

Abstract

The redundancy of Convolutional neural networks not only depends on weights but also depends on inputs. Shuffling is an efficient operation for mixing channel information but the shuffle order is usually pre-defined. To reduce the data-dependent redundancy, we devise a dynamic shuffle module to generate data-dependent permutation matrices for shuffling. Since the dimension of permutation matrix is proportional to the square of the number of input channels, to make the generation process efficiently, we divide the channels into groups and generate two shared small permutation matrices for each group, and utilize Kronecker product and cross group shuffle to obtain the final permutation matrices. To make the generation process learnable, based on theoretical analysis, softmax, orthogonal regularization, and binarization are employed to asymptotically approximate the permutation matrix. Dynamic shuffle adaptively mixes channel information with negligible extra computation and memory occupancy. Experiment results on image classification benchmark datasets CIFAR-10, CIFAR-100, Tiny ImageNet and ImageNet have shown that our method significantly increases ShuffleNets' performance. Adding dynamic generated matrix with learnable static matrix, we further propose static-dynamic-shuffle and show that it can serve as a lightweight replacement of ordinary pointwise convolution.

Introduction

In the pursuit of efficient deep learning, architectures like ShuffleNet have become foundational. By introducing "channel shuffling," these models allow information to flow between isolated groups of neurons without the heavy computational cost of standard convolutions. However, a significant limitation remains: the shuffle order is static. Regardless of whether the network processes a cat, a car, or a cloud, the channel mixing remains identical.

The paper Dynamic Shuffle: An Efficient Channel Mixture Method proposes that this "one-size-fits-all" approach limits model potential. By making the shuffle order depend on the input data, the authors introduce a way to enhance the performance of compact models with minimal overhead.

The Challenge of Static Shuffling

Convolutional Neural Networks (CNNs) are inherently redundant. To deploy them on mobile and edge devices, researchers often employ "group convolutions," which partition channels into independent groups. While efficient, this prevents cross-group information exchange. ShuffleNet addressed this by manually interleaving channels—a process akin to shuffling a deck of cards.

However, redundancy in a network exists not just in the static weights, but also in the dynamic feature maps (activations) that change with every input. A fixed shuffle might be optimal for certain features but sub-optimal for others. The challenge lies in creating a "dynamic" shuffle that is both learnable via backpropagation and computationally inexpensive.

Methodology: The Dynamic Shuffle Module

The core innovation is the Dynamic Shuffle Module, which utilizes a small auxiliary network to generate a custom permutation matrix for each input.

The Dynamic Shuffle Module architecture generates data-dependent permutation matrices using Kronecker products for efficiency.

Technical Implementation

  1. Efficiency via Kronecker Products: Generating a full $C \times C$ permutation matrix for $C$ channels is computationally prohibitive. The authors circumvent this by generating two smaller matrices and combining them using a Kronecker product. This approach represents complex, large-scale reordering with less than 1% of the total FLOPs.
  2. Differentiable Permutations: Discrete permutations are not naturally compatible with gradient descent. The authors employ several techniques to make the process learnable:
  3. Softmax: Provides a continuous approximation of the matrix.
  4. Orthogonal Regularization: A loss function that constrains the generated matrix to behave like a proper permutation matrix (where rows and columns sum to one).
  5. Straight-Through Estimator (STE): Allows gradients to bypass the discrete binarization step during training.
  6. Static-Dynamic Integration: The authors also propose a hybrid version that combines a fixed learnable matrix with the dynamic one, serving as an ultra-lightweight replacement for $1 \times 1$ convolutions.

Experimental Results

The method was validated across major benchmarks, including CIFAR-10, CIFAR-100, Tiny ImageNet, and ImageNet. The results demonstrate consistent improvements in accuracy with negligible increases in computational cost.

Classification accuracy (%) on CIFAR-100 shows significant gains when using Dynamic Shuffle over manual shuffling.

On the CIFAR-100 dataset, Dynamic Shuffle improved ShuffleNet v1 (g=3) accuracy from 70.53% to 73.32%. Similar gains were observed on the large-scale ImageNet dataset. Furthermore, by replacing $1 \times 1$ expansion layers in a ResNet-50 with the "static-dynamic shuffle," the authors reduced GFLOPs by approximately 20% while increasing accuracy on CIFAR-100 from 76.83% to 77.68%.

Conclusion

Dynamic Shuffle demonstrates that input-dependent channel mixing can significantly enhance the expressiveness of efficient neural networks. By leveraging the Kronecker product and clever regularization, the module remains lightweight enough for real-world mobile applications. While hardware-level optimization for dynamic memory shifting remains a challenge, this research paves the way for more "data-aware" architectures that adapt their internal structure to the task at hand.

Summary updated

BibTeX
@misc{gong2023dynamic,
  author = {Kaijun Gong and Zhuowen Yin and Yushu Li and Kailing Guo and Xiangmin Xu},
  title = {{Dynamic Shuffle: An Efficient Channel Mixture Method}},
  year = {2023},
  eprint = {2310.02776},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.02776},
}
Figure