Communication-Optimal Convolutional Neural Nets

James Demmel, Grace Dinh

Abstract: This paper establishes rigorous theoretical lower bounds for data movement in convolutional neural networks (CNNs) and introduces communication-optimal algorithms that reach these bounds. By leveraging Discrete Hölder-Brascamp-Lieb (HBL) inequalities and linear programming, the authors demonstrate that specialized convolution algorithms can significantly outperform standard matrix-multiplication-based approaches, particularly for small filters.

Introduction

In modern computer architecture, the primary bottleneck for performance is often data movement rather than arithmetic computation. Moving a single word of data between memory levels (e.g., from RAM to Cache) or between processors can cost orders of magnitude more time and energy than performing an arithmetic operation. While "classical" operations like matrix multiplication (GEMM) have been extensively optimized to minimize this movement, Convolutional Neural Networks (CNNs) present a more complex challenge.

A standard convolution involves seven nested loops. Most current deep learning frameworks simplify this by transforming the convolution into a large matrix multiplication using the im2col technique. However, this "one-size-fits-all" approach often misses opportunities for data reuse inherent in the specific structure of convolutions.

Theoretical Foundations and Methodology

The authors employ a combination of mathematical theory and optimization techniques to address these inefficiencies:

Discrete Hölder-Brascamp-Lieb (HBL) Inequalities

This advanced mathematical framework is used to prove the communication lower bounds. It allows the authors to bound the number of iterations that can be performed given a limited amount of data in fast memory. The derivation involves analyzing the ranks of various projections of the iteration space.

Table of ranks and inequalities derived from the Discrete Hölder-Brascamp-Lieb framework to establish communication lower bounds.

Linear Programming for Tiling

To find the best way to "tile" (break down) the 7D computation space to fit into a cache of size $M$, the authors transform the complex non-linear problem into a Linear Program (LP) by taking the logarithms of the loop bounds and tile sizes.

Geometric Partitioning

Because CNN parameters—such as image size, filter size, and stride—vary significantly across layers, the optimal tiling strategy changes depending on the input. The authors used an automated geometric algorithm to partition the entire parameter space into roughly 200 regions, each with its own optimal strategy.

Key Insights and Results

CNNs vs. Matrix Multiplication

The most significant finding is that for many common cases, specifically when filters are small (e.g., 3x3), the theoretical limit for data movement is lower than that of matrix multiplication. Their bound is better by a factor of $\min(M^{1/2}, (RS/\sigma_h\sigma_w)^{1/2})$. In modern CNNs where small filters are the standard, a new, fifth term in their lower-bound formula becomes dominant, allowing for much higher data reuse than previously thought possible.

Performance Benchmarks

Using the architectural parameters of AlexNet as a benchmark, the authors compared their theoretical performance against standard matrix-multiply-based approaches. Their results show:

  • Integer-Factor Reductions: Optimal algorithms can produce significant reductions in communication cost.
  • Data Reuse: In one specific example, their approach achieved 2.75x more data reuse than a communication-avoiding matrix multiply approach.
  • Tightness: The authors successfully demonstrated "matching upper bounds," meaning they identified the actual tiling algorithms that reach the theoretical limits.

Conclusion and Future Work

While the paper provides the mathematical "recipes" for optimal tilings, several steps remain for practical deployment. The current work focuses on sequential execution (moving data between a single cache and main memory). Future work will involve extending this to parallel systems where multiple processors communicate over a network. Additionally, the authors suggest that their LP-based approach could be integrated into compilers to automatically optimize arbitrary loop nests for any hardware, bridging the gap between theoretical optimality and production-ready libraries.

Summary updated

Abstract

Efficiently executing convolutional neural nets (CNNs) is important in many machine-learning tasks. Since the cost of moving a word of data, either between levels of a memory hierarchy or between processors over a network, is much higher than the cost of an arithmetic operation, minimizing data movement is critical to performance optimization. In this paper, we present both new lower bounds on data movement needed for CNNs, and optimal sequential algorithms that attain these lower bounds. In most common cases, our optimal algorithms can attain significantly more data reuse than matrix multiplication.
BibTeX
@misc{demmel2018communication,
  author = {James Demmel and Grace Dinh},
  title = {{Communication-Optimal Convolutional Neural Nets}},
  year = {2018},
  eprint = {1802.06905},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.06905},
}

Loading related content...

Figure