Mimetic Initialization of Self-Attention Layers

Asher Trockman, J. Zico Kolter
5/16/2023
cs.CVcs.AIcs.LG

No confident code implementation found for this paper.

Abstract

It is notoriously difficult to train Transformers on small datasets; typically, large pre-trained models are instead used as the starting point. We explore the weights of such pre-trained Transformers (particularly for vision) to attempt to find reasons for this discrepancy. Surprisingly, we find that simply initializing the weights of self-attention layers so that they "look" more like their pre-trained counterparts allows us to train vanilla Transformers faster and to higher final accuracies, particularly on vision tasks such as CIFAR-10 and ImageNet classification, where we see gains in accuracy of over 5% and 4%, respectively. Our initialization scheme is closed form, learning-free, and very simple: we set the product of the query and key weights to be approximately the identity, and the product of the value and projection weights to approximately the negative identity. As this mimics the patterns we saw in pre-trained Transformers, we call the technique "mimetic initialization".

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{trockman2023mimetic,
  title  = {Mimetic Initialization of Self-Attention Layers},
  author = {Asher Trockman and J. Zico Kolter},
  year   = {2023},
  eprint = {2305.09828},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.09828v1},
  journal = {ICML 2023 2023}
}

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/2305.09828.svg)](https://codeofpaper.com/paper/2305.09828)

Discussion