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

Mimetic Initialization of Self-Attention Layers

About

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".

Asher Trockman, J. Zico Kolter• 2023

Related benchmarks

TaskDatasetResultRank
Image ClassificationImageNet-1K 1.0 (val)
Top-1 Accuracy48.1
1866
Image ClassificationImageNet-1K
Top-1 Acc54.3
836
Image ClassificationCIFAR-10
Accuracy91.6
507
Image ClassificationFood-101
Accuracy67.1
494
Image ClassificationStanford Cars
Accuracy34.2
477
Image ClassificationCUB-200 2011
Accuracy39.6
257
Image ClassificationDownstream Datasets Average
Average Accuracy58.3
57
Image ClassificationiNaturalist
Accuracy52.2
51
Showing 8 of 8 rows

Other info

Follow for update