Convolution is outer product

Jean-Marc AndreoliarXiv 2019 · OpenReview

Abstract

Deep neural networks are composed of layers of parametrised linear operations intertwined with non linear activations. In basic models, such as the multi-layer perceptron, a linear layer operates on a simple input vector embedding of the instance being processed, and produces an output vector embedding by straight multiplication by a matrix parameter. In more complex models, the input and output are structured and their embeddings are higher order tensors. The parameter of each linear operation must then be controlled so as not to explode with the complexity of the structures involved. This is essentially the role of convolution models, which exist in many flavours dependent on the type of structure they deal with (grids, networks, time series etc.). We present here a unified framework which aims at capturing the essence of these diverse models, allowing a systematic analysis of their properties and their mutual enrichment. We also show that attention models naturally fit in the same framework: attention is convolution in which the structure itself is adaptive, and learnt, instead of being given a priori.

Introduction

The landscape of deep learning is currently a "zoo" of specialized architectures. Convolutional Neural Networks (CNNs) dominate image processing, Graph Convolutional Networks (GCNs) handle non-Euclidean data, and Attention mechanisms power Transformers for sequential tasks. While these models often achieve similar goals, they are typically described using disparate mathematical languages. This paper addresses the lack of a single, rigorous framework that explains how these operations relate. By bridging this gap, we can better analyze properties like translation equivariance, optimize computation, and design hybrid models.

A Unified Tensor Framework

The core of the proposed framework is a generic model of convolution based on tensor factorization. Instead of an unstructured weight matrix, a convolution layer is viewed as a partially factorized tensor $\Phi = A \circ \Theta$.

The unified framework representing convolution as a mixed product of a structural basis $A$, input $X$, and parameter $\Theta$.

This "mixed product" operator ($\circ$) combines features of both inner and outer products. The factorization involves two primary components:

  1. The Basis ($A$): This tensor characterizes the structure of the data. In CNNs, $A$ consists of shift matrices defining pixel neighborhoods. In GCNs, it is derived from the graph's adjacency matrix.
  2. The Parameter ($\Theta$): This tensor contains the learnable weights applied across the structure defined by $A$.

Key Insights: Attention as Adaptive Convolution

The most significant insight is the formalization of Attention as a form of "content-based convolution." In traditional convolution, the basis $A$ is fixed (e.g., a grid). In attention, $A$ is computed dynamically based on the similarity between input and output content (keys and queries).

Mapping structural relationships in 1D and 2D data to sparse basis matrices within the unified framework.

The "magic" of CNNs—translation equivariance and locality—stems entirely from choosing a basis $A$ composed of specific shift matrices. This framework also clarifies why "positional encoding" is used in Transformers: it is a workaround for the lack of inherent structural information in the attention basis. A more natural approach would be to integrate shift matrices directly into the attention mechanism's basis.

Key Results

The paper provides mathematical propositions mapping diverse models into this framework:

  • Universal Formula: Proposition 2 defines convolution over arbitrary structures as $y = \sum_k A_k^\top x \Theta_k$.
  • Equivalence: Graph Attention Networks (GATs) and Transformers are shown to be mathematically equivalent to specific configurations of this formula where $A$ matrices are generated via bi-affine attention.
  • Dimension Reduction: The framework accounts for "scaled dot product attention" and techniques like depth-wise separable convolutions as specific constraints or factorizations within the parameter tensor $\Theta$.

Limitations and Future Work

Currently, the framework is limited to linear transformations and does not naturally account for non-linear operations like max pooling. Furthermore, while mathematically elegant, practical implementation requires specialized kernels to exploit the sparsity of the basis tensor $A$. Future work may involve developing hybrid architectures that combine fixed structural bases with adaptive, content-based bases in a single layer.

Summary updated

BibTeX
@misc{andreoli2019convolution,
  author = {Jean-Marc Andreoli},
  title = {{Convolution is outer product}},
  year = {2019},
  eprint = {1905.01289},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.01289},
}
Figure