HackerPapers

arXiv:2105.02723cs.CV

Do You Even Need Attention? A Stack of Feed-Forward Layers Does Surprisingly Well on ImageNet

Luke Melas-Kyriazi

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

The strong performance of vision transformers on image classification and other vision tasks is often attributed to the design of their multi-head attention layers. However, the extent to which attention is responsible for this strong performance remains unclear. In this short report, we ask: is the attention layer even necessary? Specifically, we replace the attention layer in a vision transformer with a feed-forward layer applied over the patch dimension. The resulting architecture is simply a series of feed-forward layers applied over the patch and feature dimensions in an alternating fashion. In experiments on ImageNet, this architecture performs surprisingly well: a ViT/DeiT-base-sized model obtains 74.9\% top-1 accuracy, compared to 77.9\% and 79.9\% for ViT and DeiT respectively. These results indicate that aspects of vision transformers other than attention, such as the patch embedding, may be more responsible for their strong performance than previously thought. We hope these results prompt the community to spend more time trying to understand why our current models are as effective as they are.

arXiv comments
Short Technical Report. GitHub: https://github.com/lukemelas/do-you-even-need-attention
Journal reference
DOI
Subjects
cs.CVComputer Vision and Pattern Recognition

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Feb 2023 to Feb 2023. Found in 2 HN submissions from May 2021 to Jan 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • https://arxiv.org/abs/2105.02723 The strong performance of vision transformers on image classification and other vision tasks is often attributed to the design of their multi-head attention layers. However, the extent to which attention is responsible for this strong performance…

      hprotagonistView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.