On the Relationship between Self-Attention and Convolutional Layers

By Jean-Baptiste Cordonnier, Andreas Loukas, Martin Jaggi. 2019

645 citations recorded by the source corpus.

Recent trends of incorporating attention mechanisms in vision have led researchers to reconsider the supremacy of convolutional layers as a primary building block. Beyond helping CNNs to handle long-range dependencies, Ramachandran et al. (2019) showed that attention can completely replace convolution and achieve state-of-the-art performance on vision tasks. This raises the question: do learned attention layers operate similarly to convolutional layers? This work provides evidence that attention layers can perform convolution and, indeed, they often learn to do so in practice. Specifically, we prove that a multi-head self-attention layer with sufficient number of heads is at least as expressive as any convolutional layer. Our numerical experiments then show that self-attention layers attend to pixel-grid patterns similarly to CNN layers, corroborating our analysis. Our code is publicly available.

Subfields: Artificial Intelligence, Computer Vision and Pattern Recognition, Model Architectures

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Quoc V. Le
  2. Jianfeng Gao
  3. Mohit Bansal
  4. Dacheng Tao
  5. Trevor Darrell
  6. Yoshua Bengio
  7. Luc Van Gool
  8. Sergey Levine

In Computer Vision and Pattern Recognition

  1. Luc Van Gool
  2. Dacheng Tao
  3. Ming-Hsuan Yang
  4. Xiaogang Wang
  5. Trevor Darrell
  6. Andrew Zisserman
  7. Jitendra Malik
  8. Andrea Vedaldi

In Model Architectures

  1. Quoc V. Le
  2. Luc Van Gool
  3. Hongsheng Li
  4. Jianfeng Gao
  5. Jiashi Feng
  6. Fahad Shahbaz Khan
  7. Herv'e J'egou
  8. Yu Qiao

Citations in the corpus