Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

On the Relationship between Self-Attention and Convolutional Layers

About

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.

Jean-Baptiste Cordonnier, Andreas Loukas, Martin Jaggi• 2019

Related benchmarks

TaskDatasetResultRank
Table Structure RecognitionPubTabNet All 1.0 (test)
TEDS90.45
7
Table Structure RecognitionPubTabNet Simple 1.0 (test)
TEDS94.12
6
Table Structure RecognitionPubTabNet Complex 1.0 (test)
TEDS86.62
6
Showing 3 of 3 rows

Other info

Code

Follow for update