On the Surprising Effectiveness of Attention Transfer for Vision Transformers

Alexander C. Li, Yuandong Tian, Beidi Chen, Deepak Pathak, Xinlei Chen
11/14/2024
cs.LGcs.AIcs.CV

No official code found. Best implementation: alexlioralexli/attention-transfer (24 stars, last commit 2024-11-19).

Abstract

Conventional wisdom suggests that pre-training Vision Transformers (ViT) improves downstream performance by learning useful representations. Is this actually true? We investigate this question and find that the features and representations learned during pre-training are not essential. Surprisingly, using only the attention patterns from pre-training (i.e., guiding how information flows between tokens) is sufficient for models to learn high quality features from scratch and achieve comparable downstream performance. We show this by introducing a simple method called attention transfer, where only the attention patterns from a pre-trained teacher ViT are transferred to a student, either by copying or distilling the attention maps. Since attention transfer lets the student learn its own features, ensembling it with a fine-tuned teacher also further improves accuracy on ImageNet. We systematically study various aspects of our findings on the sufficiency of attention maps, including distribution shift settings where they underperform fine-tuning. We hope our exploration provides a better understanding of what pre-training accomplishes and leads to a useful alternative to the standard practice of fine-tuning

View on arXivView PDF

Code Implementations(1)

242PythonSep 27, 20241 years agoNOASSERTION

Similar Papers

Cite this paper

@article{li2024surprising,
  title  = {On the Surprising Effectiveness of Attention Transfer for Vision Transformers},
  author = {Alexander C. Li and Yuandong Tian and Beidi Chen and Deepak Pathak and Xinlei Chen},
  year   = {2024},
  eprint = {2411.09702},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2411.09702},
  url    = {http://arxiv.org/abs/2411.09702v1},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.09702.svg)](https://codeofpaper.com/paper/2411.09702)

Discussion